This is an automated email from the ASF dual-hosted git repository.
zhangyonglun 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 b56bfd2 Rename JDBCExecutionUnitBuilderType to JDBCDriverType (#8466)
b56bfd2 is described below
commit b56bfd24177ad1f75743815a0cf956eb03233dfa
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Dec 2 12:38:47 2020 +0800
Rename JDBCExecutionUnitBuilderType to JDBCDriverType (#8466)
---
.../JDBCExecutionUnitBuilderType.java => JDBCDriverType.java} | 6 +++---
.../driver/jdbc/builder/PreparedStatementExecutionUnitBuilder.java | 3 ++-
.../prepare/driver/jdbc/builder/StatementExecutionUnitBuilder.java | 3 ++-
.../driver/jdbc/core/statement/ShardingSpherePreparedStatement.java | 6 +++---
.../driver/jdbc/core/statement/ShardingSphereStatement.java | 4 ++--
.../proxy/backend/communication/DatabaseCommunicationEngine.java | 4 ++--
.../backend/communication/DatabaseCommunicationEngineFactory.java | 6 +++---
.../jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java | 6 +++---
8 files changed, 20 insertions(+), 18 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/JDBCExecutionUnitBuilderType.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/JDBCDriverType.java
similarity index 91%
rename from
shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/JDBCExecutionUnitBuilderType.java
rename to
shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/JDBCDriverType.java
index 2b06d7e..de7ce8b 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/JDBCExecutionUnitBuilderType.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/JDBCDriverType.java
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.builder;
+package org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
- * JDBC execution unit builder type.
+ * JDBC driver type.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class JDBCExecutionUnitBuilderType {
+public final class JDBCDriverType {
public static final String STATEMENT = "JDBC.STATEMENT";
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/PreparedStatementExecutionUnitBuilder.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/PreparedStatementExecutionUnitBuilder.java
index 17c7909..3fbe911 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/PreparedStatementExecutionUnitBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/PreparedStatementExecutionUnitBuilder.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
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.prepare.driver.jdbc.ExecutorJDBCManager;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption;
import java.sql.Connection;
@@ -48,6 +49,6 @@ public final class PreparedStatementExecutionUnitBuilder
implements JDBCExecutio
@Override
public String getType() {
- return JDBCExecutionUnitBuilderType.PREPARED_STATEMENT;
+ return JDBCDriverType.PREPARED_STATEMENT;
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/StatementExecutionUnitBuilder.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/StatementExecutionUnitBuilder.java
index 4c5d5ae..a551a93 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/StatementExecutionUnitBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/jdbc/builder/StatementExecutionUnitBuilder.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
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.prepare.driver.jdbc.ExecutorJDBCManager;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption;
import java.sql.Connection;
@@ -45,6 +46,6 @@ public final class StatementExecutionUnitBuilder implements
JDBCExecutionUnitBui
@Override
public String getType() {
- return JDBCExecutionUnitBuilderType.STATEMENT;
+ return JDBCDriverType.STATEMENT;
}
}
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 ef41890..098861b 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
@@ -51,7 +51,7 @@ import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.dr
import org.apache.shardingsphere.infra.executor.sql.log.SQLLogger;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.builder.JDBCExecutionUnitBuilderType;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
import
org.apache.shardingsphere.infra.executor.sql.prepare.raw.RawExecutionPrepareEngine;
import org.apache.shardingsphere.infra.merge.MergeEngine;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
@@ -219,7 +219,7 @@ public final class ShardingSpherePreparedStatement extends
AbstractPreparedState
private Collection<ExecutionGroup<JDBCExecutionUnit>>
createExecutionGroups() throws SQLException {
int maxConnectionsSizePerQuery =
metaDataContexts.getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY);
DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection>
prepareEngine = new DriverExecutionPrepareEngine<>(
- JDBCExecutionUnitBuilderType.PREPARED_STATEMENT,
maxConnectionsSizePerQuery, connection, statementOption,
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules());
+ JDBCDriverType.PREPARED_STATEMENT, maxConnectionsSizePerQuery,
connection, statementOption,
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules());
return prepareEngine.prepare(executionContext.getRouteContext(),
executionContext.getExecutionUnits());
}
@@ -357,7 +357,7 @@ public final class ShardingSpherePreparedStatement extends
AbstractPreparedState
private void initBatchPreparedStatementExecutor() throws SQLException {
DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection>
prepareEngine = new DriverExecutionPrepareEngine<>(
- JDBCExecutionUnitBuilderType.PREPARED_STATEMENT,
metaDataContexts.getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY),
+ JDBCDriverType.PREPARED_STATEMENT,
metaDataContexts.getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY),
connection, statementOption,
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules());
batchPreparedStatementExecutor.init(prepareEngine.prepare(executionContext.getRouteContext(),
new
ArrayList<>(batchPreparedStatementExecutor.getBatchExecutionUnits()).stream().map(BatchExecutionUnit::getExecutionUnit).collect(Collectors.toList())));
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 2784d68..c56c698 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
@@ -49,7 +49,7 @@ import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.dr
import org.apache.shardingsphere.infra.executor.sql.log.SQLLogger;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.builder.JDBCExecutionUnitBuilderType;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
import
org.apache.shardingsphere.infra.executor.sql.prepare.raw.RawExecutionPrepareEngine;
import org.apache.shardingsphere.infra.merge.MergeEngine;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
@@ -309,7 +309,7 @@ public final class ShardingSphereStatement extends
AbstractStatementAdapter {
private Collection<ExecutionGroup<JDBCExecutionUnit>>
createExecutionGroups() throws SQLException {
int maxConnectionsSizePerQuery =
metaDataContexts.getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY);
DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection>
prepareEngine = new DriverExecutionPrepareEngine<>(
- JDBCExecutionUnitBuilderType.STATEMENT,
maxConnectionsSizePerQuery, connection, statementOption,
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules());
+ JDBCDriverType.STATEMENT, maxConnectionsSizePerQuery,
connection, statementOption,
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules());
return prepareEngine.prepare(executionContext.getRouteContext(),
executionContext.getExecutionUnits());
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
index db29dfc..3ba3699 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
@@ -28,7 +28,7 @@ import
org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult
import
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
import
org.apache.shardingsphere.infra.executor.sql.execute.result.update.UpdateResult;
import org.apache.shardingsphere.infra.executor.sql.log.SQLLogger;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.builder.JDBCExecutionUnitBuilderType;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
import org.apache.shardingsphere.infra.merge.MergeEngine;
import org.apache.shardingsphere.infra.merge.result.MergedResult;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -220,6 +220,6 @@ public final class DatabaseCommunicationEngine {
}
private boolean isBinary() {
- return
JDBCExecutionUnitBuilderType.PREPARED_STATEMENT.equals(driverType);
+ return JDBCDriverType.PREPARED_STATEMENT.equals(driverType);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
index 0401216..e010424 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngineFactory.java
@@ -22,7 +22,7 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.binder.LogicSQL;
import org.apache.shardingsphere.infra.binder.SQLStatementContextFactory;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.builder.JDBCExecutionUnitBuilderType;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -60,7 +60,7 @@ public final class DatabaseCommunicationEngineFactory {
public DatabaseCommunicationEngine newTextProtocolInstance(final
SQLStatement sqlStatement, final String sql, final BackendConnection
backendConnection) {
ShardingSphereMetaData metaData =
ProxyContext.getInstance().getMetaData(backendConnection.getSchemaName());
LogicSQL logicSQL = createLogicSQL(sqlStatement, sql,
Collections.emptyList(), metaData);
- return new
DatabaseCommunicationEngine(JDBCExecutionUnitBuilderType.STATEMENT, metaData,
logicSQL, backendConnection);
+ return new DatabaseCommunicationEngine(JDBCDriverType.STATEMENT,
metaData, logicSQL, backendConnection);
}
/**
@@ -75,7 +75,7 @@ public final class DatabaseCommunicationEngineFactory {
public DatabaseCommunicationEngine newBinaryProtocolInstance(final
SQLStatement sqlStatement, final String sql, final List<Object> parameters,
final BackendConnection backendConnection) {
ShardingSphereMetaData metaData =
ProxyContext.getInstance().getMetaData(backendConnection.getSchemaName());
LogicSQL logicSQL = createLogicSQL(sqlStatement, sql, new
ArrayList<>(parameters), metaData);
- return new
DatabaseCommunicationEngine(JDBCExecutionUnitBuilderType.PREPARED_STATEMENT,
metaData, logicSQL, backendConnection);
+ return new
DatabaseCommunicationEngine(JDBCDriverType.PREPARED_STATEMENT, metaData,
logicSQL, backendConnection);
}
private LogicSQL createLogicSQL(final SQLStatement sqlStatement, final
String sql, final List<Object> parameters, final ShardingSphereMetaData
metaData) {
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 3618e01..e1bf7b5 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
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.call
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.builder.JDBCExecutionUnitBuilderType;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
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;
@@ -44,10 +44,10 @@ public final class ProxyJDBCExecutorCallbackFactory {
*/
public static ProxyJDBCExecutorCallback newInstance(final String type,
final DatabaseType databaseType, final BackendConnection backendConnection,
final boolean
isExceptionThrown, final boolean isReturnGeneratedKeys, final boolean
isFetchMetaData) {
- if (JDBCExecutionUnitBuilderType.STATEMENT.equals(type)) {
+ if (JDBCDriverType.STATEMENT.equals(type)) {
return new ProxyStatementExecutorCallback(databaseType,
backendConnection, isExceptionThrown, isReturnGeneratedKeys, isFetchMetaData);
}
- if (JDBCExecutionUnitBuilderType.PREPARED_STATEMENT.equals(type)) {
+ if (JDBCDriverType.PREPARED_STATEMENT.equals(type)) {
return new ProxyPreparedStatementExecutorCallback(databaseType,
backendConnection, isExceptionThrown, isReturnGeneratedKeys, isFetchMetaData);
}
throw new UnsupportedOperationException(String.format("Unsupported
driver type: `%s`", type));