Package java.sql

Examples of java.sql.CallableStatement.unwrap()


        {
            Connection conn = dataSource.getConnection();

            CallableStatement stmt = conn.prepareCall("select 1");
            stmt.execute();
            rawStmt = stmt.unwrap(MockCallableStatement.class);

            ResultSet rs = (ResultSet) stmt.getObject(0);
           
            rawRs = rs.unwrap(MockResultSet.class);
           
View Full Code Here


            Connection conn = dataSource.getConnection();

            CallableStatement stmt = conn.prepareCall("select 1");
            stmt.execute();

            Assert.assertSame(rawStmt, stmt.unwrap(MockCallableStatement.class));
            Assert.assertFalse(rawStmt.isClosed());

            stmt.getObject(0);

            ResultSet rs = (ResultSet) stmt.getObject(0);
View Full Code Here

        final String PARAM_VALUE = "中国";
        CallableStatement stmt = conn.prepareCall("select ?");
        stmt.setString(1, PARAM_VALUE);

        MockCallableStatement raw = stmt.unwrap(MockCallableStatement.class);

        stmt.execute();
        String param1 = (String) raw.getParameters().get(0);

        String C_TEXT = new String(param1.getBytes(SERVER_ENCODING), CLIENT_ENCODING);
View Full Code Here

    public void test_wrap() throws Exception {

        Connection conn = dataSource.getConnection();
        CallableStatement stmt = conn.prepareCall("select 1");

        Assert.assertNotNull(stmt.unwrap(CallableStatement.class));
        Assert.assertEquals(MockCallableStatement.class, stmt.unwrap(CallableStatement.class).getClass());

        stmt.close();
        conn.close();
    }
View Full Code Here

        Connection conn = dataSource.getConnection();
        CallableStatement stmt = conn.prepareCall("select 1");

        Assert.assertNotNull(stmt.unwrap(CallableStatement.class));
        Assert.assertEquals(MockCallableStatement.class, stmt.unwrap(CallableStatement.class).getClass());

        stmt.close();
        conn.close();
    }
View Full Code Here

    public void test_wrap_1() throws Exception {

        Connection conn = dataSource.getConnection();
        CallableStatement stmt = conn.prepareCall("select 1");

        Assert.assertNotNull(stmt.unwrap(PreparedStatement.class));
        Assert.assertEquals(MockCallableStatement.class, stmt.unwrap(CallableStatement.class).getClass());

        stmt.close();
        conn.close();
    }
View Full Code Here

        Connection conn = dataSource.getConnection();
        CallableStatement stmt = conn.prepareCall("select 1");

        Assert.assertNotNull(stmt.unwrap(PreparedStatement.class));
        Assert.assertEquals(MockCallableStatement.class, stmt.unwrap(CallableStatement.class).getClass());

        stmt.close();
        conn.close();
    }
View Full Code Here

        dataSource.getProxyFilters().clear();

        Connection conn = dataSource.getConnection();
        CallableStatement stmt = conn.prepareCall("select 1");

        Assert.assertNotNull(stmt.unwrap(PreparedStatement.class));
        Assert.assertEquals(MockCallableStatement.class, stmt.unwrap(CallableStatement.class).getClass());

        stmt.close();
        conn.close();
    }
View Full Code Here

        Connection conn = dataSource.getConnection();
        CallableStatement stmt = conn.prepareCall("select 1");

        Assert.assertNotNull(stmt.unwrap(PreparedStatement.class));
        Assert.assertEquals(MockCallableStatement.class, stmt.unwrap(CallableStatement.class).getClass());

        stmt.close();
        conn.close();
    }
}
View Full Code Here

        Assert.assertEquals(true, rs.isClosed());

        CallableStatement stmt2 = conn.prepareCall(sql);
        Assert.assertEquals(true, stmt.isClosed());

        Assert.assertEquals(stmt.unwrap(MockStatement.class), stmt2.unwrap(MockStatement.class));

        conn.close();

        Assert.assertEquals(true, stmt.isClosed());
        Assert.assertEquals(true, rs.isClosed());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.