Skip to content

Commit 7ad95bc

Browse files
committed
Test case for Bug#104349 (33563548).
1 parent 3feaf2c commit 7ad95bc

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Version 8.0.29
2323

2424
- Fix for Bug#105915 (33678490), Connector/J 8 server prepared statement precision loss in execute batch.
2525

26+
- Fix for Bug#104349 (33563548), com.mysql.cj NPE.
27+
2628
- WL#14750, Better unification of query bindings.
2729

2830
- WL#14834, Support for FIDO authentication.

src/test/java/testsuite/regression/StatementRegressionTest.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12041,4 +12041,53 @@ public void testBug85317() throws Exception {
1204112041
} while ((useSPS = !useSPS) || (rewriteBS = !rewriteBS));
1204212042

1204312043
}
12044+
12045+
/**
12046+
* Tests fix for Bug#104349 (33563548), com.mysql.cj NPE.
12047+
*
12048+
* @throws Exception
12049+
*/
12050+
@Test
12051+
public void testBug104349() throws Exception {
12052+
createTable("testBug104349", "(col1 INT, col2 VARCHAR(100))");
12053+
12054+
this.stmt.executeUpdate("INSERT INTO testBug104349 VALUES (1, 'key 1')");
12055+
this.stmt.executeUpdate("INSERT INTO testBug104349 VALUES (2, 'key 2')");
12056+
this.stmt.executeUpdate("INSERT INTO testBug104349 VALUES (3, 'key 3')");
12057+
12058+
Properties props = new Properties();
12059+
props.setProperty(PropertyKey.useSSL.getKeyName(), "false");
12060+
props.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
12061+
props.setProperty(PropertyKey.cachePrepStmts.getKeyName(), "true");
12062+
12063+
boolean useSPS = false;
12064+
do {
12065+
props.setProperty(PropertyKey.useServerPrepStmts.getKeyName(), "" + useSPS);
12066+
Connection testConn = getConnectionWithProps(props);
12067+
12068+
PreparedStatement ps = testConn.prepareStatement("SELECT * FROM testBug104349 WHERE col1 = ?");
12069+
assertTrue(ps.toString().endsWith("SELECT * FROM testBug104349 WHERE col1 = ** NOT SPECIFIED **"));
12070+
ps.setInt(1, 1);
12071+
assertTrue(ps.toString().endsWith("SELECT * FROM testBug104349 WHERE col1 = 1"));
12072+
this.rs = ps.executeQuery();
12073+
assertTrue(ps.toString().endsWith("SELECT * FROM testBug104349 WHERE col1 = 1"));
12074+
while (this.rs.next()) {
12075+
assertEquals(1, this.rs.getInt(1));
12076+
assertEquals("key 1", this.rs.getString(2));
12077+
}
12078+
ps.close();
12079+
ps = testConn.prepareStatement("SELECT * FROM testBug104349 WHERE col1 = ?");
12080+
assertTrue(ps.toString().endsWith("SELECT * FROM testBug104349 WHERE col1 = ** NOT SPECIFIED **"));
12081+
ps.setInt(1, 2);
12082+
assertTrue(ps.toString().endsWith("SELECT * FROM testBug104349 WHERE col1 = 2"));
12083+
this.rs = ps.executeQuery();
12084+
assertTrue(ps.toString().endsWith("SELECT * FROM testBug104349 WHERE col1 = 2"));
12085+
while (this.rs.next()) {
12086+
assertEquals(2, this.rs.getInt(1));
12087+
assertEquals("key 2", this.rs.getString(2));
12088+
}
12089+
testConn.close();
12090+
12091+
} while (useSPS = !useSPS);
12092+
}
1204412093
}

0 commit comments

Comments
 (0)