Skip to content

Commit

Permalink
refactor MasterSlaveStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Aug 30, 2017
1 parent 5b1caf5 commit 9259588
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public int executeUpdate(final String sql, final String[] columnNames) throws SQ
private Statement getSingleStatement(final String sql) throws SQLException {
Collection<Connection> connections = connection.getConnection(sql);
Preconditions.checkState(1 == connections.size());
Statement result = connections.iterator().next().createStatement();
Statement result = connections.iterator().next().createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
routedStatements.add(result);
return result;
}
Expand All @@ -100,7 +100,7 @@ private Statement getSingleStatement(final String sql) throws SQLException {
public boolean execute(final String sql) throws SQLException {
boolean result = false;
for (Connection each : connection.getConnection(sql)) {
Statement statement = each.createStatement();
Statement statement = each.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
routedStatements.add(statement);
result = statement.execute(sql);
}
Expand All @@ -111,7 +111,7 @@ public boolean execute(final String sql) throws SQLException {
public boolean execute(final String sql, final int autoGeneratedKeys) throws SQLException {
boolean result = false;
for (Connection each : connection.getConnection(sql)) {
Statement statement = each.createStatement();
Statement statement = each.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
routedStatements.add(statement);
result = statement.execute(sql, autoGeneratedKeys);
}
Expand All @@ -122,7 +122,7 @@ public boolean execute(final String sql, final int autoGeneratedKeys) throws SQL
public boolean execute(final String sql, final int[] columnIndexes) throws SQLException {
boolean result = false;
for (Connection each : connection.getConnection(sql)) {
Statement statement = each.createStatement();
Statement statement = each.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
routedStatements.add(statement);
result = statement.execute(sql, columnIndexes);
}
Expand All @@ -133,7 +133,7 @@ public boolean execute(final String sql, final int[] columnIndexes) throws SQLEx
public boolean execute(final String sql, final String[] columnNames) throws SQLException {
boolean result = false;
for (Connection each : connection.getConnection(sql)) {
Statement statement = each.createStatement();
Statement statement = each.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
routedStatements.add(statement);
result = statement.execute(sql, columnNames);
}
Expand Down

0 comments on commit 9259588

Please sign in to comment.