Skip to content

Commit

Permalink
Updated regression test case for JSON datatype: mix of addBatch, exec…
Browse files Browse the repository at this point in the history
…uteUpdate
  • Loading branch information
Divang Sharma committed Feb 20, 2025
1 parent b67553e commit 22b230f
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,27 +255,23 @@ public void testJsonQuery() throws SQLException {
int pkRow2 = 2;
int pkRow3 = 3;
String sql = "insert into " + AbstractSQLGenerator.escapeIdentifier(tableName) + " values (?, ?,?)";
try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) connection.prepareStatement(sql)) {
try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) connection.prepareStatement(sql)) {
pstmt.setInt(1, pkRow1);
pstmt.setObject(2, "{\"key11\":\"value11\"}");
pstmt.setObject(3, "{\"key12\":\"value12\"}");
pstmt.executeUpdate();
}
pstmt.addBatch();

sql = "insert into " + AbstractSQLGenerator.escapeIdentifier(tableName) + " values (?, ?,?)";
try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) connection.prepareStatement(sql)) {
pstmt.setInt(1, pkRow2);
pstmt.setObject(2, "{\"key21\":\"value21\"}");
pstmt.setObject(3, "{\"key22\":\"value22\"}");
pstmt.executeUpdate();
}
pstmt.addBatch();

sql = "insert into " + AbstractSQLGenerator.escapeIdentifier(tableName) + " values (?, ?,?)";
try (SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) connection.prepareStatement(sql)) {
pstmt.setInt(1, pkRow3);
pstmt.setObject(2, "{\"key31\":\"value31\"}");
pstmt.setObject(3, "{\"key32\":\"value32\"}");
pstmt.executeUpdate();
pstmt.addBatch();

pstmt.executeBatch();
}

sql = "DELETE " + AbstractSQLGenerator.escapeIdentifier(tableName) + " where [c1] = ?";
Expand Down

0 comments on commit 22b230f

Please sign in to comment.