Author: kahatlen
Date: Wed Jun 28 02:35:50 2006
New Revision: 417705
URL: http://svn.apache.org/viewvc?rev=417705&view=rev
Log:
DERBY-1445: Add new streaming overloads and modify some existing ones.
Fix test issues. Patch submitted by V. Narayanan.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java?rev=417705&r1=417704&r2=417705&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
Wed Jun 28 02:35:50 2006
@@ -545,6 +545,8 @@
public void testSetCharacterStream() throws SQLException {
try {
cStmt.setCharacterStream("Some String",null,0L);
+ fail("CallableStatement.setCharacterStream() " +
+ "should not be implemented");
}
catch(SQLFeatureNotSupportedException sqlfne) {
//Do nothing as this is the expected behaviour
@@ -565,6 +567,8 @@
public void testSetAsciiStream() throws SQLException {
try {
cStmt.setAsciiStream("Some String",null,0L);
+ fail("CallableStatement.setAsciiStream() " +
+ "should not be implemented");
}
catch(SQLFeatureNotSupportedException sqlfne) {
//Do nothing as this is the expected behaviour
@@ -585,6 +589,8 @@
public void testSetBinaryStream() throws SQLException {
try {
cStmt.setBinaryStream("Some String",null,0L);
+ fail("CallableStatement.setBinaryStream() " +
+ "should not be implemented");
}
catch(SQLFeatureNotSupportedException sqlfne) {
//Do nothing as this is the expected behaviour
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java?rev=417705&r1=417704&r2=417705&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
Wed Jun 28 02:35:50 2006
@@ -539,15 +539,11 @@
* @throws SQLException
*
*/
- public void testSetCharacterStream() throws SQLException {
+ public void testSetCharacterStream() throws Exception {
String str = "Test data for the Clob object";
StringReader is = new StringReader("Test data for the Clob object");
- try {
- is.reset();
- } catch (IOException ioe) {
- fail("Failed to reset Clob input stream: " + ioe.getMessage());
- }
+ is.reset();
PreparedStatement ps_sc = conn.prepareStatement("insert into ClobTestTable values(?,?)");
@@ -576,7 +572,7 @@
*
*/
- public void testSetAsciiStream() throws SQLException {
+ public void testSetAsciiStream() throws Exception {
//insert default values into the table
byte[] bytes = new byte[] {
@@ -588,11 +584,7 @@
InputStream is = new java.io.ByteArrayInputStream(bytes);
- try {
- is.reset();
- } catch (IOException ioe) {
- fail("Failed to reset Clob input stream: " + ioe.getMessage());
- }
+ is.reset();
PreparedStatement ps_sb = conn.prepareStatement("insert into ClobTestTable values(?,?)");
@@ -627,7 +619,7 @@
*
*/
- public void testSetBinaryStream() throws SQLException {
+ public void testSetBinaryStream() throws Exception {
//insert default values into the table
byte[] bytes = new byte[] {
@@ -639,11 +631,7 @@
InputStream is = new java.io.ByteArrayInputStream(bytes);
- try {
- is.reset();
- } catch (IOException ioe) {
- fail("Failed to reset blob input stream: " + ioe.getMessage());
- }
+ is.reset();
PreparedStatement ps_sb = conn.prepareStatement("insert into BlobTestTable values(?,?)");
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java?rev=417705&r1=417704&r2=417705&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
Wed Jun 28 02:35:50 2006
@@ -261,7 +261,7 @@
*/
public void testUpdateBinaryStream()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol LONG VARCHAR FOR BIT DATA)");
@@ -322,12 +322,8 @@
rs1.next();
InputStream is_ret = rs1.getBinaryStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes_for_update.length;i++) {
assertEquals("Error in updateBinaryStream",bytes_for_update[i],bytes_ret[i]);
@@ -345,7 +341,7 @@
*/
public void testUpdateAsciiStream()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol LONG VARCHAR)");
@@ -406,12 +402,8 @@
rs1.next();
InputStream is_ret = rs1.getAsciiStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes_for_update.length;i++) {
assertEquals("Error in updateAsciiStream",bytes_for_update[i],bytes_ret[i]);
@@ -429,7 +421,7 @@
*/
public void testUpdateCharacterStream()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol LONG VARCHAR)");
@@ -471,12 +463,7 @@
char [] c_ret = new char[str_for_update.length()];
- try {
- r_ret.read(c_ret);
- }
- catch(IOException ioe) {
- fail("Error in reading the InputStream");
- }
+ r_ret.read(c_ret);
String str_ret = new String(c_ret);
@@ -498,7 +485,7 @@
*/
public void testUpdateBinaryStreamStringParameterName()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol LONG VARCHAR FOR BIT DATA)");
@@ -560,12 +547,8 @@
rs1.next();
InputStream is_ret = rs1.getBinaryStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes_for_update.length;i++) {
assertEquals("Error in updateBinaryStream",bytes_for_update[i],bytes_ret[i]);
@@ -583,7 +566,7 @@
*/
public void testUpdateAsciiStreamStringParameterName()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol LONG VARCHAR)");
@@ -644,12 +627,8 @@
rs1.next();
InputStream is_ret = rs1.getAsciiStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes_for_update.length;i++) {
assertEquals("Error in updateAsciiStream",bytes_for_update[i],bytes_ret[i]);
@@ -667,7 +646,7 @@
*/
public void testUpdateCharacterStreamStringParameterName()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol LONG VARCHAR)");
@@ -709,12 +688,7 @@
char [] c_ret = new char[str_for_update.length()];
- try {
- r_ret.read(c_ret);
- }
- catch(IOException ioe) {
- fail("Error in reading the InputStream");
- }
+ r_ret.read(c_ret);
String str_ret = new String(c_ret);
@@ -734,7 +708,7 @@
* @throws SQLException if some error occurs while calling the method
*/
public void embeddedUpdateClob()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol Clob)");
@@ -810,12 +784,8 @@
rs1.next();
InputStream is_ret = rs1.getAsciiStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes1.length;i++) {
assertEquals("Error in updateAsciiStream",bytes1[i],bytes_ret[i]);
@@ -832,7 +802,7 @@
* @throws SQLException if some error occurs while calling the method
*/
public void embeddedUpdateBlob()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol Blob)");
@@ -908,12 +878,8 @@
rs1.next();
InputStream is_ret = rs1.getBinaryStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes1.length;i++) {
assertEquals("Error in updateBlob",bytes1[i],bytes_ret[i]);
@@ -930,7 +896,7 @@
* @throws SQLException if some error occurs while calling the method
*/
public void embeddedUpdateClobStringParameterName()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol Clob)");
@@ -1006,12 +972,8 @@
rs1.next();
InputStream is_ret = rs1.getAsciiStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes1.length;i++) {
assertEquals("Error in updateAsciiStream",bytes1[i],bytes_ret[i]);
@@ -1028,7 +990,7 @@
* @throws SQLException if some error occurs while calling the method
*/
public void embeddedUpdateBlobStringParameterName()
- throws SQLException {
+ throws Exception {
//create the table
stmt.execute("create table UpdateTestTable_ResultSet (sno int, " +
"datacol Blob)");
@@ -1104,12 +1066,8 @@
rs1.next();
InputStream is_ret = rs1.getBinaryStream(2);
- try {
- is_ret.read(bytes_ret);
- is_ret.close();
- } catch(IOException ioe) {
- fail("Error in the InputStream");
- }
+ is_ret.read(bytes_ret);
+ is_ret.close();
for(int i=0;i<bytes1.length;i++) {
assertEquals("Error in updateBlob",bytes1[i],bytes_ret[i]);
|