|
[Jython-bugs] [issue1741] com.ziclix.python.sql.DataHandler calls
wasNull without previously calling get [patch]
From: Stephen White <report@bu...> - 2011-04-23 23:28
|
New submission from Stephen White <stephen-jython@...>: 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. ---------- components: zxjdbc files: zxjdbc-wasnull.patch keywords: patch messages: 6513 nosy: swhite severity: normal status: open title: com.ziclix.python.sql.DataHandler calls wasNull without previously calling get [patch] versions: 2.5.2rc Added file: http://bugs.jython.org/file964/zxjdbc-wasnull.patch _______________________________________ Jython tracker <report@...> <http://bugs.jython.org/issue1741> _______________________________________ |