Java Code Examples for java.sql.ResultSet#updateLong()
The following examples show how to use
java.sql.ResultSet#updateLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Migration_2018_12_13_SnapshotNodeId.java From linstor-server with GNU General Public License v3.0 | 6 votes |
private void markFailed(Connection connection, Collection<Tuple2<String, String>> failedSnapshotDefinitions) throws Exception { ResultSet resultSet = connection.createStatement( ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE).executeQuery(SD_SELECT_ALL); while (resultSet.next()) { String rscName = resultSet.getString(SD_RES_NAME); String snapshotName = resultSet.getString(SD_NAME); if (failedSnapshotDefinitions.contains(Tuples.of(rscName, snapshotName))) { resultSet.updateLong(SD_FLAGS, (resultSet.getLong(SD_FLAGS) & ~SD_FLAG_SUCCESSFUL) | SD_FLAG_FAILED_DEPLOYMENT ); resultSet.updateRow(); } } resultSet.close(); }
Example 2
Source File: UpdateXXXTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Tests calling updateLong on all columns of the row. * @exception SQLException database access error. Causes test to * fail with an error. */ public void testUpdateLong() throws SQLException { Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery(SELECT_STMT); rs.next(); for (int i = 1; i <= COLUMNS; i++) { rs.updateLong(i, 2L); assertEquals("Expected rs.getLong(" + i + ") to match updated value", 2L, rs.getLong(i)); } rs.updateRow(); rs.close(); checkColumnsAreUpdated(); s.close(); }
Example 3
Source File: UpdateXXXTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Tests calling updateLong on all columns of the row. * @exception SQLException database access error. Causes test to * fail with an error. */ public void testUpdateLong() throws SQLException { Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery(SELECT_STMT); rs.next(); for (int i = 1; i <= COLUMNS; i++) { rs.updateLong(i, 2L); assertEquals("Expected rs.getLong(" + i + ") to match updated value", 2L, rs.getLong(i)); } rs.updateRow(); rs.close(); checkColumnsAreUpdated(); s.close(); }
Example 4
Source File: UpdateXXXTest.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
/** * Tests calling updateLong on all columns of the row. * @exception SQLException database access error. Causes test to * fail with an error. */ public void testUpdateLong() throws SQLException { Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery(SELECT_STMT); rs.next(); for (int i = 1; i <= COLUMNS; i++) { rs.updateLong(i, 2L); assertEquals("Expected rs.getLong(" + i + ") to match updated value", 2L, rs.getLong(i)); } rs.updateRow(); rs.close(); checkColumnsAreUpdated(); s.close(); }
Example 5
Source File: QueryReader.java From sqlbuilder with Apache License 2.0 | 5 votes |
/** * Calls updateLong on the given ResultSet with the given value * for the position of this PlaceHolder. */ public void updateLong(long value, ResultSet rs) throws SQLException { if(isInQuery()) { rs.updateLong(getIndex(), value); } }
Example 6
Source File: ParameterMappingTest.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
private void assertUpdateState( ResultSet rs, String colName, long value, double dvalue, int updateType, String expected) throws SQLException { try { switch (updateType) { case XXX_BYTE: rs.updateByte(colName, (byte)value); break; case XXX_SHORT: rs.updateShort(colName, (short)value); case XXX_INT: rs.updateInt(colName, (int)value); break; case XXX_LONG: rs.updateLong(colName, value); break; case XXX_FLOAT: rs.updateFloat(colName, (float)dvalue); break; case XXX_DOUBLE: rs.updateDouble(colName, dvalue); break; default: fail("wrong argument"); } fail("exception expected"); } catch (SQLException e) { println(e.toString()); assertSQLState(expected, e); } }
Example 7
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateLongForColumnIndex() throws SQLException { for (ResultSet each : resultSets) { each.updateLong(1, 1L); } }
Example 8
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateLongForColumnLabel() throws SQLException { for (ResultSet each : resultSets) { each.updateLong("label", 1L); } }
Example 9
Source File: UnsupportedUpdateOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateLongForColumnIndex() throws SQLException { for (ResultSet each : resultSets) { each.updateLong(1, 1L); } }
Example 10
Source File: UnsupportedUpdateOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateLongForColumnLabel() throws SQLException { for (ResultSet each : resultSets) { each.updateLong("label", 1L); } }
Example 11
Source File: LobLimitsTest.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
private void updateClob2(String testId, PreparedStatement sel, int cloblen, int id, int updateRowId, int updateIdVal, String file) throws Exception { println("========================================"); println("START " + testId + " - select and then update clob of size= " + cloblen + " - Uses updateClob api"); PreparedStatement ps1 = prepareStatement("SELECT * FROM CLOBTBL FOR UPDATE", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); PreparedStatement ps = prepareStatement("SELECT CONTENT,DLEN FROM CLOBTBL2 " + "where ID =?"); ps.setInt(1, id); // retrieve row from clobtbl2 ResultSet rs = ps.executeQuery(); rs.next(); Clob value = rs.getClob(1); long l = value.length(); long dlen = rs.getLong(2); if (dlen != l) { println("FAIL - MISMATCH LENGTHS GOT " + l + " expected " + dlen + " for row in CLOBTBL2 with ID=" + id); } ResultSet rs1 = ps1.executeQuery(); while (rs1.next()) { if (rs1.getInt(1) == updateRowId) { rs1.updateClob(4, value); rs1.updateInt(1, updateIdVal); rs1.updateInt(2, 0); rs1.updateLong(3, dlen); rs1.updateRow(); break; } } commit(); // close resultsets rs.close(); rs1.close(); // verify // now select and verify that update went through ok. sel.setInt(1, updateIdVal); ResultSet rs2 = sel.executeQuery(); rs2.next(); Clob updatedValue = rs2.getClob(1); assertEquals("FAIL - MISMATCH length of updated clob value ," + "found=" + updatedValue.length() + ",expected = " + l, l, updatedValue.length()); compareClobToFile(updatedValue.getCharacterStream(), file, (int) l); if (updatedValue.length() != l) { println("FAIL - MISMATCH length of updated clob value ," + "found=" + updatedValue.length() + ",expected = " + l); } else compareClobToFile(updatedValue.getCharacterStream(), file, (int) l); println("========================================"); }
Example 12
Source File: SQLLongint.java From gemfirexd-oss with Apache License 2.0 | votes |
/** Set this value into a ResultSet for a subsequent ResultSet.insertRow or ResultSet.updateRow. This method will only be called for non-null values. @exception SQLException thrown by the ResultSet object */ public final void setInto(ResultSet rs, int position) throws SQLException { rs.updateLong(position, value); }
Example 13
Source File: SQLLongint.java From gemfirexd-oss with Apache License 2.0 | votes |
/** Set this value into a ResultSet for a subsequent ResultSet.insertRow or ResultSet.updateRow. This method will only be called for non-null values. @exception SQLException thrown by the ResultSet object */ public final void setInto(ResultSet rs, int position) throws SQLException { rs.updateLong(position, value); }
Example 14
Source File: SQLLongint.java From spliceengine with GNU Affero General Public License v3.0 | votes |
/** Set this value into a ResultSet for a subsequent ResultSet.insertRow or ResultSet.updateRow. This method will only be called for non-null values. @exception SQLException thrown by the ResultSet object */ public final void setInto(ResultSet rs, int position) throws SQLException { rs.updateLong(position, value); }