if (batchCount == batchSize /* never true for batchSize of 0 */) { int[] result = delegate.executeBatch(); processResult(result); batchCount = 0;
public BatchingStatementWrapper(Statement delegate, int batchSize, Logger log) { this.delegate = delegate; this.batchSize = batchSize; this.log = log; reset(); }
public int[] executeBatch() throws SQLException { if (shouldCallDelegate()) { int[] lastResult = delegate.executeBatch(); processResult(lastResult); } int[] result = new int[results.size()]; for (int i = 0; i < results.size(); i++) { result[i] = results.get(i); } reset(); return result; }
try { withinBatch = true; statement = new BatchingStatementWrapper(createStatement(connection), batchSize, LOG); closure.call(statement); return statement.executeBatch(); } catch (SQLException e) { LOG.warning("Error during batch execution: " + e.getMessage());
public int[] executeBatch() throws SQLException { int[] lastResult = delegate.executeBatch(); processResult(lastResult); int[] result = new int[results.size()]; for (int i = 0; i < results.size(); i++) { result[i] = results.get(i); } reset(); return result; }
try { withinBatch = true; statement = new BatchingStatementWrapper(createStatement(connection), batchSize, LOG); closure.call(statement); return statement.executeBatch();
private void closeResources(BatchingStatementWrapper statement) { if (cacheStatements) return; if (statement != null) { try { statement.close(); } catch (SQLException e) { LOG.finest("Caught exception closing statement: " + e.getMessage() + " - continuing"); } } }
public void addBatch(String sql) throws SQLException { delegate.addBatch(sql); incrementBatchCount(); }
try { withinBatch = true; statement = new BatchingStatementWrapper(createStatement(connection), batchSize, LOG); closure.call(statement); return statement.executeBatch(); } catch (SQLException e) { LOG.warning("Error during batch execution: " + e.getMessage());
private static void closeResources(BatchingStatementWrapper statement) { if (statement != null) { try { statement.close(); } catch (SQLException e) { LOG.finest("Caught exception closing statement: " + e.getMessage() + " - continuing"); } } }
public void clearBatch() throws SQLException { if (batchSize != 0) { reset(); } delegate.clearBatch(); }
/** * Increments batch count (after addBatch(..) has been called) * and execute {@code delegate.executeBatch()} if batchSize has been reached. */ protected void incrementBatchCount() throws SQLException { batchCount++; if (batchCount == batchSize /* never true for batchSize of 0 */) { int[] result = delegate.executeBatch(); processResult(result); batchCount = 0; } }
public BatchingStatementWrapper(Statement delegate, int batchSize, Logger log) { this.delegate = delegate; this.batchSize = batchSize; this.log = log; reset(); }
public void addBatch(String sql) throws SQLException { delegate.addBatch(sql); batchCount++; if (batchCount == batchSize /* never true for batchSize of 0 */) { int[] result = delegate.executeBatch(); processResult(result); batchCount = 0; } }
public BatchingStatementWrapper(Statement delegate, int batchSize, Logger log) { this.delegate = delegate; this.batchSize = batchSize; this.log = log; reset(); }
public void clearBatch() throws SQLException { if (batchSize != 0) { reset(); } delegate.clearBatch(); }
public void clearBatch() throws SQLException { if (batchSize != 0) { reset(); } delegate.clearBatch(); }