Loading sharding-jdbc/src/main/java/io/shardingsphere/core/executor/SQLExecutorEngine.java→sharding-jdbc/src/main/java/io/shardingsphere/core/executor/SQLExecuteTemplate.java +2 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import io.shardingsphere.core.constant.ConnectionMode; import io.shardingsphere.core.event.ShardingEventBusInstance; import io.shardingsphere.core.executor.event.overall.OverallExecutionEvent; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.sql.SQLException; Loading @@ -33,7 +32,7 @@ import java.util.List; import java.util.Map; /** * SQL execute engine. * SQL execute template. * * @author gaohongtao * @author zhangliang Loading @@ -41,9 +40,8 @@ import java.util.Map; * @author panjuan */ @RequiredArgsConstructor public final class SQLExecutorEngine { public final class SQLExecuteTemplate { @Getter private final ShardingExecuteEngine shardingExecuteEngine; private final ConnectionMode connectionMode; Loading sharding-jdbc/src/main/java/io/shardingsphere/core/executor/type/batch/BatchPreparedStatementExecutor.java +3 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import io.shardingsphere.core.constant.DatabaseType; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.executor.StatementExecuteUnit; import io.shardingsphere.core.executor.SQLExecuteCallback; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.RequiredArgsConstructor; Loading @@ -40,7 +40,7 @@ import java.util.Map; @RequiredArgsConstructor public final class BatchPreparedStatementExecutor { private final SQLExecutorEngine executorEngine; private final SQLExecuteTemplate executeTemplate; private final DatabaseType dbType; Loading @@ -66,7 +66,7 @@ public final class BatchPreparedStatementExecutor { return executeUnit.getStatement().executeBatch(); } }; return accumulate(executorEngine.execute(batchPreparedStatementUnits, callback)); return accumulate(executeTemplate.execute(batchPreparedStatementUnits, callback)); } private int[] accumulate(final List<int[]> results) { Loading sharding-jdbc/src/main/java/io/shardingsphere/core/executor/type/prepared/PreparedStatementExecutor.java +5 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ package io.shardingsphere.core.executor.type.prepared; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.executor.StatementExecuteUnit; import io.shardingsphere.core.executor.SQLExecuteCallback; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.RequiredArgsConstructor; Loading @@ -42,7 +42,7 @@ import java.util.Map; @RequiredArgsConstructor public final class PreparedStatementExecutor { private final SQLExecutorEngine executorEngine; private final SQLExecuteTemplate executeTemplate; private final SQLType sqlType; Loading @@ -64,7 +64,7 @@ public final class PreparedStatementExecutor { return ((PreparedStatement) executeUnit.getStatement()).executeQuery(); } }; return executorEngine.execute(preparedStatementUnits, executeCallback); return executeTemplate.execute(preparedStatementUnits, executeCallback); } /** Loading @@ -83,7 +83,7 @@ public final class PreparedStatementExecutor { return ((PreparedStatement) executeUnit.getStatement()).executeUpdate(); } }; List<Integer> results = executorEngine.execute(preparedStatementUnits, executeCallback); List<Integer> results = executeTemplate.execute(preparedStatementUnits, executeCallback); return accumulate(results); } Loading Loading @@ -111,7 +111,7 @@ public final class PreparedStatementExecutor { return ((PreparedStatement) executeUnit.getStatement()).execute(); } }; List<Boolean> result = executorEngine.execute(preparedStatementUnits, executeCallback); List<Boolean> result = executeTemplate.execute(preparedStatementUnits, executeCallback); if (null == result || result.isEmpty() || null == result.get(0)) { return false; } Loading sharding-jdbc/src/main/java/io/shardingsphere/core/executor/type/statement/StatementExecutor.java +5 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ package io.shardingsphere.core.executor.type.statement; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.executor.StatementExecuteUnit; import io.shardingsphere.core.executor.SQLExecuteCallback; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.RequiredArgsConstructor; Loading @@ -43,7 +43,7 @@ import java.util.Map; @RequiredArgsConstructor public final class StatementExecutor { private final SQLExecutorEngine executorEngine; private final SQLExecuteTemplate executeTemplate; private final SQLType sqlType; Loading @@ -65,7 +65,7 @@ public final class StatementExecutor { return executeUnit.getStatement().executeQuery(executeUnit.getSqlExecutionUnit().getSqlUnit().getSql()); } }; return executorEngine.execute(statementUnits, executeCallback); return executeTemplate.execute(statementUnits, executeCallback); } /** Loading Loading @@ -145,7 +145,7 @@ public final class StatementExecutor { return updater.executeUpdate(executeUnit.getStatement(), executeUnit.getSqlExecutionUnit().getSqlUnit().getSql()); } }; List<Integer> results = executorEngine.execute(statementUnits, executeCallback); List<Integer> results = executeTemplate.execute(statementUnits, executeCallback); return accumulate(results); } Loading Loading @@ -234,7 +234,7 @@ public final class StatementExecutor { return executor.execute(executeUnit.getStatement(), executeUnit.getSqlExecutionUnit().getSqlUnit().getSql()); } }; List<Boolean> result = executorEngine.execute(statementUnits, executeCallback); List<Boolean> result = executeTemplate.execute(statementUnits, executeCallback); if (null == result || result.isEmpty() || null == result.get(0)) { return false; } Loading sharding-jdbc/src/main/java/io/shardingsphere/core/jdbc/core/statement/ShardingPreparedStatement.java +5 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import com.google.common.collect.Iterators; import io.shardingsphere.core.constant.ConnectionMode; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.event.ShardingEventBusInstance; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.result.MemoryQueryResult; import io.shardingsphere.core.executor.result.StreamQueryResult; import io.shardingsphere.core.executor.type.batch.BatchPreparedStatementExecutor; Loading Loading @@ -137,7 +137,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta ResultSet result; try { Collection<PreparedStatementUnit> preparedStatementUnits = route(); List<ResultSet> resultSets = new PreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), List<ResultSet> resultSets = new PreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), routeResult.getSqlStatement().getType(), preparedStatementUnits).executeQuery(); MergeEngine mergeEngine = MergeEngineFactory.newInstance( connection.getShardingContext().getShardingRule(), getQueryResults(resultSets), routeResult.getSqlStatement(), connection.getShardingContext().getMetaData().getTable()); Loading Loading @@ -166,7 +166,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta routedStatements.clear(); try { Collection<PreparedStatementUnit> preparedStatementUnits = route(); return new PreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), return new PreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), routeResult.getSqlStatement().getType(), preparedStatementUnits).executeUpdate(); } finally { refreshTableMetaData(); Loading @@ -179,7 +179,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta routedStatements.clear(); try { Collection<PreparedStatementUnit> preparedStatementUnits = route(); return new PreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), return new PreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), routeResult.getSqlStatement().getType(), preparedStatementUnits).execute(); } finally { refreshTableMetaData(); Loading Loading @@ -308,7 +308,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta @Override public int[] executeBatch() throws SQLException { try { return new BatchPreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), return new BatchPreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), connection.getShardingContext().getDatabaseType(), routeResult.getSqlStatement().getType(), batchStatementUnits, batchCount).executeBatch(); } finally { clearBatch(); Loading Loading
sharding-jdbc/src/main/java/io/shardingsphere/core/executor/SQLExecutorEngine.java→sharding-jdbc/src/main/java/io/shardingsphere/core/executor/SQLExecuteTemplate.java +2 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import io.shardingsphere.core.constant.ConnectionMode; import io.shardingsphere.core.event.ShardingEventBusInstance; import io.shardingsphere.core.executor.event.overall.OverallExecutionEvent; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.Getter; import lombok.RequiredArgsConstructor; import java.sql.SQLException; Loading @@ -33,7 +32,7 @@ import java.util.List; import java.util.Map; /** * SQL execute engine. * SQL execute template. * * @author gaohongtao * @author zhangliang Loading @@ -41,9 +40,8 @@ import java.util.Map; * @author panjuan */ @RequiredArgsConstructor public final class SQLExecutorEngine { public final class SQLExecuteTemplate { @Getter private final ShardingExecuteEngine shardingExecuteEngine; private final ConnectionMode connectionMode; Loading
sharding-jdbc/src/main/java/io/shardingsphere/core/executor/type/batch/BatchPreparedStatementExecutor.java +3 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import io.shardingsphere.core.constant.DatabaseType; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.executor.StatementExecuteUnit; import io.shardingsphere.core.executor.SQLExecuteCallback; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.RequiredArgsConstructor; Loading @@ -40,7 +40,7 @@ import java.util.Map; @RequiredArgsConstructor public final class BatchPreparedStatementExecutor { private final SQLExecutorEngine executorEngine; private final SQLExecuteTemplate executeTemplate; private final DatabaseType dbType; Loading @@ -66,7 +66,7 @@ public final class BatchPreparedStatementExecutor { return executeUnit.getStatement().executeBatch(); } }; return accumulate(executorEngine.execute(batchPreparedStatementUnits, callback)); return accumulate(executeTemplate.execute(batchPreparedStatementUnits, callback)); } private int[] accumulate(final List<int[]> results) { Loading
sharding-jdbc/src/main/java/io/shardingsphere/core/executor/type/prepared/PreparedStatementExecutor.java +5 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ package io.shardingsphere.core.executor.type.prepared; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.executor.StatementExecuteUnit; import io.shardingsphere.core.executor.SQLExecuteCallback; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.RequiredArgsConstructor; Loading @@ -42,7 +42,7 @@ import java.util.Map; @RequiredArgsConstructor public final class PreparedStatementExecutor { private final SQLExecutorEngine executorEngine; private final SQLExecuteTemplate executeTemplate; private final SQLType sqlType; Loading @@ -64,7 +64,7 @@ public final class PreparedStatementExecutor { return ((PreparedStatement) executeUnit.getStatement()).executeQuery(); } }; return executorEngine.execute(preparedStatementUnits, executeCallback); return executeTemplate.execute(preparedStatementUnits, executeCallback); } /** Loading @@ -83,7 +83,7 @@ public final class PreparedStatementExecutor { return ((PreparedStatement) executeUnit.getStatement()).executeUpdate(); } }; List<Integer> results = executorEngine.execute(preparedStatementUnits, executeCallback); List<Integer> results = executeTemplate.execute(preparedStatementUnits, executeCallback); return accumulate(results); } Loading Loading @@ -111,7 +111,7 @@ public final class PreparedStatementExecutor { return ((PreparedStatement) executeUnit.getStatement()).execute(); } }; List<Boolean> result = executorEngine.execute(preparedStatementUnits, executeCallback); List<Boolean> result = executeTemplate.execute(preparedStatementUnits, executeCallback); if (null == result || result.isEmpty() || null == result.get(0)) { return false; } Loading
sharding-jdbc/src/main/java/io/shardingsphere/core/executor/type/statement/StatementExecutor.java +5 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ package io.shardingsphere.core.executor.type.statement; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.executor.StatementExecuteUnit; import io.shardingsphere.core.executor.SQLExecuteCallback; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap; import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler; import lombok.RequiredArgsConstructor; Loading @@ -43,7 +43,7 @@ import java.util.Map; @RequiredArgsConstructor public final class StatementExecutor { private final SQLExecutorEngine executorEngine; private final SQLExecuteTemplate executeTemplate; private final SQLType sqlType; Loading @@ -65,7 +65,7 @@ public final class StatementExecutor { return executeUnit.getStatement().executeQuery(executeUnit.getSqlExecutionUnit().getSqlUnit().getSql()); } }; return executorEngine.execute(statementUnits, executeCallback); return executeTemplate.execute(statementUnits, executeCallback); } /** Loading Loading @@ -145,7 +145,7 @@ public final class StatementExecutor { return updater.executeUpdate(executeUnit.getStatement(), executeUnit.getSqlExecutionUnit().getSqlUnit().getSql()); } }; List<Integer> results = executorEngine.execute(statementUnits, executeCallback); List<Integer> results = executeTemplate.execute(statementUnits, executeCallback); return accumulate(results); } Loading Loading @@ -234,7 +234,7 @@ public final class StatementExecutor { return executor.execute(executeUnit.getStatement(), executeUnit.getSqlExecutionUnit().getSqlUnit().getSql()); } }; List<Boolean> result = executorEngine.execute(statementUnits, executeCallback); List<Boolean> result = executeTemplate.execute(statementUnits, executeCallback); if (null == result || result.isEmpty() || null == result.get(0)) { return false; } Loading
sharding-jdbc/src/main/java/io/shardingsphere/core/jdbc/core/statement/ShardingPreparedStatement.java +5 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import com.google.common.collect.Iterators; import io.shardingsphere.core.constant.ConnectionMode; import io.shardingsphere.core.constant.SQLType; import io.shardingsphere.core.event.ShardingEventBusInstance; import io.shardingsphere.core.executor.SQLExecutorEngine; import io.shardingsphere.core.executor.SQLExecuteTemplate; import io.shardingsphere.core.executor.result.MemoryQueryResult; import io.shardingsphere.core.executor.result.StreamQueryResult; import io.shardingsphere.core.executor.type.batch.BatchPreparedStatementExecutor; Loading Loading @@ -137,7 +137,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta ResultSet result; try { Collection<PreparedStatementUnit> preparedStatementUnits = route(); List<ResultSet> resultSets = new PreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), List<ResultSet> resultSets = new PreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), routeResult.getSqlStatement().getType(), preparedStatementUnits).executeQuery(); MergeEngine mergeEngine = MergeEngineFactory.newInstance( connection.getShardingContext().getShardingRule(), getQueryResults(resultSets), routeResult.getSqlStatement(), connection.getShardingContext().getMetaData().getTable()); Loading Loading @@ -166,7 +166,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta routedStatements.clear(); try { Collection<PreparedStatementUnit> preparedStatementUnits = route(); return new PreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), return new PreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), routeResult.getSqlStatement().getType(), preparedStatementUnits).executeUpdate(); } finally { refreshTableMetaData(); Loading @@ -179,7 +179,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta routedStatements.clear(); try { Collection<PreparedStatementUnit> preparedStatementUnits = route(); return new PreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), return new PreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), routeResult.getSqlStatement().getType(), preparedStatementUnits).execute(); } finally { refreshTableMetaData(); Loading Loading @@ -308,7 +308,7 @@ public final class ShardingPreparedStatement extends AbstractShardingPreparedSta @Override public int[] executeBatch() throws SQLException { try { return new BatchPreparedStatementExecutor(new SQLExecutorEngine(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), return new BatchPreparedStatementExecutor(new SQLExecuteTemplate(connection.getShardingContext().getExecuteEngine(), connection.getShardingContext().getConnectionMode()), connection.getShardingContext().getDatabaseType(), routeResult.getSqlStatement().getType(), batchStatementUnits, batchCount).executeBatch(); } finally { clearBatch(); Loading