rkonoval committed 975459c

#81: The method getObject in RS class processes null value incorrectly

RS.wasNull() returns incorrect values or sometimes exception is thrown (index out of range) after getObject()
getObject doesn't remember last accessed column if value in column is null
remember last accessed column in getObject

Comments (0)

Files changed (2)


      * @see java.sql.ResultSet#getObject(int)
     public Object getObject(int col) throws SQLException {
-        switch (db.column_type(stmt.pointer, checkCol(col))) {
+        switch (db.column_type(stmt.pointer, markCol(col))) {
         case SQLITE_INTEGER:
             long val = getLong(col);
             if (val > Integer.MAX_VALUE || val < Integer.MIN_VALUE) {


+    public void nullsForGetObject() throws SQLException {
+        ResultSet rs = stat.executeQuery("select 1, null union all select null, null;");
+        assertTrue(;
+        assertNotNull(rs.getString(1));
+        assertFalse(rs.wasNull());
+        assertNull(rs.getObject(2));
+        assertTrue(rs.wasNull());
+        assertTrue(;
+        assertNull(rs.getObject(2));
+        assertTrue(rs.wasNull());
+        assertNull(rs.getObject(1));
+        assertTrue(rs.wasNull());
+        assertFalse(;
+        rs.close();
+    }
+    @Test
     public void tempTable() throws SQLException {
         assertEquals(stat.executeUpdate("create temp table myTemp (a);"), 0);
         assertEquals(stat.executeUpdate("insert into myTemp values (2);"), 1);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.