Re: [Bug] ResultSet#getMetaData() returns null - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: [Bug] ResultSet#getMetaData() returns null
Date
Msg-id 3ECBA4CF.9060008@xythos.com
Whole thread Raw
In response to [Bug] ResultSet#getMetaData() returns null  (Doug Kearns <djkea2@mugca.its.monash.edu.au>)
Responses Re: [Bug] ResultSet#getMetaData() returns null  (Barry Lind <blind@xythos.com>)
List pgsql-jdbc
Nic,

Could you look into this bug?  (Let me know either way).  The problem is
  specific to RefCursorResultSets.  And since you submitted this code,
it might be easier for you to think of a solution here, even if you
don't code it.  The problem is that the current logic in
JdbcXRefCursorResultSet doesn't initialize the ResultSet until next() is
called.  However the logic in getMetaData() is assuming that the
ResultSet is already initialized and passes the data and Field[] over.
I am not really sure how this should work now that RefCursorResultSets
are in the picture.  Thus I would like your input.

thanks,
--Barry

PS.  This probably should be added as a test case as well.


Doug Kearns wrote:
> Hello all,
>
> ResultSet#getMetaData() is returning null, using the current CVS driver,
> if called before ResultSet#next()
>
> <snippet>
>         db.setAutoCommit(false);
>
>         CallableStatement st = db.prepareCall( "{ ? = call doit () }" );
>         st.registerOutParameter(1, Types.OTHER);
>
>         st.execute();
>         ResultSet rs = (ResultSet) st.getObject(1);
>
>         ResultSetMetaData md = rs.getMetaData();
>         System.out.println( "Column count = " + md.getColumnCount() );
>     //Exception in thread "main" java.lang.NullPointerException
>     //at org.postgresql.jdbc2.AbstractJdbc2ResultSetMetaData.getColumnCount(AbstractJdbc2ResultSetMetaData.java:33)
>     //at JDBCTest.main(JDBCTest.java:16)
>
>         rs.next();
> </snippet>
>
> Regards,
> Doug
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>




pgsql-jdbc by date:

Previous
From: Fernando Nasser
Date:
Subject: JDBC: Wrong type
Next
From: Andrew Sullivan
Date:
Subject: Re: Connections performance is reduced