public static ResultList expandSqlResultSet(Sql sql,ResultSet rs) throws SQLException {
  ResultList resList=new ResultList();
  if (rs == null)   return resList;
  ColumnDescriptor desc=new ColumnDescriptor();
  desc.addColumn("NAME",false,1);
  desc.addColumn("VALUE",false,2);
  resList.setColumnDescriptor(desc);
  java.sql.ResultSetMetaData meta=rs.getMetaData();
  int colCnt=meta.getColumnCount();
  int rowCnt=0;
  while (rs.next()) {
    if (rowCnt > 0) {
      ResultRow row=new ResultRow();
      row.addColumn("--- ROW " + (rowCnt + 1) + "---");
      row.addColumn("");
      resList.addRow(row);
    }
    for (int i=1; i <= colCnt; i++) {
      ResultRow row=new ResultRow();
      if (rowCnt > 0)       row.addColumn(meta.getColumnName(i) + "(" + (rowCnt + 1)+ ")");
 else       row.addColumn(meta.getColumnName(i));
      row.addColumn(rs.getString(i));
      resList.addRow(row);
    }
    rowCnt++;
  }
  return resList;
}

public static ResultList expandSqlResultSet ( Sql sql , ResultSet rs ) throws SQLException { ResultList resList = new ResultList ( ) ; if ( rs == null ) return resList ; ColumnDescriptor desc = new ColumnDescriptor ( ) ; desc . addColumn ( "NAME" , false , 1 ) ; desc . addColumn ( "VALUE" , false , 2 ) ; resList . setColumnDescriptor ( desc ) ; java . sql . ResultSetMetaData meta = rs . getMetaData ( ) ; int colCnt = meta . getColumnCount ( ) ; int rowCnt = 0 ; while ( rs . next ( ) ) { if ( rowCnt > 0 ) { ResultRow row = new ResultRow ( ) ; row . addColumn ( "--- ROW " + ( rowCnt + 1 ) + "---" ) ; row . addColumn ( "" ) ; resList . addRow ( row ) ; } for ( int i = 1 ; i <= colCnt ; i ++ ) { ResultRow row = new ResultRow ( ) ; if ( rowCnt > 0 ) row . addColumn ( meta . getColumnName ( i ) + "(" + ( rowCnt + 1 ) + ")" ) ; else row . addColumn ( meta . getColumnName ( i ) ) ; row . addColumn ( rs . getString ( i ) ) ; resList . addRow ( row ) ; } rowCnt ++ ; } return resList ; }
expand a single row to multiple rows . one row per column .
