1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00
This fixes a problem in ResultSet.getDate() when the column is NULL
(reported by Vincent Partington <Vincent.Partington@nmg.nl>)

And fixes a problem with Field's (ResultSet.getObject() was proving to be
slow as it repetedly send queries for oid -> name mapping - fixed by
creating a cache. (reported by Mario Ellebrecht <ellebrec@nads.de>)
This commit is contained in:
Marc G. Fournier
1998-04-18 18:32:44 +00:00
parent 87d96ed672
commit b542fa1a6e
5 changed files with 60 additions and 6 deletions

View File

@ -54,13 +54,21 @@ public class Field
public int getSQLType() throws SQLException
{
if(sql_type == -1) {
ResultSet result = (postgresql.ResultSet)conn.ExecSQL("select typname from pg_type where oid = " + oid);
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
throw new SQLException("Unexpected return from query for type");
result.next();
type_name = result.getString(1);
type_name = (String)conn.fieldCache.get(new Integer(oid));
// it's not in the cache, so perform a query, and add the result to
// the cache
if(type_name==null) {
ResultSet result = (postgresql.ResultSet)conn.ExecSQL("select typname from pg_type where oid = " + oid);
if (result.getColumnCount() != 1 || result.getTupleCount() != 1)
throw new SQLException("Unexpected return from query for type");
result.next();
type_name = result.getString(1);
conn.fieldCache.put(new Integer(oid),type_name);
result.close();
}
sql_type = getSQLType(type_name);
result.close();
}
return sql_type;
}