diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java index da0d7b60e36fb..6ef7ffffe8ed8 100644 --- a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java +++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java @@ -244,8 +244,7 @@ public ResultSet executeQuery() throws SQLException { } private ShardingSphereResultSet doExecuteQuery(final ExecutionContext executionContext) throws SQLException { - List queryResults = - (executionContext); + List queryResults = executeQuery0(executionContext); MergedResult mergedResult = mergeQuery(queryResults, executionContext.getSqlStatementContext()); List resultSets = getResultSets(); if (null == columnLabelAndIndexMap) { @@ -261,13 +260,13 @@ private List executeQuery0(final ExecutionContext executionContext) } ExecutionGroupContext executionGroupContext = createExecutionGroupContext(executionContext); cacheStatements(executionGroupContext.getInputGroups()); - PreparedStatementExecuteQueryCallback callback = new PreparedStatementExecuteQueryCallback(metaDataContexts.getMetaData().getDatabase(databaseName).getProtocolType(), - metaDataContexts.getMetaData().getDatabase(databaseName).getResourceMetaData(), sqlStatement, SQLExecutorExceptionHandler.isExceptionThrown()); + PreparedStatementExecuteQueryCallback callback = new PreparedStatementExecuteQueryCallback(metaDataContext.getMetaData().getDatabase(databaseName).getProtocolType(), + metaDataContext.getMetaData().getDatabase(databaseName).getResourceMetaData(), sqlStatement, SQLExecutorExceptionHandler.isExceptionThrown()); return executor.getRegularExecutor().executeQuery(executionGroupContext, executionContext.getQueryContext(), callback); } private boolean hasRawExecutionRule() { - return !metaDataContexts.getMetaData().getDatabase(databaseName).getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty(); + return !metaDataContext.getMetaData().getDatabase(databaseName).getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty(); } private void handleAutoCommit(final SQLStatement sqlStatement) throws SQLException { @@ -489,8 +488,8 @@ private ExecutionContext createExecutionContext(final QueryContext queryContext, } private ExecutionGroupContext createRawExecutionGroupContext(final ExecutionContext executionContext) throws SQLException { - int maxConnectionsSizePerQuery = metaDataContexts.getMetaData().getProps().getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY); - return new RawExecutionPrepareEngine(maxConnectionsSizePerQuery, metaDataContexts.getMetaData().getDatabase(databaseName).getRuleMetaData().getRules()) + int maxConnectionsSizePerQuery = metaDataContext.getMetaData().getProps().getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY); + return new RawExecutionPrepareEngine(maxConnectionsSizePerQuery, metaDataContext.getMetaData().getDatabase(databaseName).getRuleMetaData().getRules()) .prepare(executionContext.getRouteContext(), executionContext.getExecutionUnits(), new ExecutionGroupReportContext(connection.getProcessId(), databaseName, new Grantee("", ""))); }