code: public static List<List<Object>> buildResults(Result result,
  			GeoPackageDataType[] dataTypes, Integer limit) {
  
  		List<List<Object>> results = new ArrayList<>();
  		try {
  			int columns = result.getColumnCount();
  			while (result.moveToNext()) {
  				List<Object> row = new ArrayList<>();
  				for (int i = 0; i < columns; i++) {
  					row.add(result.getValue(i, dataTypes != null ? dataTypes[i]
  							: null));
  				}
  				results.add(row);
  				if (limit != null && results.size() >= limit) {
  					break;
  				}
  			}
  		} finally {
  			result.close();
  		}
  
  		return results;
  	}
docs: Build the result rows from the result and the optional limit
  
  @param result
  result
  @param dataTypes
  column data types
  @param limit
  result row limit
  @return results