@Override public void clearBatch() throws SQLException { rawStatement.clearBatch(); }
@Override public void clearBatch() throws SQLException { rawStatement.clearBatch(); }
/** {@inheritDoc} */ @Override public void clearBatch() throws SQLException { delegate.clearBatch(); }
@Override public void clearBatch() throws SQLException { Preconditions.checkArgument(1 == routedStatements.size(), "Cannot support clearBatch for DDL"); routedStatements.iterator().next().clearBatch(); }
@Override protected void resetBatch() { try { this.insertPstmtForFixedBatch.clearBatch(); this.insertPstmtForFixedBatch.clearParameters(); this.currBatchSize = 0; } catch (SQLException e) { throw new RuntimeException(e); } }
@Override public Object call() throws Exception { pstmt2.clearBatch(); return null; } }, SQLException.class, "Statement is closed.");
public void clearBatch( PreparedStatement preparedStatement ) throws KettleDatabaseException { try { preparedStatement.clearBatch(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to clear batch for prepared statement", e ); } }
protected void clearBatch(PreparedStatement statement) { try { // This code can be called after the connection is released // and the statement is closed. If the statement is closed, // then SQLException will be thrown when PreparedStatement#clearBatch // is called. // Ensure the statement is not closed before // calling PreparedStatement#clearBatch. if ( !statement.isClosed() ) { statement.clearBatch(); } } catch ( SQLException e ) { LOG.unableToReleaseBatchStatement(); } }
public void executeAndClearBatch( PreparedStatement preparedStatement ) throws KettleDatabaseException { try { if ( written > 0 && getDatabaseMetaData().supportsBatchUpdates() ) { preparedStatement.executeBatch(); } written = 0; preparedStatement.clearBatch(); } catch ( SQLException e ) { throw new KettleDatabaseException( "Unable to clear batch for prepared statement", e ); } }
ps.executeBatch(); commit(); ps.clearBatch(); } else { debug = "insertRow normal commit";
ps.executeBatch(); commit(); ps.clearBatch(); } else { commit();
/** * @throws SQLException If failed. */ @Test public void testBatchClearPrepared() throws SQLException { final int BATCH_SIZE = 10; for (int persIdx = 0; persIdx < BATCH_SIZE; ++persIdx) { fillParamsWithPerson(pstmt, persIdx); pstmt.addBatch(); } pstmt.clearBatch(); int[] updates = pstmt.executeBatch(); assertEquals("Returned update counts array should have no elements for empty batch.", 0, updates.length); assertEquals("Test table should be empty after empty batch is performed.", 0L, personsCount()); }
@Override public void clearBatch() throws SQLException { ps.clearBatch(); }
/** * @throws Exception If failed. */ @Test public void testClearBatch() throws Exception { GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws SQLException { return prepStmt.executeBatch(); } }, SQLException.class, "Batch is empty"); formBatch(1, 2); prepStmt.clearBatch(); GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws SQLException { return prepStmt.executeBatch(); } }, SQLException.class, "Batch is empty"); }
void commit() { try { pStmtInsertWayNodes.executeBatch(); pStmtUpdateData.executeBatch(); pStmtInsertWayNodes.clearBatch(); pStmtUpdateData.clearBatch(); writer.conn.commit(); } catch (SQLException e) { e.printStackTrace(); } } }
data.insertStatement.executeBatch(); data.db.commit(); data.insertStatement.clearBatch(); } else if ( performUpdate ) { data.updateStatement.executeBatch(); data.db.commit(); data.updateStatement.clearBatch(); } else if ( performDelete ) { data.deleteStatement.executeBatch(); data.db.commit(); data.deleteStatement.clearBatch();
insertStatement.executeBatch(); data.db.commit(); insertStatement.clearBatch(); } catch ( SQLException ex ) { throw Database.createKettleDatabaseBatchException( "Error updating batch", ex );
@Override public void clear() { this.count = 0; SQLException exception = null; for (PreparedStatement statement : this.statements.values()) { try { statement.clearBatch(); } catch (SQLException e) { exception = e; } } if (exception != null) { /* * Will throw exception when the database connection error, * we clear statements because clearBatch() failed */ this.statements = new HashMap<>(); } }
/** * Write a <code>Node</code> to the database. */ private void writeNode(Node node) { try { this.pStmtNodesC.setLong(1, node.getId()); this.pStmtNodesC.setDouble(2, node.getLatitude()); this.pStmtNodesC.setDouble(3, node.getLongitude()); this.pStmtNodesC.addBatch(); if (this.nNodes % BATCH_LIMIT == 0) { this.pStmtNodesC.executeBatch(); this.pStmtNodesC.clearBatch(); } } catch (SQLException e) { e.printStackTrace(); } }
private void storeWay(Way way) { int i = 0; try { for (WayNode wayNode : way.getWayNodes()) { pStmtInsertWayNodes.setLong(1, way.getId()); pStmtInsertWayNodes.setLong(2, wayNode.getNodeId()); pStmtInsertWayNodes.setInt(3, i); pStmtInsertWayNodes.addBatch(); i++; batchCountWays++; if (batchCountWays % PoiWriter.BATCH_LIMIT == 0) { pStmtInsertWayNodes.executeBatch(); pStmtInsertWayNodes.clearBatch(); } } } catch (SQLException e) { e.printStackTrace(); } }