@Override public void close() { delegate.close(); }
@Test public void closeResultSet() { ResultSet rs = ResultSets.forRows( Type.struct(Type.StructField.of("f1", Type.string())), Arrays.asList(Struct.newBuilder().set("f1").to("x").build())); rs.close(); expected.expect(IllegalStateException.class); rs.getCurrentRowAsStruct(); }
@Override public void close() { delegate.close(); }
@Override public <T> List<T> mapToList(ResultSet resultSet, Class<T> entityClass, Set<String> includeColumns, boolean allowMissingColumns) { ArrayList<T> result = new ArrayList<>(); while (resultSet.next()) { result.add(this.entityReader.read(entityClass, resultSet.getCurrentRowAsStruct(), includeColumns, allowMissingColumns)); } resultSet.close(); return result; }
@Override public <T> List<T> mapToList(ResultSet resultSet, Class<T> entityClass, Set<String> includeColumns, boolean allowMissingColumns) { ArrayList<T> result = new ArrayList<>(); while (resultSet.next()) { result.add(this.entityReader.read(entityClass, resultSet.getCurrentRowAsStruct(), includeColumns, allowMissingColumns)); } resultSet.close(); return result; }
/** * Return a map where key is the table name and the value is the parent table name. If * the table name in the key has no parent then the value is null. * @return the map of the table names. */ public Map<String, String> getChildParentTablesMap() { Map<String, String> relationships = new HashMap<>(); ResultSet results = this.databaseClient.singleUse() .executeQuery(TABLE_AND_PARENT_QUERY); while (results.next()) { Struct row = results.getCurrentRowAsStruct(); relationships.put(row.getString(TABLE_NAME_COL_NAME), row.isNull(PARENT_TABLE_NAME_COL_NAME) ? null : row.getString(PARENT_TABLE_NAME_COL_NAME)); } results.close(); return relationships; }
/** * Return a map where key is the table name and the value is the parent table name. If * the table name in the key has no parent then the value is null. * @return the map of the table names. */ public Map<String, String> getChildParentTablesMap() { Map<String, String> relationships = new HashMap<>(); ResultSet results = this.databaseClient.singleUse() .executeQuery(TABLE_AND_PARENT_QUERY); while (results.next()) { Struct row = results.getCurrentRowAsStruct(); relationships.put(row.getString(TABLE_NAME_COL_NAME), row.isNull(PARENT_TABLE_NAME_COL_NAME) ? null : row.getString(PARENT_TABLE_NAME_COL_NAME)); } results.close(); return relationships; }