BlobRegressionTest.java 文件源码

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

项目:the-vigilantes 作者:
/**
 * Tests fix for BUG#20453671 - CLOB.POSITION() API CALL WITH CLOB INPUT RETURNS EXCEPTION
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20453671() throws Exception {
    this.rs = this.stmt.executeQuery("select 'abcd', 'a', 'b', 'c', 'd', 'e'");
    this.rs.next();

    final Clob in = this.rs.getClob(1);
    final ResultSet locallyScopedRs = this.rs;
    assertThrows(SQLException.class, "Illegal starting position for search, '0'", new Callable<Void>() {
        public Void call() throws Exception {
            in.position(locallyScopedRs.getClob(2), 0);
            return null;
        }
    });
    assertThrows(SQLException.class, "Starting position for search is past end of CLOB", new Callable<Void>() {
        public Void call() throws Exception {
            in.position(locallyScopedRs.getClob(2), 10);
            return null;
        }
    });

    assertEquals(1, in.position(this.rs.getClob(2), 1));
    assertEquals(2, in.position(this.rs.getClob(3), 1));
    assertEquals(3, in.position(this.rs.getClob(4), 1));
    assertEquals(4, in.position(this.rs.getClob(5), 1));
    assertEquals(-1, in.position(this.rs.getClob(6), 1));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号