Skip to content

Commit

Permalink
[CONJ-1128] test addition: Setting Negative Fetch Size on ResultSet r…
Browse files Browse the repository at this point in the history
…esults throwing Error
  • Loading branch information
rusher committed Nov 22, 2023
1 parent fb673c2 commit 7b8db20
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/java/org/mariadb/jdbc/integration/StatementTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,25 @@ public void getGeneratedKeysType() throws SQLException {
}
}

@Test
public void testNegativeFetchSize() throws SQLException {
try (Statement stmt = sharedConn.createStatement()) {
stmt.execute("DROP TABLE IF EXISTS testNegativeFetchSize");
stmt.execute(
"CREATE TABLE testNegativeFetchSize(id INT PRIMARY KEY AUTO_INCREMENT,value FLOAT)");
stmt.addBatch("INSERT INTO testNegativeFetchSize (value) VALUES(0.05)");
stmt.addBatch("DELETE FROM testNegativeFetchSize WHERE id <= 2");
stmt.addBatch("INSERT INTO testNegativeFetchSize (value) VALUES(0.03)");
stmt.executeBatch();
try (ResultSet rs = stmt.getGeneratedKeys()) {
assertThrowsContains(
SQLSyntaxErrorException.class,
() -> rs.setFetchSize(-2),
"invalid fetch size -2");
}
}
}

@Test
public void largeMaxRows() throws SQLException {
Statement stmt = sharedConn.createStatement();
Expand Down

0 comments on commit 7b8db20

Please sign in to comment.