From 7ddcd9eea4cd4379cb84638b0a68776165f103dc Mon Sep 17 00:00:00 2001 From: rusher Date: Wed, 2 Aug 2023 09:14:09 +0200 Subject: [PATCH] [misc] correct batch for mysql server --- src/main/java/org/mariadb/jdbc/ClientPreparedStatement.java | 3 ++- src/test/java/org/mariadb/jdbc/integration/BatchTest.java | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/ClientPreparedStatement.java b/src/main/java/org/mariadb/jdbc/ClientPreparedStatement.java index ad8197a1e..cdbd0b713 100644 --- a/src/main/java/org/mariadb/jdbc/ClientPreparedStatement.java +++ b/src/main/java/org/mariadb/jdbc/ClientPreparedStatement.java @@ -108,7 +108,8 @@ private boolean executeInternalPreparedBatch() throws SQLException { checkNotClosed(); checkIfInsertCommand(); Configuration conf = con.getContext().getConf(); - if (((isCommandInsert && (conf.useBulkStmts() || conf.useBulkStmtsForInserts())) + if (con.getContext().hasServerCapability(STMT_BULK_OPERATIONS) + && ((isCommandInsert && (conf.useBulkStmts() || conf.useBulkStmtsForInserts())) || (!isCommandInsert && conf.useBulkStmts())) && batchParameters.size() > 1 && autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS) { diff --git a/src/test/java/org/mariadb/jdbc/integration/BatchTest.java b/src/test/java/org/mariadb/jdbc/integration/BatchTest.java index a507c2c9e..57327e9df 100644 --- a/src/test/java/org/mariadb/jdbc/integration/BatchTest.java +++ b/src/test/java/org/mariadb/jdbc/integration/BatchTest.java @@ -289,7 +289,6 @@ public void largeBatch() throws SQLException { useCompression, useBulkStmtsForInserts); try (Connection con = createCon(confString)) { - System.out.println("########################################" + confString); largeBatch(con); } }