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

zhangliang 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 2122e0fedd8 Refactor DriverExecutor (#31569)
2122e0fedd8 is described below

commit 2122e0fedd8378ba0e260f051d9e93c0c6544084
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jun 3 18:18:53 2024 +0800

    Refactor DriverExecutor (#31569)
---
 .../shardingsphere/driver/executor/DriverExecutor.java       | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
index 89c3278441a..44109f16d41 100644
--- 
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
+++ 
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
@@ -271,12 +271,10 @@ public final class DriverExecutor implements 
AutoCloseable {
             return trafficExecutor.execute(connection.getProcessId(), 
database.getName(), trafficInstanceId.get(), queryContext, prepareEngine, 
updateCallback::executeUpdate);
         }
         ExecutionContext executionContext = createExecutionContext(database, 
queryContext);
-        return 
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
-                ? executeUpdate(database, updateCallback, 
queryContext.getSqlStatementContext(), executionContext, prepareEngine,
-                        isNeedImplicitCommitTransaction(connection,
-                                
queryContext.getSqlStatementContext().getSqlStatement(), 
executionContext.getExecutionUnits().size() > 1),
-                        statementReplayCallback)
-                : 
accumulate(rawExecutor.execute(createRawExecutionGroupContext(database, 
executionContext), queryContext, new RawSQLExecutorCallback()));
+        return hasRawExecutionRule(database)
+                ? 
accumulate(rawExecutor.execute(createRawExecutionGroupContext(database, 
executionContext), queryContext, new RawSQLExecutorCallback()))
+                : executeUpdate(database, updateCallback, 
queryContext.getSqlStatementContext(), executionContext, prepareEngine, 
isNeedImplicitCommitTransaction(
+                        connection, 
queryContext.getSqlStatementContext().getSqlStatement(), 
executionContext.getExecutionUnits().size() > 1), statementReplayCallback);
     }
     
     @SuppressWarnings("rawtypes")
@@ -380,7 +378,7 @@ public final class DriverExecutor implements AutoCloseable {
             return null != resultSet;
         }
         ExecutionContext executionContext = createExecutionContext(database, 
queryContext);
-        if 
(!database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty())
 {
+        if (hasRawExecutionRule(database)) {
             Collection<ExecuteResult> results = 
rawExecutor.execute(createRawExecutionGroupContext(database, executionContext), 
queryContext, new RawSQLExecutorCallback());
             return results.iterator().next() instanceof QueryResult;
         }

Reply via email to