@Override public void updateRow() throws SQLException { rs.updateRow(); }
@Override public void updateRow() throws SQLException { delegate.updateRow(); }
@Override public void updateRow() throws SQLException { try { rs.updateRow(); } catch (Throwable t) { throw checkException(t); } }
@Override public void run() throws Exception { rs.updateRow(); } });
/** {@inheritDoc} */ @Override public void updateRow() throws SQLException { connection.markCommitStateDirty(); delegate.updateRow(); }
@Override public void resultSet_updateRow(ResultSetProxy resultSet) throws SQLException { if (this.pos < filterSize) { nextFilter().resultSet_updateRow(this, resultSet); return; } resultSet.getResultSetRaw().updateRow(); }
/** * Moves the cursor down one row from its current position. * A <code>getResultSet()</code> cursor is initially positioned * before the first row; the first call to the method * <code>next</code> makes the first row the current row; the * second call makes the second row the current row, and so on. * <p> * <P>If an input stream is open for the current row, a call * to the method <code>next</code> will * implicitly close it. A <code>getResultSet()</code> object's * warning chain is cleared when a new row is read. * * @return <code>true</code> if the new current row is valid; * <code>false</code> if there are no more rows * @throws SQLException if a database access error occurs */ public boolean next() throws SQLException { if (updated) { getResultSet().updateRow(); updated = false; } return getResultSet().next(); }
/** * Moves the cursor to the previous row in this * <code>getResultSet()</code> object. * * @return <code>true</code> if the cursor is on a valid row; * <code>false</code> if it is off the result set * @throws SQLException if a database access error * occurs or the result set type is <code>TYPE_FORWARD_ONLY</code> * @since 1.2 */ public boolean previous() throws SQLException { if (updated) { getResultSet().updateRow(); updated = false; } return getResultSet().previous(); }
private void updateBlob(Connection connection, String findMessageByIdStatement, long sequence, byte[] data) throws SQLException, IOException { PreparedStatement s = null; ResultSet rs = null; try { s = connection.prepareStatement(statements.getFindMessageByIdStatement(), ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); s.setLong(1, sequence); rs = s.executeQuery(); if (!rs.next()) { throw new IOException("Failed select blob for message: " + sequence + " in container."); } // Update the blob Blob blob = rs.getBlob(1); blob.truncate(0); blob.setBytes(1, data); rs.updateBlob(1, blob); rs.updateRow(); // Update the row with the updated blob } finally { close(rs); close(s); } }
rs.insertRow(); } else { rs.updateRow();
verify(resultSet).updateString(2, "Rod"); verify(resultSet).updateString(2, "Thomas"); verify(resultSet, times(2)).updateRow(); verify(preparedStatement).setObject(1, 2, Types.NUMERIC); verify(resultSet).close();
@Override public void updateRow() throws SQLException { delegate.updateRow(); }
@Override public void updateRow() throws SQLException { innerResultSet.updateRow(); }
@Override public void updateRow() throws SQLException { innerResultSet.updateRow(); }
@Override public void updateRow() throws SQLException { rs.updateRow(); }
/** * Tries to claim the given token {@code entry}. If the claim fails an {@link UnableToClaimTokenException} should be * thrown. Otherwise the given {@code resultSet} should be updated to reflect the claim. * * @param resultSet the updatable query result of an executed {@link PreparedStatement} * @param entry the entry extracted from the given result set * @return the claimed tracking token * * @throws UnableToClaimTokenException if the token cannot be claimed because another node currently owns the token * @throws SQLException when an exception occurs while claiming the token entry */ protected TrackingToken claimToken(ResultSet resultSet, AbstractTokenEntry<?> entry) throws SQLException { if (!entry.claim(nodeId, claimTimeout)) { throw new UnableToClaimTokenException( format("Unable to claim token '%s[%s]'. It is owned by '%s'", entry.getProcessorName(), entry.getSegment(), entry.getOwner())); } resultSet.updateString(schema.ownerColum(), entry.getOwner()); resultSet.updateString(schema.timestampColumn(), entry.timestampAsString()); resultSet.updateRow(); return entry.getToken(serializer); }
@Test public void testConcurrentUpdateableResultSet() { handle.execute("create table something (id identity primary key, name varchar(50))"); handle.execute("insert into something (id, name) values (7, 'Tim')"); handle.createQuery("select id, name from something where id = :id") .bind("id", 7) .concurrentUpdatable() .map((r, ctx) -> { r.updateString("name", "Tom"); r.updateRow(); return null; }).list(); final String name = handle.createQuery("select name from something where id = :id") .bind("id", 7) .mapTo(String.class) .findOnly(); assertThat(name).isEqualTo("Tom"); } }
@Override public void updateRow() throws SQLException { try { rs.updateRow(); } catch (Throwable t) { throw checkException(t); } }
public static void updateBlobColumn(Connection con, String table, String blobColumn, byte[] inputBytes, String idColumn, Long id) throws SQLException { PreparedStatement pStmt = null; ResultSet rs = null; try { String sql = " SELECT " + blobColumn + " FROM " + table + " WHERE " + idColumn + " = ? " + " FOR UPDATE"; pStmt = con.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); pStmt.setLong(1, id); rs = pStmt.executeQuery(); if (rs.next()) { Blob blob = rs.getBlob(blobColumn); blob.truncate(0); blob.setBytes(1, inputBytes); rs.updateBlob(blobColumn, blob); rs.updateRow(); } } finally { if(rs != null) rs.close(); if(pStmt != null) pStmt.close(); } }
@Override public void resultSet_updateRow(ResultSetProxy resultSet) throws SQLException { if (this.pos < filterSize) { nextFilter().resultSet_updateRow(this, resultSet); return; } resultSet.getResultSetRaw().updateRow(); }