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 86cf6ff939964..4ce0c23713fea 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 @@ -272,15 +272,16 @@ private List getResultSets() throws SQLException { public int executeUpdate(final ShardingSphereMetaData metaData, final ShardingSphereDatabase database, final QueryContext queryContext, final DriverExecutionPrepareEngine prepareEngine, final TrafficExecutorCallback trafficCallback, final ExecuteUpdateCallback updateCallback, final StatementReplayCallback statementReplayCallback) throws SQLException { - ExecutionContext executionContext = createExecutionContext(metaData, database, queryContext); Optional trafficInstanceId = connection.getTrafficInstanceId(metaData.getGlobalRuleMetaData().getSingleRule(TrafficRule.class), queryContext); if (trafficInstanceId.isPresent()) { return trafficExecutor.execute(connection.getProcessId(), database.getName(), trafficInstanceId.get(), queryContext, prepareEngine, trafficCallback); } - boolean isNeedImplicitCommitTransaction = isNeedImplicitCommitTransaction( - connection, queryContext.getSqlStatementContext().getSqlStatement(), executionContext.getExecutionUnits().size() > 1); + ExecutionContext executionContext = createExecutionContext(metaData, database, queryContext); return database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty() - ? executeUpdate(database, updateCallback, queryContext.getSqlStatementContext(), executionContext, prepareEngine, isNeedImplicitCommitTransaction, statementReplayCallback) + ? executeUpdate(database, updateCallback, queryContext.getSqlStatementContext(), executionContext, prepareEngine, + isNeedImplicitCommitTransaction(connection, + queryContext.getSqlStatementContext().getSqlStatement(), executionContext.getExecutionUnits().size() > 1), + statementReplayCallback) : accumulate(rawExecutor.execute(createRawExecutionGroupContext(metaData, database, executionContext), queryContext, new RawSQLExecutorCallback())); }