You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Manjula Kutty <ma...@gmail.com> on 2007/03/20 20:01:45 UTC
Question about a good place to add a test for rs.getString() on a blob and clob
Hi Kathey,
Here is the code snippet from CsPrepStmt.java test which is not included in
the PrepareStatementTest.java. But when I went through the
ParamterMappingTest.java I felt that the same scenario is covered there, but
in a different way. Am I correct? If not which test is the good place to add
this particular test?
static void testLobInRS(Connection conn) {
// Create test objects.
try {
Statement st = conn.createStatement();
// Clob.
st.execute("create table lobCheckOne (c clob(30))");
st.execute("insert into lobCheckOne values (cast " +
"('yayorsomething' as clob(30)))");
// Blob.
st.execute("create table lobCheckTwo (b blob(30))");
st.execute("insert into lobCheckTwo values (cast " + "( "+
TestUtil.stringToHexLiteral("101010001101") +
" as blob(30)))");
} catch (SQLException e) {
System.out.println("FAIL: Couldn't create required objects:");
e.printStackTrace();
return;
}
try {
// Clobs.
System.out.println("CLOB result.");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from lobCheckOne");
if (rs.next())
System.out.println("GOT ROW: " + rs.getString(1));
else
System.out.println("FAIL: Statement executed, but returned " +
"an empty result set.");
// Blobs.
System.out.println("BLOB result.");
st = conn.createStatement();
rs = st.executeQuery("select * from lobCheckTwo");
if (rs.next())
System.out.println("GOT ROW: " + rs.getString(1));
else
System.out.println("FAIL: Statement executed, but returned " +
"an empty result set.");
rs.close();
st.close();
} catch (Exception e) {
System.out.println("FAIL: Encountered exception:");
e.printStackTrace();
return;
}
return;
}
--
Thanks,
Manjula.
Re: Question about a good place to add a test for rs.getString()
on a blob and clob
Posted by Kathey Marsden <km...@sbcglobal.net>.
Manjula Kutty wrote:
>
> Hi Kathey,
>
> Here is the code snippet from CsPrepStmt.java test which is not
> included in the PrepareStatementTest.java. But when I went through the
> ParamterMappingTest.java I felt that the same scenario is covered
> there, but in a different way. Am I correct?
>
I also think this is covered in ParameterMappingTest when getXXX is
called on the various types.