|
|
@ -141,14 +141,57 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
Assertions.assertEquals(chuck.length, resultSet.getBytes(10).length); |
|
|
|
Assertions.assertEquals(chuck.length, resultSet.getBytes(10).length); |
|
|
|
Assertions.assertEquals(chuck.length, resultSet.getBytes("testBlob").length); |
|
|
|
Assertions.assertEquals(chuck.length, resultSet.getBytes("testBlob").length); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InputStream in = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
in = resultSet.getBinaryStream("testBlob"); |
|
|
|
|
|
|
|
Assertions.assertEquals(chuck[0], in.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
in = resultSet.getBinaryStream(10); |
|
|
|
|
|
|
|
Assertions.assertEquals(chuck[0], in.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
in = resultSet.getAsciiStream(11); |
|
|
|
|
|
|
|
Assertions.assertEquals('a', in.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals(chuck[0], resultSet.getBinaryStream("testBlob").read()); |
|
|
|
try { |
|
|
|
Assertions.assertEquals(chuck[0], resultSet.getBinaryStream("testBlob").read()); |
|
|
|
in = resultSet.getAsciiStream("testClob"); |
|
|
|
|
|
|
|
Assertions.assertEquals('a', in.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
in = resultSet.getAsciiStream("testClob"); |
|
|
|
|
|
|
|
Assertions.assertEquals('a', in.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals('a', resultSet.getAsciiStream(11).read()); |
|
|
|
Reader reader = null; |
|
|
|
Assertions.assertEquals('a', resultSet.getAsciiStream("testClob").read()); |
|
|
|
|
|
|
|
Assertions.assertEquals('a', resultSet.getCharacterStream(11).read()); |
|
|
|
try { |
|
|
|
Assertions.assertEquals('a', resultSet.getCharacterStream("testClob").read()); |
|
|
|
reader = resultSet.getCharacterStream(11); |
|
|
|
|
|
|
|
Assertions.assertEquals('a', reader.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
reader.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
reader = resultSet.getCharacterStream("testClob"); |
|
|
|
|
|
|
|
Assertions.assertEquals('a', reader.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
reader.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertNull(resultSet.getCursorName()); |
|
|
|
Assertions.assertNull(resultSet.getCursorName()); |
|
|
|
Assertions.assertNotNull(resultSet.getMetaData()); |
|
|
|
Assertions.assertNotNull(resultSet.getMetaData()); |
|
|
@ -163,6 +206,8 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
String SQL_CREATE = "CREATE TABLE EMPLOYEE (NAME varchar(100));"; |
|
|
|
String SQL_CREATE = "CREATE TABLE EMPLOYEE (NAME varchar(100));"; |
|
|
|
|
|
|
|
|
|
|
|
Statement statement = connection.createStatement(); |
|
|
|
Statement statement = connection.createStatement(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
statement.execute("DROP TABLE IF EXISTS EMPLOYEE;"); |
|
|
|
statement.execute(SQL_CREATE); |
|
|
|
statement.execute(SQL_CREATE); |
|
|
|
statement.executeUpdate(SQL_INSERT); |
|
|
|
statement.executeUpdate(SQL_INSERT); |
|
|
|
ResultSet resultSet = statement.executeQuery("select * from EMPLOYEE"); |
|
|
|
ResultSet resultSet = statement.executeQuery("select * from EMPLOYEE"); |
|
|
@ -195,8 +240,28 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals(blob1.length(), blob2.length()); |
|
|
|
Assertions.assertEquals(blob1.length(), blob2.length()); |
|
|
|
Assertions.assertEquals(blob1.getBytes(1,1)[0], blob2.getBytes(1,1)[0]); |
|
|
|
Assertions.assertEquals(blob1.getBytes(1,1)[0], blob2.getBytes(1,1)[0]); |
|
|
|
Assertions.assertEquals(blob1.getBinaryStream().read(), blob2.getBinaryStream().read()); |
|
|
|
|
|
|
|
Assertions.assertEquals(blob1.getBinaryStream(1, 6).read(), blob2.getBinaryStream(1, 6).read()); |
|
|
|
InputStream in1 = null; |
|
|
|
|
|
|
|
InputStream in2 = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
in1 = blob1.getBinaryStream(); |
|
|
|
|
|
|
|
in2 = blob2.getBinaryStream(); |
|
|
|
|
|
|
|
Assertions.assertEquals(in1.read(), in2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in1.close(); |
|
|
|
|
|
|
|
in2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
in1 = blob1.getBinaryStream(1, 6); |
|
|
|
|
|
|
|
in2 = blob2.getBinaryStream(1, 6); |
|
|
|
|
|
|
|
Assertions.assertEquals(in1.read(), in2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
in1.close(); |
|
|
|
|
|
|
|
in2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ServiceBlob serviceBlob = (ServiceBlob) blob2; |
|
|
|
ServiceBlob serviceBlob = (ServiceBlob) blob2; |
|
|
|
String IDtoInvoke = serviceBlob.getID(); |
|
|
|
String IDtoInvoke = serviceBlob.getID(); |
|
|
@ -271,16 +336,48 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals(clob1.length(), clob2.length()); |
|
|
|
Assertions.assertEquals(clob1.length(), clob2.length()); |
|
|
|
Assertions.assertEquals(clob1.getSubString(1,2), clob1.getSubString(1,2)); |
|
|
|
Assertions.assertEquals(clob1.getSubString(1,2), clob1.getSubString(1,2)); |
|
|
|
Assertions.assertEquals(clob1.getCharacterStream().read(), clob2.getCharacterStream().read()); |
|
|
|
|
|
|
|
Assertions.assertEquals(clob1.getCharacterStream(1, 2).read(), clob2.getCharacterStream(1, 2).read()); |
|
|
|
Reader r1 = null; |
|
|
|
Assertions.assertEquals(clob1.getCharacterStream().read(), clob2.getCharacterStream().read()); |
|
|
|
Reader r2 = null; |
|
|
|
Assertions.assertEquals(clob1.getCharacterStream(1, 2).read(), clob2.getCharacterStream(1, 2).read()); |
|
|
|
try{ |
|
|
|
|
|
|
|
r1 = clob1.getCharacterStream(); |
|
|
|
|
|
|
|
r2 = clob2.getCharacterStream(); |
|
|
|
|
|
|
|
Assertions.assertEquals(r1.read(), r2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
r1.close(); |
|
|
|
|
|
|
|
r2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
r1 = clob1.getCharacterStream(1, 2); |
|
|
|
|
|
|
|
r2 = clob2.getCharacterStream(1, 2); |
|
|
|
|
|
|
|
Assertions.assertEquals(r1.read(), r2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
r1.close(); |
|
|
|
|
|
|
|
r2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
r1 = clob1.getCharacterStream(); |
|
|
|
|
|
|
|
r2 = clob2.getCharacterStream(); |
|
|
|
|
|
|
|
Assertions.assertEquals(r1.read(), r2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
r1.close(); |
|
|
|
|
|
|
|
r2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
r1 = clob1.getCharacterStream(1, 2); |
|
|
|
|
|
|
|
r2 = clob2.getCharacterStream(1, 2); |
|
|
|
|
|
|
|
Assertions.assertEquals(r1.read(), r2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
r1.close(); |
|
|
|
|
|
|
|
r2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals(clob1.position("abcd", 1), clob2.position("abcd", 1)); |
|
|
|
Assertions.assertEquals(clob1.position("abcd", 1), clob2.position("abcd", 1)); |
|
|
|
Assertions.assertEquals(clob1.position(clob1, 1), clob2.position(clob1, 1)); |
|
|
|
Assertions.assertEquals(clob1.position(clob1, 1), clob2.position(clob1, 1)); |
|
|
|
|
|
|
|
|
|
|
|
clob2.getCharacterStream().close(); |
|
|
|
|
|
|
|
clob2.getAsciiStream().close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ServiceClob serviceClob = (ServiceClob) clob2; |
|
|
|
ServiceClob serviceClob = (ServiceClob) clob2; |
|
|
|
String IDtoInvoke = serviceClob.getID(); |
|
|
|
String IDtoInvoke = serviceClob.getID(); |
|
|
|
DispatcherImpl dispatcher = agent.dispatcherImpl; |
|
|
|
DispatcherImpl dispatcher = agent.dispatcherImpl; |
|
|
@ -376,7 +473,7 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@Disabled("hsql not support") |
|
|
|
@Disabled("hsql not support struct") |
|
|
|
public void testStruct() throws SQLException { |
|
|
|
public void testStruct() throws SQLException { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -401,19 +498,30 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals(nClob1.length(), nClob2.length()); |
|
|
|
Assertions.assertEquals(nClob1.length(), nClob2.length()); |
|
|
|
Assertions.assertEquals(nClob1.getSubString(1,2), nClob2.getSubString(1,2)); |
|
|
|
Assertions.assertEquals(nClob1.getSubString(1,2), nClob2.getSubString(1,2)); |
|
|
|
nClob1.getCharacterStream().read(); |
|
|
|
|
|
|
|
Reader reader = nClob2.getCharacterStream(); |
|
|
|
Reader r1 = null; |
|
|
|
reader.read(); |
|
|
|
Reader r2 = null; |
|
|
|
// Assertions.assertEquals(nClob1.getCharacterStream().read(), nClob2.getCharacterStream().read());
|
|
|
|
try{ |
|
|
|
Assertions.assertEquals(nClob1.getCharacterStream(1, 2).read(), nClob2.getCharacterStream(1, 2).read()); |
|
|
|
r1 = nClob1.getCharacterStream(); |
|
|
|
Assertions.assertEquals(nClob1.getCharacterStream().read(), nClob2.getCharacterStream().read()); |
|
|
|
r2 = nClob2.getCharacterStream(); |
|
|
|
Assertions.assertEquals(nClob1.getCharacterStream(1, 2).read(), nClob2.getCharacterStream(1, 2).read()); |
|
|
|
Assertions.assertEquals(r1.read(), r2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
r1.close(); |
|
|
|
|
|
|
|
r2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
r1 = nClob1.getCharacterStream(1, 2); |
|
|
|
|
|
|
|
r2 = nClob2.getCharacterStream(1, 2); |
|
|
|
|
|
|
|
Assertions.assertEquals(r1.read(), r2.read()); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
r1.close(); |
|
|
|
|
|
|
|
r2.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Assertions.assertEquals(nClob1.position("abcd", 1), nClob2.position("abcd", 1)); |
|
|
|
Assertions.assertEquals(nClob1.position("abcd", 1), nClob2.position("abcd", 1)); |
|
|
|
Assertions.assertEquals(nClob1.position(nClob1, 1), nClob2.position(nClob1, 1)); |
|
|
|
Assertions.assertEquals(nClob1.position(nClob1, 1), nClob2.position(nClob1, 1)); |
|
|
|
|
|
|
|
|
|
|
|
nClob2.getCharacterStream().close(); |
|
|
|
|
|
|
|
nClob2.getAsciiStream().close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ServiceNClob serviceNClob = (ServiceNClob) nClob2; |
|
|
|
ServiceNClob serviceNClob = (ServiceNClob) nClob2; |
|
|
|
String IDtoInvoke = serviceNClob.getID(); |
|
|
|
String IDtoInvoke = serviceNClob.getID(); |
|
|
|
DispatcherImpl dispatcher = agent.dispatcherImpl; |
|
|
|
DispatcherImpl dispatcher = agent.dispatcherImpl; |
|
|
@ -461,4 +569,9 @@ public class ResultSetTest extends BaseJDBCTest{ |
|
|
|
); |
|
|
|
); |
|
|
|
closeSQLObjects(statement, prepareStatement); |
|
|
|
closeSQLObjects(statement, prepareStatement); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AfterAll |
|
|
|
|
|
|
|
void tearDown() throws SQLException{ |
|
|
|
|
|
|
|
closeSQLObjects(connection, resultSet); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|