Beispiel #1
0
 private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) {
   int columnCount = rs.getVisibleColumnCount();
   SimpleResultSet simple = new SimpleResultSet();
   for (int i = 0; i < columnCount; i++) {
     String name = rs.getColumnName(i);
     int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i));
     int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i));
     int scale = rs.getColumnScale(i);
     simple.addColumn(name, sqlType, precision, scale);
   }
   rs.reset();
   for (int i = 0; i < maxrows && rs.next(); i++) {
     Object[] list = new Object[columnCount];
     for (int j = 0; j < columnCount; j++) {
       list[j] = rs.currentRow()[j].getObject();
     }
     simple.addRow(list);
   }
   return simple;
 }