private ResultSet readResultSet(String[] colNames) throws IOException { this.columnNames = colNames; initRead(); SimpleResultSet result = new SimpleResultSet(this); makeColumnNamesUnique(); for (String columnName : columnNames) { result.addColumn(columnName, Types.VARCHAR, Integer.MAX_VALUE, 0); } return result; }
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; }