You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by do...@apache.org on 2020/07/08 11:55:22 UTC
[shardingsphere] branch master updated: Modify SQLExecuteEngine
interface (#6301)
This is an automated email from the ASF dual-hosted git repository.
dongzonglei 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 7bc1a03 Modify SQLExecuteEngine interface (#6301)
7bc1a03 is described below
commit 7bc1a03ddfb72bd0f517b784acb2cf37862a6470
Author: Juan Pan(Trista) <pa...@apache.org>
AuthorDate: Wed Jul 8 19:55:07 2020 +0800
Modify SQLExecuteEngine interface (#6301)
* pass sql statemnt to DatabaseCommunicationEngineFactory
* Modify SQLExecuteEngine interface
* Revert "pass sql statemnt to DatabaseCommunicationEngineFactory"
This reverts commit ac35e3e9
---
.../communication/jdbc/JDBCDatabaseCommunicationEngine.java | 2 +-
.../backend/communication/jdbc/execute/JDBCExecuteEngine.java | 5 +++++
.../backend/communication/jdbc/execute/SQLExecuteEngine.java | 9 +++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java
index 3799e35..e9e6604 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java
@@ -73,7 +73,7 @@ public final class JDBCDatabaseCommunicationEngine implements DatabaseCommunicat
@Override
public BackendResponse execute() {
try {
- ExecutionContext executionContext = executeEngine.getJdbcExecutorWrapper().execute(sql);
+ ExecutionContext executionContext = executeEngine.execute(sql);
if (ProxySchemaContexts.getInstance().getSchemaContexts().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)) {
SQLLogger.logSQL(sql, ProxySchemaContexts.getInstance().getSchemaContexts().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SIMPLE), executionContext);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/JDBCExecuteEngine.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/JDBCExecuteEngine.java
index 7a6732b..816801c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/JDBCExecuteEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/JDBCExecuteEngine.java
@@ -75,6 +75,11 @@ public final class JDBCExecuteEngine implements SQLExecuteEngine {
rawExecutor = new RawProxyExecutor(BackendExecutorContext.getInstance().getExecutorKernel(), backendConnection.isSerialExecute());
}
+ @Override
+ public ExecutionContext execute(final String sql) throws SQLException {
+ return jdbcExecutorWrapper.execute(sql);
+ }
+
@SuppressWarnings("unchecked")
@Override
public BackendResponse execute(final ExecutionContext executionContext) throws SQLException {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/SQLExecuteEngine.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/SQLExecuteEngine.java
index dee95c4..5a53894 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/SQLExecuteEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/execute/SQLExecuteEngine.java
@@ -30,6 +30,15 @@ public interface SQLExecuteEngine {
/**
* Execute SQL.
*
+ * @param sql SQL to be routed
+ * @return execution context
+ * @throws SQLException SQL exception
+ */
+ ExecutionContext execute(String sql) throws SQLException;
+
+ /**
+ * Execute SQL.
+ *
* @param executionContext execution context
* @return execute response
* @throws SQLException SQL exception