Author swhite
Recipients swhite
Date 2011-04-23.23:28:04
SpamBayes Score 5.60052e-13
Marked as misclassified No
Message-id <>
If the column type in the ResultSet is reported as NULL then the DataHandler code doesn't bother trying to call any of the get methods, as the value must be NULL.  Unfortunately it does then call wasNull().  This is invalid (see the Note in the Javadocs for java.sql.ResultSet), you can only use wasNull if you've previously called a get method.

There are several easy fixes to this.  One would be to call a get method, even though we know what the returned value will be.  I've implemented an alternative, that bypasses the problematic wasNull check by returning from the middle of the switch statement.  Another approach would be to put a guard around the 'wasNull' call below the switch statement, avoiding calling it if the value is already null or Py.None.

This issue causes real problems when using the org.sqlite.JDBC driver (both the zentus and xerial implementations seems to cause problems).  The patch includes a test that shows the problematic case, though I can only get it to fail with sqlite and not with other databases.  I had to add sqlite to test.xml to run the test, and sqlite doesn't pass all the other tests.
Date User Action Args
2011-04-23 23:28:05swhitesetrecipients: + swhite
2011-04-23 23:28:05swhitesetmessageid: <>
2011-04-23 23:28:05swhitelinkissue1741 messages
2011-04-23 23:28:05swhitecreate