db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manjula Kutty" <manjula.ku...@gmail.com>
Subject Question about a good place to add a test for rs.getString() on a blob and clob
Date Tue, 20 Mar 2007 19:01:45 GMT
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.

Mime
View raw message