ResultSetRegressionTest.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:BibliotecaPS 作者:
/**
 * Tests for fix to BUG#1130
 * 
 * @throws Exception
 *             if the test fails
 */
public void testClobTruncate() throws Exception {
    createTable("testClobTruncate", "(field1 TEXT)");
    this.stmt.executeUpdate("INSERT INTO testClobTruncate VALUES ('abcdefg')");

    this.rs = this.stmt.executeQuery("SELECT * FROM testClobTruncate");
    this.rs.next();

    Clob clob = this.rs.getClob(1);
    clob.truncate(3);

    Reader reader = clob.getCharacterStream();
    char[] buf = new char[8];
    int charsRead = reader.read(buf);

    String clobAsString = new String(buf, 0, charsRead);

    assertTrue(clobAsString.equals("abc"));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号