Re: BUG #6293: JDBC driver performance - Mailing list pgsql-bugs

From Teun Hoogendoorn
Subject Re: BUG #6293: JDBC driver performance
Date
Msg-id OF94C90797.62CD1E8D-ONC125794B.003D5C91-C125794B.003D9983@atsc.nl
Whole thread Raw
In response to BUG #6293: JDBC driver performance  ("Teun Hoogendoorn" <th@atsc.nl>)
List pgsql-bugs
Hi Kris,
This is exactly what I'm doing. I understand your solution, but that's
not really an option for me (I have to change a lot of code).

Maybe the driver can cache the ResultSetMetaData for the ResultSet?
BTW. I looked into the driver code to look for a solution for my problem.
I came
across the following lines of code (in
AbstractJdbc2ResultSetMetaData.java):

Statement stmt = connection.createStatement();
        ResultSet rs = stmt.executeQuery(sql.toString());
        while (rs.next()) {
            int table = rs.getInt(1);
            int column = rs.getInt(2);
            String columnName = rs.getString(3);
            String tableName = rs.getString(4);
            String schemaName = rs.getString(5);
            int nullable = rs.getBoolean(6) ?
ResultSetMetaData.columnNoNulls : ResultSetMetaData.columnNullable;
            boolean autoIncrement = rs.getBoolean(7);
            for (int i=0; i<fields.length; i++) {
                if (fields[i].getTableOid() == table &&
fields[i].getPositionInTable() == column) {
                    fields[i].setColumnName(columnName);
                    fields[i].setTableName(tableName);
                    fields[i].setSchemaName(schemaName);
                    fields[i].setNullable(nullable);
                    fields[i].setAutoIncrement(autoIncrement);
                }
            }
        }

Shouldn't this ResultSet/Statement be closed?
Thanks,
Teun Hoogendoorn

pgsql-bugs by date:

Previous
From: Archana Sachin Ghag
Date:
Subject: ST_Distance Issue
Next
From: Robert Haas
Date:
Subject: Re: ST_Distance Issue