Change SQL log to include executeBatch() via BatchedPstmt

This commit is contained in:
Rob Bygrave
2023-10-10 00:59:06 +13:00
parent 32188bdd54
commit ac6473e039
@@ -84,6 +84,9 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
*/
private void flushStatementBatch() throws SQLException {
final int[] rows = pstmt.executeBatch();
if (transaction.isLogSql()) {
transaction.logSql(" -- executeBatch() size:{0} sql:{1}", rows.length, sql);
}
if (rows.length != list.size()) {
throw new IllegalStateException("Invalid state on executeBatch, rows:" + rows.length + " != " + list.size());
}
@@ -153,6 +156,9 @@ public final class BatchedPstmt implements SpiProfileTransactionEvent {
private void executeAndCheckRowCounts() throws SQLException {
try {
results = pstmt.executeBatch();
if (transaction.isLogSql()) {
transaction.logSql(" -- executeBatch() size:{0} sql:{1}", results.length, sql);
}
if (results.length != list.size()) {
throw new SQLException("Invalid state on executeBatch, rows:" + results.length + " != " + list.size());
}