Re: [Bug] ResultSet#getMetaData() returns null

From: Barry Lind <blind(at)xythos(dot)com>
To: Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk>
Cc: Doug Kearns <djkea2(at)mugca(dot)its(dot)monash(dot)edu(dot)au>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [Bug] ResultSet#getMetaData() returns null
Date: 2003-05-21 16:09:51
Message-ID: 3ECBA4CF.9060008@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Fernando Nasser 2003-05-21 16:35:39 JDBC: Wrong type
Previous Message Agrawal, Manish 2003-05-21 14:59:12 Re: setting postgres for java