Re: [Bug] ResultSet#getMetaData() returns null
От | Barry Lind |
---|---|
Тема | Re: [Bug] ResultSet#getMetaData() returns null |
Дата | |
Msg-id | 3ECD05DD.3080309@xythos.com обсуждение исходный текст |
Ответ на | Re: [Bug] ResultSet#getMetaData() returns null (Barry Lind <blind@xythos.com>) |
Список | pgsql-jdbc |
Nic, In looking at this some more, I don't think this will be as difficult as I had feared. I discovered that ResultSetMetaData doesn't even use the data that is passed to it, all it needs is the Field[] information. So then it just boils down to the following question: Is the delayed initialization of the RefCursorResultSet necessary? If so, I would like to understand why it is necessary (some comments in the code would probably be a good thing either way). This could be fixed in two ways: 1) by removing the delayed initialization altogether, or 2) by adding the initialization check into the other methods (like getMetaData()) that can be called before next(). thanks, --Barry Barry Lind wrote: > 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 >> > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
В списке pgsql-jdbc по дате отправления: