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 8d2430f191c64..cd371bcc711d3 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 @@ -164,7 +164,7 @@ public ResultSet executeQuery(final ShardingSphereDatabase database, final Query } private TrafficExecutorCallback getTrafficExecuteQueryCallback(final String jdbcDriverType) { - return JDBCDriverType.STATEMENT.equals(jdbcDriverType) ? Statement::executeQuery : ((statement, sql) -> ((PreparedStatement) statement).executeQuery()); + return JDBCDriverType.STATEMENT.equals(jdbcDriverType) ? ((sql, statement) -> statement.executeQuery(sql)) : ((sql, statement) -> ((PreparedStatement) statement).executeQuery()); } private ExecuteQueryCallback getExecuteQueryCallback(final ShardingSphereDatabase database, final QueryContext queryContext, final String jdbcDriverType) { 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 198fe9bb813c7..e97550e0e2610 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 @@ -261,7 +261,7 @@ public int executeUpdate() throws SQLException { handleAutoCommit(queryContext.getSqlStatementContext().getSqlStatement()); ShardingSphereDatabase database = metaData.getDatabase(databaseName); final int result = executor.executeUpdate(database, queryContext, createDriverExecutionPrepareEngine(database), - (statement, sql) -> ((PreparedStatement) statement).executeUpdate(), null, (StatementReplayCallback) this::replay); + (sql, statement) -> ((PreparedStatement) statement).executeUpdate(), null, (StatementReplayCallback) this::replay); for (Statement each : executor.getStatements()) { statements.add((PreparedStatement) each); } @@ -289,7 +289,7 @@ public boolean execute() throws SQLException { QueryContext queryContext = createQueryContext(); handleAutoCommit(queryContext.getSqlStatementContext().getSqlStatement()); ShardingSphereDatabase database = metaData.getDatabase(databaseName); - final boolean result = executor.executeAdvance(database, queryContext, createDriverExecutionPrepareEngine(database), (statement, sql) -> ((PreparedStatement) statement).execute(), + final boolean result = executor.executeAdvance(database, queryContext, createDriverExecutionPrepareEngine(database), (sql, statement) -> ((PreparedStatement) statement).execute(), null, (StatementReplayCallback) this::replay); for (Statement each : executor.getStatements()) { statements.add((PreparedStatement) each); diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java index 7cb715a0b5fa6..ca458c094d895 100644 --- a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java +++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSphereStatement.java @@ -151,7 +151,7 @@ private DriverExecutionPrepareEngine createDriver @Override public int executeUpdate(final String sql) throws SQLException { try { - return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL), Statement::executeUpdate); + return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL), (actualSQL, statement) -> statement.executeUpdate(actualSQL)); // CHECKSTYLE:OFF } catch (final RuntimeException ex) { // CHECKSTYLE:ON @@ -169,7 +169,7 @@ public int executeUpdate(final String sql, final int autoGeneratedKeys) throws S } try { return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL, autoGeneratedKeys), - (statement, actualSQL) -> statement.executeUpdate(actualSQL, autoGeneratedKeys)); + (actualSQL, statement) -> statement.executeUpdate(actualSQL, autoGeneratedKeys)); // CHECKSTYLE:OFF } catch (final RuntimeException ex) { // CHECKSTYLE:ON @@ -184,7 +184,7 @@ public int executeUpdate(final String sql, final int autoGeneratedKeys) throws S public int executeUpdate(final String sql, final int[] columnIndexes) throws SQLException { returnGeneratedKeys = true; try { - return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL, columnIndexes), (statement, actualSQL) -> statement.executeUpdate(actualSQL, columnIndexes)); + return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL, columnIndexes), (actualSQL, statement) -> statement.executeUpdate(actualSQL, columnIndexes)); // CHECKSTYLE:OFF } catch (final RuntimeException ex) { // CHECKSTYLE:ON @@ -199,7 +199,7 @@ public int executeUpdate(final String sql, final int[] columnIndexes) throws SQL public int executeUpdate(final String sql, final String[] columnNames) throws SQLException { returnGeneratedKeys = true; try { - return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL, columnNames), (statement, actualSQL) -> statement.executeUpdate(actualSQL, columnNames)); + return executeUpdate(sql, (actualSQL, statement) -> statement.executeUpdate(actualSQL, columnNames), (actualSQL, statement) -> statement.executeUpdate(actualSQL, columnNames)); // CHECKSTYLE:OFF } catch (final RuntimeException ex) { // CHECKSTYLE:ON @@ -228,7 +228,7 @@ private int executeUpdate(final String sql, final ExecuteUpdateCallback updateCa @Override public boolean execute(final String sql) throws SQLException { try { - return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL), Statement::execute); + return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL), (actualSQL, statement) -> statement.execute(actualSQL)); // CHECKSTYLE:OFF } catch (final SQLException ex) { // CHECKSTYLE:ON @@ -243,7 +243,7 @@ public boolean execute(final String sql, final int autoGeneratedKeys) throws SQL if (RETURN_GENERATED_KEYS == autoGeneratedKeys) { returnGeneratedKeys = true; } - return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL, autoGeneratedKeys), (statement, actualSQL) -> statement.execute(actualSQL, autoGeneratedKeys)); + return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL, autoGeneratedKeys), (actualSQL, statement) -> statement.execute(actualSQL, autoGeneratedKeys)); // CHECKSTYLE:OFF } catch (final SQLException ex) { // CHECKSTYLE:ON @@ -256,7 +256,7 @@ public boolean execute(final String sql, final int autoGeneratedKeys) throws SQL public boolean execute(final String sql, final int[] columnIndexes) throws SQLException { try { returnGeneratedKeys = true; - return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL, columnIndexes), (statement, actualSQL) -> statement.execute(actualSQL, columnIndexes)); + return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL, columnIndexes), (actualSQL, statement) -> statement.execute(actualSQL, columnIndexes)); // CHECKSTYLE:OFF } catch (final SQLException ex) { // CHECKSTYLE:ON @@ -269,7 +269,7 @@ public boolean execute(final String sql, final int[] columnIndexes) throws SQLEx public boolean execute(final String sql, final String[] columnNames) throws SQLException { try { returnGeneratedKeys = true; - return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL, columnNames), (statement, actualSQL) -> statement.execute(actualSQL, columnNames)); + return execute0(sql, (actualSQL, statement) -> statement.execute(actualSQL, columnNames), (actualSQL, statement) -> statement.execute(actualSQL, columnNames)); // CHECKSTYLE:OFF } catch (final SQLException ex) { // CHECKSTYLE:ON diff --git a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/executor/TrafficExecutorCallback.java b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/executor/TrafficExecutorCallback.java index bc6a5140d378e..e6b25160ef023 100644 --- a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/executor/TrafficExecutorCallback.java +++ b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/executor/TrafficExecutorCallback.java @@ -30,10 +30,10 @@ public interface TrafficExecutorCallback { /** * Execute. * - * @param statement statement * @param sql SQL + * @param statement statement * @return execution result * @throws SQLException SQL exception */ - T execute(Statement statement, String sql) throws SQLException; + T execute(String sql, Statement statement) throws SQLException; }