static Meta.Frame frame(ResultSet resultSet,long offset,int fetchMaxRowCount,Calendar calendar) throws SQLException {
  final ResultSetMetaData metaData=resultSet.getMetaData();
  final int columnCount=metaData.getColumnCount();
  final int[] types=new int[columnCount];
  for (int i=0; i < types.length; i++) {
    types[i]=metaData.getColumnType(i + 1);
  }
  final List<Object> rows=new ArrayList<>();
  boolean done=fetchMaxRowCount == 0;
  for (int i=0; fetchMaxRowCount < 0 || i < fetchMaxRowCount; i++) {
    if (!resultSet.next()) {
      done=true;
      resultSet.close();
      break;
    }
    Object[] columns=new Object[columnCount];
    for (int j=0; j < columnCount; j++) {
      columns[j]=getValue(resultSet,types[j],j,calendar);
    }
    rows.add(columns);
  }
  return new Meta.Frame(offset,done,rows);
}

static Meta . Frame frame ( ResultSet resultSet , long offset , int fetchMaxRowCount , Calendar calendar ) throws SQLException { final ResultSetMetaData metaData = resultSet . getMetaData ( ) ; final int columnCount = metaData . getColumnCount ( ) ; final int [ ] types = new int [ columnCount ] ; for ( int i = 0 ; i < types . length ; i ++ ) { types [ i ] = metaData . getColumnType ( i + 1 ) ; } final List < Object > rows = new ArrayList < > ( ) ; boolean done = fetchMaxRowCount == 0 ; for ( int i = 0 ; fetchMaxRowCount < 0 || i < fetchMaxRowCount ; i ++ ) { if ( ! resultSet . next ( ) ) { done = true ; resultSet . close ( ) ; break ; } Object [ ] columns = new Object [ columnCount ] ; for ( int j = 0 ; j < columnCount ; j ++ ) { columns [ j ] = getValue ( resultSet , types [ j ] , j , calendar ) ; } rows . add ( columns ) ; } return new Meta . Frame ( offset , done , rows ) ; }
creates a frame containing a given number or unlimited number of rows from a result set .
