Java Code Examples for java.sql.ResultSet#updateAsciiStream()
The following examples show how to use
java.sql.ResultSet#updateAsciiStream() .
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: ResultSetTest.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
public void testUpdateAsciiStreamLengthlessParameterName() throws IOException, SQLException { // Array to keep updated data fetched from the database. byte[] bytesRet = new byte[10]; // Input Stream inserted initially. InputStream is = new java.io.ByteArrayInputStream(BYTES1); // InputStream that is used for update. InputStream isForUpdate = new java.io.ByteArrayInputStream(BYTES2); // Prepared Statement used to insert the data. PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2, is, BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); // Update the data. ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream("dLongVarchar", isForUpdate); rs1.updateRow(); rs1.close(); // Query to see whether the data that has been updated. rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream isRet = rs1.getAsciiStream(1); isRet.read(bytesRet); isRet.close(); for (int i=0; i < BYTES2.length; i++) { assertEquals("Error in updateAsciiStream", BYTES2[i], bytesRet[i]); } rs1.close(); }
Example 2
Source File: ResultSetTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void testUpdateAsciiStreamLengthless() throws IOException, SQLException { // Array to keep updated data fetched from the database. byte[] bytesRet = new byte[10]; // Input Stream inserted initially. InputStream is = new java.io.ByteArrayInputStream(BYTES1); // InputStream that is used for update. InputStream isForUpdate = new java.io.ByteArrayInputStream(BYTES2); // Prepared Statement used to insert the data. PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2, is, BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); // Update the data. ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream(1, isForUpdate); rs1.updateRow(); rs1.close(); // Query to see whether the data that has been updated. rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream isRet = rs1.getAsciiStream(1); isRet.read(bytesRet); isRet.close(); for (int i=0; i < BYTES2.length; i++) { assertEquals("Error in updateAsciiStream", BYTES2[i], bytesRet[i]); } rs1.close(); }
Example 3
Source File: ResultSetTest.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
public void testUpdateAsciiStreamLengthless() throws IOException, SQLException { // Array to keep updated data fetched from the database. byte[] bytesRet = new byte[10]; // Input Stream inserted initially. InputStream is = new java.io.ByteArrayInputStream(BYTES1); // InputStream that is used for update. InputStream isForUpdate = new java.io.ByteArrayInputStream(BYTES2); // Prepared Statement used to insert the data. PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2, is, BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); // Update the data. ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream(1, isForUpdate); rs1.updateRow(); rs1.close(); // Query to see whether the data that has been updated. rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream isRet = rs1.getAsciiStream(1); isRet.read(bytesRet); isRet.close(); for (int i=0; i < BYTES2.length; i++) { assertEquals("Error in updateAsciiStream", BYTES2[i], bytesRet[i]); } rs1.close(); }
Example 4
Source File: ResultSetTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void testUpdateAsciiStreamLengthless() throws IOException, SQLException { // Array to keep updated data fetched from the database. byte[] bytesRet = new byte[10]; // Input Stream inserted initially. InputStream is = new java.io.ByteArrayInputStream(BYTES1); // InputStream that is used for update. InputStream isForUpdate = new java.io.ByteArrayInputStream(BYTES2); // Prepared Statement used to insert the data. PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2, is, BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); // Update the data. ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream(1, isForUpdate); rs1.updateRow(); rs1.close(); // Query to see whether the data that has been updated. rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream isRet = rs1.getAsciiStream(1); isRet.read(bytesRet); isRet.close(); for (int i=0; i < BYTES2.length; i++) { assertEquals("Error in updateAsciiStream", BYTES2[i], bytesRet[i]); } rs1.close(); }
Example 5
Source File: UnsupportedUpdateOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnIndex() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream(1, System.in); } }
Example 6
Source File: ResultSetTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * This methods tests the ResultSet interface method * updateAsciiStream * * @throws SQLException if some error occurs while calling the method */ public void testUpdateAsciiStreamStringParameterName() throws Exception { //Byte array in which the returned bytes from //the Database after the update are stored. This //array is then checked to determine if it //has the same elements of the Byte array used for //the update operation byte[] bytes_ret = new byte[10]; //Input Stream inserted initially InputStream is = new java.io.ByteArrayInputStream(BYTES1); //InputStream that is used for update InputStream is_for_update = new java.io.ByteArrayInputStream(BYTES2); //Prepared Statement used to insert the data PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2,is,BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); //Update operation //use a different ResultSet variable so that the //other tests can go on unimpacted ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream("dLongVarchar",is_for_update,(int)BYTES2.length); rs1.updateRow(); rs1.close(); //Query to see whether the data that has been updated //using the updateAsciiStream method is the same //data that we expected rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream is_ret = rs1.getAsciiStream(1); is_ret.read(bytes_ret); is_ret.close(); for(int i=0;i<BYTES2.length;i++) { assertEquals("Error in updateAsciiStream",BYTES2[i],bytes_ret[i]); } rs1.close(); }
Example 7
Source File: ResultSetTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * This methods tests the ResultSet interface method * updateAsciiStream * * @throws SQLException if some error occurs while calling the method */ public void testUpdateAsciiStream() throws Exception { //create the table stmt.execute("create table UpdateTestTable_ResultSet (sno int, " + "datacol LONG VARCHAR)"); //Byte array in which the returned bytes from //the Database after the update are stored. This //array is then checked to determine if it //has the same elements of the Byte array used for //the update operation byte[] bytes_ret = new byte[10]; //Input Stream inserted initially InputStream is = new java.io.ByteArrayInputStream(BYTES1); //InputStream that is used for update InputStream is_for_update = new java.io.ByteArrayInputStream(BYTES2); //Prepared Statement used to insert the data PreparedStatement ps_sb = prepareStatement ("insert into UpdateTestTable_ResultSet values(?,?)"); ps_sb.setInt(1,1); ps_sb.setAsciiStream(2,is,BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); //Update operation //use a different ResultSet variable so that the //other tests can go on unimpacted ResultSet rs1 = stmt.executeQuery ("select * from UpdateTestTable_ResultSet for update"); rs1.next(); rs1.updateAsciiStream(2,is_for_update,(int)BYTES2.length); rs1.updateRow(); rs1.close(); //Query to see whether the data that has been updated //using the updateAsciiStream method is the same //data that we expected rs1 = stmt.executeQuery ("select * from UpdateTestTable_ResultSet"); rs1.next(); InputStream is_ret = rs1.getAsciiStream(2); is_ret.read(bytes_ret); is_ret.close(); for(int i=0;i<BYTES2.length;i++) { assertEquals("Error in updateAsciiStream",BYTES2[i],bytes_ret[i]); } rs1.close(); //delete the table stmt .execute("drop table UpdateTestTable_ResultSet"); }
Example 8
Source File: UnsupportedUpdateOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnLabelWithLongLength() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream("label", System.in, 1L); } }
Example 9
Source File: ResultSetTest.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
/** * This methods tests the ResultSet interface method * updateAsciiStream * * @throws SQLException if some error occurs while calling the method */ public void testUpdateAsciiStream() throws Exception { //create the table stmt.execute("create table UpdateTestTable_ResultSet (sno int, " + "datacol LONG VARCHAR)"); //Byte array in which the returned bytes from //the Database after the update are stored. This //array is then checked to determine if it //has the same elements of the Byte array used for //the update operation byte[] bytes_ret = new byte[10]; //Input Stream inserted initially InputStream is = new java.io.ByteArrayInputStream(BYTES1); //InputStream that is used for update InputStream is_for_update = new java.io.ByteArrayInputStream(BYTES2); //Prepared Statement used to insert the data PreparedStatement ps_sb = prepareStatement ("insert into UpdateTestTable_ResultSet values(?,?)"); ps_sb.setInt(1,1); ps_sb.setAsciiStream(2,is,BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); //Update operation //use a different ResultSet variable so that the //other tests can go on unimpacted ResultSet rs1 = stmt.executeQuery ("select * from UpdateTestTable_ResultSet for update"); rs1.next(); rs1.updateAsciiStream(2,is_for_update,(int)BYTES2.length); rs1.updateRow(); rs1.close(); //Query to see whether the data that has been updated //using the updateAsciiStream method is the same //data that we expected rs1 = stmt.executeQuery ("select * from UpdateTestTable_ResultSet"); rs1.next(); InputStream is_ret = rs1.getAsciiStream(2); is_ret.read(bytes_ret); is_ret.close(); for(int i=0;i<BYTES2.length;i++) { assertEquals("Error in updateAsciiStream",BYTES2[i],bytes_ret[i]); } rs1.close(); //delete the table stmt .execute("drop table UpdateTestTable_ResultSet"); }
Example 10
Source File: UnsupportedUpdateOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnIndexWithIntegerLength() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream(1, System.in, 1); } }
Example 11
Source File: UnsupportedUpdateOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnLabel() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream("label", System.in); } }
Example 12
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnIndex() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream(1, System.in); } }
Example 13
Source File: ResultSetTest.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
/** * This methods tests the ResultSet interface method * updateAsciiStream * * @throws SQLException if some error occurs while calling the method */ public void testUpdateAsciiStreamStringParameterName() throws Exception { //Byte array in which the returned bytes from //the Database after the update are stored. This //array is then checked to determine if it //has the same elements of the Byte array used for //the update operation byte[] bytes_ret = new byte[10]; //Input Stream inserted initially InputStream is = new java.io.ByteArrayInputStream(BYTES1); //InputStream that is used for update InputStream is_for_update = new java.io.ByteArrayInputStream(BYTES2); //Prepared Statement used to insert the data PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2,is,BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); //Update operation //use a different ResultSet variable so that the //other tests can go on unimpacted ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream("dLongVarchar",is_for_update,(int)BYTES2.length); rs1.updateRow(); rs1.close(); //Query to see whether the data that has been updated //using the updateAsciiStream method is the same //data that we expected rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream is_ret = rs1.getAsciiStream(1); is_ret.read(bytes_ret); is_ret.close(); for(int i=0;i<BYTES2.length;i++) { assertEquals("Error in updateAsciiStream",BYTES2[i],bytes_ret[i]); } rs1.close(); }
Example 14
Source File: ResultSetTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * This methods tests the ResultSet interface method * updateAsciiStream * * @throws SQLException if some error occurs while calling the method */ public void testUpdateAsciiStreamStringParameterName() throws Exception { //Byte array in which the returned bytes from //the Database after the update are stored. This //array is then checked to determine if it //has the same elements of the Byte array used for //the update operation byte[] bytes_ret = new byte[10]; //Input Stream inserted initially InputStream is = new java.io.ByteArrayInputStream(BYTES1); //InputStream that is used for update InputStream is_for_update = new java.io.ByteArrayInputStream(BYTES2); //Prepared Statement used to insert the data PreparedStatement ps_sb = prep("dLongVarchar"); ps_sb.setInt(1, key); ps_sb.setAsciiStream(2,is,BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); //Update operation //use a different ResultSet variable so that the //other tests can go on unimpacted ResultSet rs1 = fetchUpd("dLongVarchar", key); rs1.next(); rs1.updateAsciiStream("dLongVarchar",is_for_update,(int)BYTES2.length); rs1.updateRow(); rs1.close(); //Query to see whether the data that has been updated //using the updateAsciiStream method is the same //data that we expected rs1 = fetch("dLongVarchar", key); rs1.next(); InputStream is_ret = rs1.getAsciiStream(1); is_ret.read(bytes_ret); is_ret.close(); for(int i=0;i<BYTES2.length;i++) { assertEquals("Error in updateAsciiStream",BYTES2[i],bytes_ret[i]); } rs1.close(); }
Example 15
Source File: ResultSetTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * This methods tests the ResultSet interface method * updateAsciiStream * * @throws SQLException if some error occurs while calling the method */ public void testUpdateAsciiStream() throws Exception { //create the table stmt.execute("create table UpdateTestTable_ResultSet (sno int, " + "datacol LONG VARCHAR)"); //Byte array in which the returned bytes from //the Database after the update are stored. This //array is then checked to determine if it //has the same elements of the Byte array used for //the update operation byte[] bytes_ret = new byte[10]; //Input Stream inserted initially InputStream is = new java.io.ByteArrayInputStream(BYTES1); //InputStream that is used for update InputStream is_for_update = new java.io.ByteArrayInputStream(BYTES2); //Prepared Statement used to insert the data PreparedStatement ps_sb = prepareStatement ("insert into UpdateTestTable_ResultSet values(?,?)"); ps_sb.setInt(1,1); ps_sb.setAsciiStream(2,is,BYTES1.length); ps_sb.executeUpdate(); ps_sb.close(); //Update operation //use a different ResultSet variable so that the //other tests can go on unimpacted ResultSet rs1 = stmt.executeQuery ("select * from UpdateTestTable_ResultSet for update"); rs1.next(); rs1.updateAsciiStream(2,is_for_update,(int)BYTES2.length); rs1.updateRow(); rs1.close(); //Query to see whether the data that has been updated //using the updateAsciiStream method is the same //data that we expected rs1 = stmt.executeQuery ("select * from UpdateTestTable_ResultSet"); rs1.next(); InputStream is_ret = rs1.getAsciiStream(2); is_ret.read(bytes_ret); is_ret.close(); for(int i=0;i<BYTES2.length;i++) { assertEquals("Error in updateAsciiStream",BYTES2[i],bytes_ret[i]); } rs1.close(); //delete the table stmt .execute("drop table UpdateTestTable_ResultSet"); }
Example 16
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnLabelWithLongLength() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream("label", System.in, 1L); } }
Example 17
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnIndexWithLongLength() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream(1, System.in, 1L); } }
Example 18
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnLabelWithIntegerLength() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream("label", System.in, 1); } }
Example 19
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnIndexWithIntegerLength() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream(1, System.in, 1); } }
Example 20
Source File: UnsupportedUpdateOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertUpdateAsciiStreamForColumnLabel() throws SQLException { for (ResultSet each : resultSets) { each.updateAsciiStream("label", System.in); } }