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/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c16c7e  Ignore sql syntax exception for diff SQL dialect with 
database gateway (#8760)
4c16c7e is described below

commit 4c16c7e332698010e553ef10186e4354bffd80f3
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Dec 24 20:05:53 2020 +0800

    Ignore sql syntax exception for diff SQL dialect with database gateway 
(#8760)
---
 .../execute/engine/driver/jdbc/JDBCExecutorCallback.java    |  9 +++++++--
 .../sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java   |  5 +++++
 .../executor/batch/BatchPreparedStatementExecutor.java      |  5 +++++
 .../driver/executor/callback/ExecuteQueryCallback.java      |  6 ++++++
 .../core/statement/ShardingSpherePreparedStatement.java     | 11 +++++++++++
 .../driver/jdbc/core/statement/ShardingSphereStatement.java | 11 +++++++++++
 .../proxy/backend/communication/ProxySQLExecutor.java       |  2 +-
 .../communication/jdbc/executor/ProxyJDBCExecutor.java      |  8 +++++---
 .../jdbc/executor/callback/ProxyJDBCExecutorCallback.java   | 13 ++++++++++++-
 .../executor/callback/ProxyJDBCExecutorCallbackFactory.java |  8 +++++---
 .../impl/ProxyPreparedStatementExecutorCallback.java        |  5 +++--
 .../callback/impl/ProxyStatementExecutorCallback.java       |  5 +++--
 12 files changed, 74 insertions(+), 14 deletions(-)

diff --git 
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
 
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
index a8625ad..b6bd7a8 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
@@ -53,7 +53,10 @@ public abstract class JDBCExecutorCallback<T> implements 
ExecutorCallback<JDBCEx
     public final Collection<T> execute(final Collection<JDBCExecutionUnit> 
executionUnits, final boolean isTrunkThread, final Map<String, Object> dataMap) 
throws SQLException {
         Collection<T> result = new LinkedList<>();
         for (JDBCExecutionUnit each : executionUnits) {
-            result.add(execute(each, isTrunkThread, dataMap));
+            T executeResult = execute(each, isTrunkThread, dataMap);
+            if (null != executeResult) {
+                result.add(executeResult);
+            }
         }
         return result;
     }
@@ -77,7 +80,7 @@ public abstract class JDBCExecutorCallback<T> implements 
ExecutorCallback<JDBCEx
         } catch (final SQLException ex) {
             sqlExecutionHook.finishFailure(ex);
             SQLExecutorExceptionHandler.handleException(ex);
-            return null;
+            return isTrunkThread ? getSaneResult(jdbcExecutionUnit) : null;
         }
     }
     
@@ -92,4 +95,6 @@ public abstract class JDBCExecutorCallback<T> implements 
ExecutorCallback<JDBCEx
     }
     
     protected abstract T executeSQL(String sql, Statement statement, 
ConnectionMode connectionMode) throws SQLException;
+    
+    protected abstract T getSaneResult(JDBCExecutionUnit jdbcExecutionUnit) 
throws SQLException;
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
 
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
index 68cefa3..178c7ec 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/JDBCExecutorCallbackTest.java
@@ -76,6 +76,11 @@ public final class JDBCExecutorCallbackTest {
             protected Integer executeSQL(final String sql, final Statement 
statement, final ConnectionMode connectionMode) throws SQLException {
                 return ((PreparedStatement) statement).executeUpdate();
             }
+            
+            @Override
+            protected Integer getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) {
+                return 0;
+            }
         };
         Field field = 
JDBCExecutorCallback.class.getDeclaredField("CACHED_DATASOURCE_METADATA");
         field.setAccessible(true);
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutor.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutor.java
index dcfa317..477aff4 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutor.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/batch/BatchPreparedStatementExecutor.java
@@ -124,6 +124,11 @@ public final class BatchPreparedStatementExecutor {
             protected int[] executeSQL(final String sql, final Statement 
statement, final ConnectionMode connectionMode) throws SQLException {
                 return statement.executeBatch();
             }
+            
+            @Override
+            protected int[] getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) {
+                return new int[batchCount];
+            }
         };
         List<int[]> results = jdbcExecutor.execute(executionGroups, callback);
         return isNeedAccumulate(
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
index d6e33b6..f03cdf1 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.driver.executor.callback;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
+import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.memory.JDBCMemoryQueryResult;
@@ -43,5 +44,10 @@ public abstract class ExecuteQueryCallback extends 
JDBCExecutorCallback<QueryRes
         return ConnectionMode.MEMORY_STRICTLY == connectionMode ? new 
JDBCStreamQueryResult(resultSet) : new JDBCMemoryQueryResult(resultSet);
     }
     
+    @Override
+    protected final QueryResult getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) throws SQLException {
+        return new 
JDBCMemoryQueryResult(jdbcExecutionUnit.getStorageResource().executeQuery("SELECT
 1"));
+    }
+    
     protected abstract ResultSet executeQuery(String sql, Statement statement) 
throws SQLException;
 }
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
index d8b29cd..911c890 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java
@@ -67,6 +67,7 @@ import 
org.apache.shardingsphere.infra.rule.type.DataNodeContainedRule;
 import org.apache.shardingsphere.infra.rule.type.RawExecutionRule;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 
 import java.sql.Connection;
 import java.sql.ParameterMetaData;
@@ -217,6 +218,11 @@ public final class ShardingSpherePreparedStatement extends 
AbstractPreparedState
             protected Integer executeSQL(final String sql, final Statement 
statement, final ConnectionMode connectionMode) throws SQLException {
                 return ((PreparedStatement) statement).executeUpdate();
             }
+            
+            @Override
+            protected Integer getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) {
+                return 0;
+            }
         };
     }
     
@@ -260,6 +266,11 @@ public final class ShardingSpherePreparedStatement extends 
AbstractPreparedState
             protected Boolean executeSQL(final String sql, final Statement 
statement, final ConnectionMode connectionMode) throws SQLException {
                 return ((PreparedStatement) statement).execute();
             }
+            
+            @Override
+            protected Boolean getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) {
+                return sqlStatement instanceof SelectStatement;
+            }
         };
     }
     
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java
index 7267d05..940737e 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java
@@ -67,6 +67,7 @@ import 
org.apache.shardingsphere.infra.rule.type.DataNodeContainedRule;
 import org.apache.shardingsphere.infra.rule.type.RawExecutionRule;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -233,6 +234,11 @@ public final class ShardingSphereStatement extends 
AbstractStatementAdapter {
             protected Integer executeSQL(final String sql, final Statement 
statement, final ConnectionMode connectionMode) throws SQLException {
                 return updater.executeUpdate(sql, statement);
             }
+            
+            @Override
+            protected Integer getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) {
+                return 0;
+            }
         };
         return driverJDBCExecutor.executeUpdate(executionGroups, 
sqlStatementContext, routeUnits, callback);
     }
@@ -331,6 +337,11 @@ public final class ShardingSphereStatement extends 
AbstractStatementAdapter {
             protected Boolean executeSQL(final String sql, final Statement 
statement, final ConnectionMode connectionMode) throws SQLException {
                 return executor.execute(sql, statement);
             }
+
+            @Override
+            protected Boolean getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) {
+                return sqlStatement instanceof SelectStatement;
+            }
         };
         return driverJDBCExecutor.execute(executionGroups, sqlStatement, 
routeUnits, jdbcExecutorCallback);
     }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
index 61b23ef..59b91fb 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
@@ -114,6 +114,6 @@ public final class ProxySQLExecutor {
         DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> 
prepareEngine = new DriverExecutionPrepareEngine<>(
                 type, maxConnectionsSizePerQuery, backendConnection, new 
StatementOption(isReturnGeneratedKeys), rules);
         Collection<ExecutionGroup<JDBCExecutionUnit>> executionGroups = 
prepareEngine.prepare(executionContext.getRouteContext(), 
executionContext.getExecutionUnits());
-        return jdbcExecutor.execute(executionGroups, isExceptionThrown, 
isReturnGeneratedKeys);
+        return 
jdbcExecutor.execute(executionContext.getSqlStatementContext().getSqlStatement(),
 executionGroups, isExceptionThrown, isReturnGeneratedKeys);
     }
 }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/ProxyJDBCExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/ProxyJDBCExecutor.java
index 077b84c..4e8526a 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/ProxyJDBCExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/ProxyJDBCExecutor.java
@@ -26,6 +26,7 @@ import 
org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallbackFactory;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 import java.sql.SQLException;
 import java.util.Collection;
@@ -45,17 +46,18 @@ public final class ProxyJDBCExecutor {
     /**
      * Execute.
      * 
+     * @param sqlStatement SQL statement
      * @param executionGroups execution groups
      * @param isReturnGeneratedKeys is return generated keys
      * @param isExceptionThrown is exception thrown
      * @return execute results
      * @throws SQLException SQL exception
      */
-    public Collection<ExecuteResult> execute(final 
Collection<ExecutionGroup<JDBCExecutionUnit>> executionGroups, 
+    public Collection<ExecuteResult> execute(final SQLStatement sqlStatement, 
final Collection<ExecutionGroup<JDBCExecutionUnit>> executionGroups, 
                                              final boolean 
isReturnGeneratedKeys, final boolean isExceptionThrown) throws SQLException {
         DatabaseType databaseType = 
ProxyContext.getInstance().getMetaDataContexts().getMetaData(backendConnection.getSchemaName()).getResource().getDatabaseType();
         return jdbcExecutor.execute(executionGroups,
-                ProxyJDBCExecutorCallbackFactory.newInstance(type, 
databaseType, backendConnection, isExceptionThrown, isReturnGeneratedKeys, 
true),
-                ProxyJDBCExecutorCallbackFactory.newInstance(type, 
databaseType, backendConnection, isExceptionThrown, isReturnGeneratedKeys, 
false));
+                ProxyJDBCExecutorCallbackFactory.newInstance(type, 
databaseType, sqlStatement, backendConnection, isExceptionThrown, 
isReturnGeneratedKeys, true),
+                ProxyJDBCExecutorCallbackFactory.newInstance(type, 
databaseType, sqlStatement, backendConnection, isExceptionThrown, 
isReturnGeneratedKeys, false));
     }
 }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
index 5858747..d9136a4 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallback.java
@@ -19,6 +19,7 @@ package 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.call
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
+import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
@@ -26,6 +27,8 @@ import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.dr
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream.JDBCStreamQueryResult;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.update.UpdateResult;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -36,6 +39,8 @@ import java.sql.Statement;
  */
 public abstract class ProxyJDBCExecutorCallback extends 
JDBCExecutorCallback<ExecuteResult> {
     
+    private final SQLStatement sqlStatement;
+    
     private final BackendConnection backendConnection;
     
     private final boolean isReturnGeneratedKeys;
@@ -44,9 +49,10 @@ public abstract class ProxyJDBCExecutorCallback extends 
JDBCExecutorCallback<Exe
     
     private boolean hasMetaData;
     
-    public ProxyJDBCExecutorCallback(final DatabaseType databaseType, final 
BackendConnection backendConnection,
+    public ProxyJDBCExecutorCallback(final DatabaseType databaseType, final 
SQLStatement sqlStatement, final BackendConnection backendConnection,
                                      final boolean isExceptionThrown, final 
boolean isReturnGeneratedKeys, final boolean fetchMetaData) {
         super(databaseType, isExceptionThrown);
+        this.sqlStatement = sqlStatement;
         this.backendConnection = backendConnection;
         this.isReturnGeneratedKeys = isReturnGeneratedKeys;
         this.fetchMetaData = fetchMetaData;
@@ -81,4 +87,9 @@ public abstract class ProxyJDBCExecutorCallback extends 
JDBCExecutorCallback<Exe
         ResultSet resultSet = statement.getGeneratedKeys();
         return resultSet.next() ? resultSet.getLong(1) : 0L;
     }
+    
+    @Override
+    protected ExecuteResult getSaneResult(final JDBCExecutionUnit 
jdbcExecutionUnit) throws SQLException {
+        return sqlStatement instanceof SelectStatement ? new 
JDBCMemoryQueryResult(jdbcExecutionUnit.getStorageResource().executeQuery("SELECT
 1")) : new UpdateResult(0, 0);
+    }
 }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
index e1bf7b5..da6d7c7 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
@@ -24,6 +24,7 @@ import 
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriv
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.impl.ProxyPreparedStatementExecutorCallback;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.impl.ProxyStatementExecutorCallback;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 /**
  * Proxy JDBC executor callback factory.
@@ -36,19 +37,20 @@ public final class ProxyJDBCExecutorCallbackFactory {
      * 
      * @param type driver type
      * @param databaseType database type
+     * @param sqlStatement SQL statement
      * @param backendConnection backend connection
      * @param isExceptionThrown is exception thrown or not
      * @param isReturnGeneratedKeys is return generated keys or not
      * @param isFetchMetaData is fetch meta data or not
      * @return instance of Proxy JDBC executor callback
      */
-    public static ProxyJDBCExecutorCallback newInstance(final String type, 
final DatabaseType databaseType, final BackendConnection backendConnection,
+    public static ProxyJDBCExecutorCallback newInstance(final String type, 
final DatabaseType databaseType, final SQLStatement sqlStatement, final 
BackendConnection backendConnection,
                                                         final boolean 
isExceptionThrown, final boolean isReturnGeneratedKeys, final boolean 
isFetchMetaData) {
         if (JDBCDriverType.STATEMENT.equals(type)) {
-            return new ProxyStatementExecutorCallback(databaseType, 
backendConnection, isExceptionThrown, isReturnGeneratedKeys, isFetchMetaData);
+            return new ProxyStatementExecutorCallback(databaseType, 
sqlStatement, backendConnection, isExceptionThrown, isReturnGeneratedKeys, 
isFetchMetaData);
         }
         if (JDBCDriverType.PREPARED_STATEMENT.equals(type)) {
-            return new ProxyPreparedStatementExecutorCallback(databaseType, 
backendConnection, isExceptionThrown, isReturnGeneratedKeys, isFetchMetaData);
+            return new ProxyPreparedStatementExecutorCallback(databaseType, 
sqlStatement, backendConnection, isExceptionThrown, isReturnGeneratedKeys, 
isFetchMetaData);
         }
         throw new UnsupportedOperationException(String.format("Unsupported 
driver type: `%s`", type));
     }
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyPreparedStatementExecutorCallback.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyPreparedStatementExecutorCallback.java
index 3e92af5..c118b8c 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyPreparedStatementExecutorCallback.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyPreparedStatementExecutorCallback.java
@@ -20,6 +20,7 @@ package 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.call
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
@@ -30,9 +31,9 @@ import java.sql.Statement;
  */
 public final class ProxyPreparedStatementExecutorCallback extends 
ProxyJDBCExecutorCallback {
     
-    public ProxyPreparedStatementExecutorCallback(final DatabaseType 
databaseType, final BackendConnection backendConnection,
+    public ProxyPreparedStatementExecutorCallback(final DatabaseType 
databaseType, final SQLStatement sqlStatement, final BackendConnection 
backendConnection,
                                                   final boolean 
isExceptionThrown, final boolean isReturnGeneratedKeys, final boolean 
fetchMetaData) {
-        super(databaseType, backendConnection, isExceptionThrown, 
isReturnGeneratedKeys, fetchMetaData);
+        super(databaseType, sqlStatement, backendConnection, 
isExceptionThrown, isReturnGeneratedKeys, fetchMetaData);
     }
     
     @Override
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyStatementExecutorCallback.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyStatementExecutorCallback.java
index 089dd0d..e7fb7cf 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyStatementExecutorCallback.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/executor/callback/impl/ProxyStatementExecutorCallback.java
@@ -20,6 +20,7 @@ package 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.call
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.callback.ProxyJDBCExecutorCallback;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -29,9 +30,9 @@ import java.sql.Statement;
  */
 public final class ProxyStatementExecutorCallback extends 
ProxyJDBCExecutorCallback {
     
-    public ProxyStatementExecutorCallback(final DatabaseType databaseType, 
final BackendConnection backendConnection,
+    public ProxyStatementExecutorCallback(final DatabaseType databaseType, 
final SQLStatement sqlStatement, final BackendConnection backendConnection,
                                           final boolean isExceptionThrown, 
final boolean isReturnGeneratedKeys, final boolean fetchMetaData) {
-        super(databaseType, backendConnection, isExceptionThrown, 
isReturnGeneratedKeys, fetchMetaData);
+        super(databaseType, sqlStatement, backendConnection, 
isExceptionThrown, isReturnGeneratedKeys, fetchMetaData);
     }
     
     @Override

Reply via email to