You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2022/07/03 08:52:50 UTC

[incubator-shenyu] branch master updated: Refactor oracle replace insert into (#3656)

This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 005a041d2 Refactor oracle replace insert into (#3656)
005a041d2 is described below

commit 005a041d2c81e2657225cbae4ac269672400ebab
Author: renzhuyan <40...@qq.com>
AuthorDate: Sun Jul 3 16:52:42 2022 +0800

    Refactor oracle replace insert into (#3656)
---
 .../shenyu/admin/mybatis/oracle/OracleSQLPrepareInterceptor.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/mybatis/oracle/OracleSQLPrepareInterceptor.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/mybatis/oracle/OracleSQLPrepareInterceptor.java
index 786c858fa..461171aaf 100644
--- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/mybatis/oracle/OracleSQLPrepareInterceptor.java
+++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/mybatis/oracle/OracleSQLPrepareInterceptor.java
@@ -71,8 +71,8 @@ public class OracleSQLPrepareInterceptor implements Interceptor {
                     .replace("from resource", "from \"resource\"")
                     .replace("update resource", "update \"resource\"");
         }
-        // replace insert into
-        if (replaceSql.contains("insert into") && !replaceSql.contains("insert into operation_record_log")) {
+        // replace batch insert into
+        if (replaceSql.contains("insert into") && replaceSql.split("\\(").length > 3) {
             replaceSql = replaceSql.replaceAll("\r|\n|\\s", "")
                     .replace("insertinto", "insert into ")
                     .replace("values", " SELECT * FROM (")
@@ -80,6 +80,7 @@ public class OracleSQLPrepareInterceptor implements Interceptor {
                     .replace("),", " FROM dual UNION ALL")
                     .replace("?)", " ? FROM dual)");
         }
+
         // replace limit 1
         if (replaceSql.contains("select")) {
             if (replaceSql.contains("where")) {