@Override public void clearParameters() throws SQLException { rawStatement.clearParameters(); }
@Override public void clearParameters() throws SQLException { rawStatement.clearParameters(); }
@Override public void clearParameters() throws SQLException { statement.clearParameters(); }
/** {@inheritDoc} */ @Override public void clearParameters() throws SQLException { delegate.clearParameters(); }
@Override public void clearParameters() throws SQLException { delegate.clearParameters(); }
public void clearParameters() throws SQLException { pstmt.clearParameters(); }
PreparedStatement ps = c.prepareStatement("INSERT INTO employees VALUES (?, ?)"); ps.setString(1, "John"); ps.setString(2,"Doe"); ps.addBatch(); ps.clearParameters(); ps.setString(1, "Dave"); ps.setString(2,"Smith"); ps.addBatch(); ps.clearParameters(); int[] results = ps.executeBatch();
@Override public final void clearParameters() throws SQLException { getTargetPreparedStatement().clearParameters(); }
@Override public void clearParameters() throws SQLException { initParameterHolder(); targetStatement.clearParameters(); }
/** * Returns the specified prepared statement. * * @param key the prepared statement from {@link PreparedStatementCveDb} to * return * @return the prepared statement * @throws SQLException thrown if a SQL Exception occurs */ private synchronized PreparedStatement getPreparedStatement(PreparedStatementCveDb key) throws SQLException { if (!preparedStatements.containsKey(key)) { return null; } final PreparedStatement preparedStatement = preparedStatements.get(key); preparedStatement.clearParameters(); return preparedStatement; }
@Override public boolean addBatch() throws SQLException { pstmt.addBatch(); pstmt.clearParameters(); batchCount++; if (batchCount % maxBatchSize == 0L) { pstmt.executeBatch(); pstmt.getConnection().commit(); return true; } return false; }
@Override public void clearParameters() throws SQLException { checkOpen(); try { stmt.clearParameters(); } catch (Throwable t) { throw checkException(t); } }
@Override protected void resetBatch() { try { this.insertPstmtForFixedBatch.clearBatch(); this.insertPstmtForFixedBatch.clearParameters(); this.currBatchSize = 0; } catch (SQLException e) { throw new RuntimeException(e); } }
@Override protected boolean insertBatch(PreparedStatement pstmt) throws SQLException { int i = 0; pstmt.clearParameters(); for (JdbcEntryData pendingEntry : PostgresBufferedInserter.this.pendingInserts) { for (JdbcEntryDatum datum : pendingEntry) { pstmt.setObject(++i, datum.getVal()); } } log.debug("Executing SQL " + pstmt); return pstmt.execute(); } }
@Override protected boolean insertBatch(PreparedStatement pstmt) throws SQLException { int i = 0; pstmt.clearParameters(); for (JdbcEntryData pendingEntry : MySqlBufferedInserter.this.pendingInserts) { for (JdbcEntryDatum datum : pendingEntry) { pstmt.setObject(++i, datum.getVal()); } } if (LOG.isDebugEnabled()) { LOG.debug("Executing SQL " + pstmt); } return pstmt.execute(); }
@Override public void preparedStatement_clearParameters(PreparedStatementProxy statement) throws SQLException { if (this.pos < filterSize) { nextFilter().preparedStatement_clearParameters(this, statement); return; } statement.getRawObject().clearParameters(); }
/** * @throws Exception If failed. */ @Test public void testClearParameter() throws Exception { stmt = conn.prepareStatement(SQL_PART + " where boolVal is not distinct from ?"); stmt.setString(1, ""); stmt.setLong(2, 1L); stmt.setInt(5, 1); stmt.clearParameters(); stmt.setBoolean(1, true); ResultSet rs = stmt.executeQuery(); boolean hasNext = rs.next(); assert hasNext; assert rs.getInt("id") == 1; }
/** * Clears the current parameter values immediately. * <p> * In general, parameter values remain in force for repeated use of a * statement. Setting a parameter value automatically clears its * previous value. However, in some cases it is useful to immediately * release the resources used by the current parameter values; this can * be done by calling the method <code>clearParameters</code>. */ public Q clearParameters() { init(); if (preparedStatement == null) { return _this(); } try { preparedStatement.clearParameters(); } catch (SQLException sex) { throw new DbSqlException(sex); } return _this(); }
public void testMySqlBufferedInsert() throws SQLException { final int colNums = 20; final int batchSize = 10; final int entryCount = 107; final int colSize = 7; State state = new State(); state.setProp(WRITER_JDBC_INSERT_BATCH_SIZE, Integer.toString(batchSize)); JdbcBufferedInserter inserter = getJdbcBufferedInserter(state, conn); PreparedStatement pstmt = mock(PreparedStatement.class); when(conn.prepareStatement(anyString())).thenReturn(pstmt); List<JdbcEntryData> jdbcEntries = createJdbcEntries(colNums, colSize, entryCount); for(JdbcEntryData entry : jdbcEntries) { inserter.insert(db, table, entry); } inserter.flush(); verify(conn, times(2)).prepareStatement(anyString()); verify(pstmt, times(11)).clearParameters(); verify(pstmt, times(11)).execute(); verify(pstmt, times(colNums * entryCount)).setObject(anyInt(), anyObject()); reset(pstmt); }
rawStatement.clearParameters(); } catch (SQLException ex) { this.handleException(ex, null);