From bba77aff3ca7ab38f84536afffdca8db040212ba Mon Sep 17 00:00:00 2001 From: xhan Date: Wed, 8 Jul 2015 17:24:28 +0800 Subject: [PATCH] Update PreparedStatement.java rewrite replace sql like insert when rewriteBatchedStatements=true --- src/com/mysql/jdbc/PreparedStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/mysql/jdbc/PreparedStatement.java b/src/com/mysql/jdbc/PreparedStatement.java index 5aee1e0..4c7656a 100644 --- a/src/com/mysql/jdbc/PreparedStatement.java +++ b/src/com/mysql/jdbc/PreparedStatement.java @@ -5131,7 +5131,7 @@ protected static boolean canRewrite(String sql, boolean isOnDuplicateKeyUpdate, } } - return StringUtils.startsWithIgnoreCaseAndWs(sql, "INSERT", statementStartPos) + return (StringUtils.startsWithIgnoreCaseAndWs(sql, "INSERT", statementStartPos) || StringUtils.startsWithIgnoreCaseAndWs(sql, "REPLACE", statementStartPos)) && StringUtils.indexOfIgnoreCase(statementStartPos, sql, "SELECT", ""'`", ""'`", StringUtils.SEARCH_MODE__MRK_COM_WS) == -1 && rewritableOdku; } }