Skip to content

Commit

Permalink
Fix for Bug#102131 (32338451), UPDATABLERESULTSET NPE WHEN USING DERIVED
Browse files Browse the repository at this point in the history
QUERIES OR VIEWS.
  • Loading branch information
soklakov committed Feb 17, 2021
1 parent 52479cc commit 3a8e187
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

Version 8.0.24

- Fix for Bug#102131 (32338451), UPDATABLERESULTSET NPE WHEN USING DERIVED QUERIES OR VIEWS.

- Fix for Bug#101596 (32151143), GET THE 'HOST' PROPERTY ERROR AFTER CALLING TRANSFORMPROPERTIES() METHOD.

- Fix for Bug#20391832, SETOBJECT() FOR TYPES.TIME RESULTS IN EXCEPTION WHEN VALUE HAS FRACTIONAL PART.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void checkUpdatability() throws SQLException {
}

// Can't reference more than one database
if ((dbName == null) || !otherDbName.equals(dbName)) {
if ((dbName == null) || !dbName.equals(otherDbName)) {
this.isUpdatable = false;
this.notUpdatableReason = Messages.getString("NotUpdatableReason.1");

Expand Down
23 changes: 23 additions & 0 deletions src/test/java/testsuite/regression/ResultSetRegressionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7802,4 +7802,27 @@ public void testBug102321() throws Exception {
"Wrong ResultSetMetaData metadata for column type " + rsm.getColumnTypeName(colnum));
}
}

/**
* Tests fix for Bug#102131 (32338451), UPDATABLERESULTSET NPE WHEN USING DERIVED QUERIES OR VIEWS.
*
* @throws Exception
* if the test fails
*/
@Test
public void testBug102131() throws Exception {
createTable("testBug102131User", "(id int,name varchar(10))");
createTable("testBug102131Age", "(id int,age int)");
createView("testBug102131View",
"as select name,ifnull(age,0) age from testBug102131User inner join testBug102131Age on testBug102131User.id = testBug102131Age.id");

this.stmt.executeUpdate("INSERT INTO testBug102131User VALUES (1, 'a')");
this.stmt.executeUpdate("INSERT INTO testBug102131Age VALUES (1, 20)");

Statement st1 = this.conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
this.rs = st1.executeQuery("select * from testBug102131View");
assertTrue(this.rs.next());
assertEquals("a", this.rs.getString("name"));
assertEquals(20, this.rs.getInt("age"));
}
}

0 comments on commit 3a8e187

Please sign in to comment.