This is an automated email from the ASF dual-hosted git repository.
panjuan 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 bac9eaa Rename ExecuteQueryCallback (#8520)
bac9eaa is described below
commit bac9eaaf77e5fedfb457992ead1655300fadc7aa
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Dec 7 17:00:36 2020 +0800
Rename ExecuteQueryCallback (#8520)
* Rename ExecuteQueryCallback
* Refactor ShardingSphereStatement and ShardingSpherePreparedStatement
* Refactor ExecuteQueryCallback
---
.../{JDBCExecuteQueryCallback.java => ExecuteQueryCallback.java} | 6 +++---
.../callback/impl/PreparedStatementExecuteQueryCallback.java | 4 ++--
.../executor/callback/impl/StatementExecuteQueryCallback.java | 4 ++--
.../driver/jdbc/core/statement/ShardingSpherePreparedStatement.java | 4 +---
.../driver/jdbc/core/statement/ShardingSphereStatement.java | 4 +---
5 files changed, 9 insertions(+), 13 deletions(-)
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/JDBCExecuteQueryCallback.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
similarity index 90%
rename from
shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/JDBCExecuteQueryCallback.java
rename to
shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
index c3216b3..d6e33b6 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/JDBCExecuteQueryCallback.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/ExecuteQueryCallback.java
@@ -29,11 +29,11 @@ import java.sql.SQLException;
import java.sql.Statement;
/**
- * JDBC execute query callback.
+ * Execute query callback.
*/
-public abstract class JDBCExecuteQueryCallback extends
JDBCExecutorCallback<QueryResult> {
+public abstract class ExecuteQueryCallback extends
JDBCExecutorCallback<QueryResult> {
- public JDBCExecuteQueryCallback(final DatabaseType databaseType, final
boolean isExceptionThrown) {
+ protected ExecuteQueryCallback(final DatabaseType databaseType, final
boolean isExceptionThrown) {
super(databaseType, isExceptionThrown);
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java
index e3bd2ea..7c0b964 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/PreparedStatementExecuteQueryCallback.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.driver.executor.callback.impl;
-import
org.apache.shardingsphere.driver.executor.callback.JDBCExecuteQueryCallback;
+import org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import java.sql.PreparedStatement;
@@ -28,7 +28,7 @@ import java.sql.Statement;
/**
* Prepared statement execute query callback.
*/
-public final class PreparedStatementExecuteQueryCallback extends
JDBCExecuteQueryCallback {
+public final class PreparedStatementExecuteQueryCallback extends
ExecuteQueryCallback {
public PreparedStatementExecuteQueryCallback(final DatabaseType
databaseType, final boolean isExceptionThrown) {
super(databaseType, isExceptionThrown);
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java
index 82de1f0..0d2f64b 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/executor/callback/impl/StatementExecuteQueryCallback.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.driver.executor.callback.impl;
-import
org.apache.shardingsphere.driver.executor.callback.JDBCExecuteQueryCallback;
+import org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import java.sql.ResultSet;
@@ -27,7 +27,7 @@ import java.sql.Statement;
/**
* Statement execute query callback.
*/
-public final class StatementExecuteQueryCallback extends
JDBCExecuteQueryCallback {
+public final class StatementExecuteQueryCallback extends ExecuteQueryCallback {
public StatementExecuteQueryCallback(final DatabaseType databaseType,
final boolean isExceptionThrown) {
super(databaseType, isExceptionThrown);
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 00d4626..6cfba8c 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
@@ -45,7 +45,6 @@ import
org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawExecutor;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawSQLExecutionUnit;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.callback.RawSQLExecutorCallback;
@@ -169,8 +168,7 @@ public final class ShardingSpherePreparedStatement extends
AbstractPreparedState
Collection<ExecutionGroup<JDBCExecutionUnit>> executionGroups
= createExecutionGroups();
cacheStatements(executionGroups);
reply();
- JDBCExecutorCallback<QueryResult> callback = new
PreparedStatementExecuteQueryCallback(metaDataContexts.getDatabaseType(),
SQLExecutorExceptionHandler.isExceptionThrown());
- queryResults = jdbcExecutor.execute(executionGroups, callback);
+ queryResults = jdbcExecutor.execute(executionGroups, new
PreparedStatementExecuteQueryCallback(metaDataContexts.getDatabaseType(),
SQLExecutorExceptionHandler.isExceptionThrown()));
}
MergedResult mergedResult = mergeQuery(queryResults);
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 0138efd..628f8ba 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
@@ -43,7 +43,6 @@ import
org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawExecutor;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawSQLExecutionUnit;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.callback.RawSQLExecutorCallback;
@@ -138,8 +137,7 @@ public final class ShardingSphereStatement extends
AbstractStatementAdapter {
} else {
Collection<ExecutionGroup<JDBCExecutionUnit>> executionGroups
= createExecutionGroups();
cacheStatements(executionGroups);
- JDBCExecutorCallback<QueryResult> callback = new
StatementExecuteQueryCallback(metaDataContexts.getDatabaseType(),
SQLExecutorExceptionHandler.isExceptionThrown());
- queryResults = jdbcExecutor.execute(executionGroups, callback);
+ queryResults = jdbcExecutor.execute(executionGroups, new
StatementExecuteQueryCallback(metaDataContexts.getDatabaseType(),
SQLExecutorExceptionHandler.isExceptionThrown()));
}
MergedResult mergedResult = mergeQuery(queryResults);
result = new
ShardingSphereResultSet(statements.stream().map(this::getResultSet).collect(Collectors.toList()),
mergedResult, this, executionContext);