-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#788 Fix executeBatch() of statement without parameters throws isc_ba…
…tch_param
- Loading branch information
1 parent
70f27d1
commit 1ecccac
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,8 +58,10 @@ | |
import static org.junit.jupiter.api.Assumptions.assumeTrue; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Roman Rokytskyy</a> | ||
* @author <a href="mailto:[email protected]">Mark Rotteveel</a> | ||
* Tests for {@link FBPreparedStatement}. | ||
* | ||
* @author Roman Rokytskyy | ||
* @author Mark Rotteveel | ||
*/ | ||
class FBPreparedStatementTest { | ||
|
||
|
@@ -1430,6 +1432,28 @@ void preparedStatementExecuteProcedureShouldNotTrim_729() throws Exception { | |
} | ||
} | ||
|
||
/** | ||
* Test for <a href="https://github.com/FirebirdSQL/jaybird/issues/788">jaybird#788</a> | ||
*/ | ||
@ParameterizedTest(name = "[{index}] useServerBatch = {0}") | ||
@ValueSource(booleans = { true, false }) | ||
void executeBatchWithoutParameters(boolean useServerBatch) throws Exception { | ||
executeCreateTable(con, CREATE_TABLE); | ||
|
||
Properties props = FBTestProperties.getDefaultPropertiesForConnection(); | ||
props.setProperty(PropertyNames.useServerBatch, String.valueOf(useServerBatch)); | ||
try (Connection con = DriverManager.getConnection(FBTestProperties.getUrl(), props); | ||
PreparedStatement pstmt = con.prepareStatement("insert into test default values")) { | ||
pstmt.addBatch(); | ||
assertDoesNotThrow(pstmt::executeBatch); | ||
} | ||
try (Statement stmt = con.createStatement(); | ||
ResultSet rs = stmt.executeQuery("select count(*) from test")) { | ||
assertTrue(rs.next(), "expected a row"); | ||
assertEquals(1, rs.getInt(1), "Expected one row in table test"); | ||
} | ||
} | ||
|
||
private void prepareTestData() throws SQLException { | ||
con.setAutoCommit(false); | ||
try (PreparedStatement pstmt = con.prepareStatement(INSERT_DATA)) { | ||
|