ResultSet rs = connection.execSQLQuery(sb.toString(), resultsettype, ResultSet.CONCUR_READ_ONLY);
connection.execSQLQuery(sb.toString(), resultsettype, ResultSet.CONCUR_READ_ONLY);
private Map<String, List<SchemaField>> getAllSchema(Connection connection, String project) throws SQLException { BaseConnection pgConnection = connection.unwrap(BaseConnection.class); Map<String, List<SchemaField>> map = new HashMap<>(); ResultSet resultSet = pgConnection.execSQLQuery(format("SELECT c.relname, a.attname, typname\n" + "FROM pg_catalog.pg_class c\n" + " JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" + " LEFT JOIN pg_inherits i ON (i.inhrelid = c.oid)\n" + " JOIN pg_attribute a ON (a.attrelid=c.oid)\n" + " JOIN pg_type t ON (a.atttypid = t.oid)\n" + " WHERE n.nspname = '%s' and c.relkind IN ('r', 'p', '') and i.inhrelid is null\n" + " AND n.nspname <> 'pg_catalog'\n" + " AND n.nspname <> 'information_schema'\n" + " AND n.nspname !~ '^pg_toast' \n" + " AND a.attnum > 0 AND NOT a.attisdropped AND c.relname not like '\\$%%' ESCAPE '\\' and c.relname != '_users' AND a.attname != '$server_time'", checkLiteral(project))); while (resultSet.next()) { String columnName = resultSet.getString(2); FieldType fieldType; try { fieldType = fromSql(pgConnection.getTypeInfo().getSQLType(resultSet.getString(3)), resultSet.getString(3)); } catch (IllegalStateException e) { continue; } map.computeIfAbsent(resultSet.getString(1), (k) -> new ArrayList<>()).add(new SchemaField(columnName, fieldType)); } return map; }
List<SchemaField> schemaFields = Lists.newArrayList(); ResultSet resultSet = pgConnection.execSQLQuery(format("SELECT a.attname, typname\n" + "FROM pg_catalog.pg_class c\n" + " JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" +
ResultSet rs = connection.execSQLQuery(sb.toString(), resultsettype, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = connection.execSQLQuery(sb.toString(), resultsettype, ResultSet.CONCUR_READ_ONLY);