Package java.sql

Examples of java.sql.PreparedStatement.unwrap()


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

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

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

        Assert.assertEquals(PARAM_VALUE, new String(param1.getBytes(SERVER_ENCODING), CLIENT_ENCODING));
        Assert.assertFalse(param1.equals(PARAM_VALUE));
View Full Code Here


        MockPreparedStatement raw;
        {
            Connection conn = dataSource.getConnection();
            PreparedStatement stmt = conn.prepareStatement("SELECT ?");
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.execute();
            stmt.close();
            conn.close();
        }
View Full Code Here

        }

        {
            Connection conn = dataSource.getConnection();
            PreparedStatement stmt = conn.prepareStatement("SELECT ?");
            Assert.assertTrue(raw == stmt.unwrap(MockPreparedStatement.class));
            stmt.execute();
            stmt.close();
            conn.close();
        }
View Full Code Here

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

        PreparedStatement stmt2 = conn.prepareStatement(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

        MockPreparedStatement mockStmt = null;
        {
            Connection conn = dataSource.getConnection();

            PreparedStatement stmt = conn.prepareStatement(sql);
            mockStmt = stmt.unwrap(MockPreparedStatement.class);
            ResultSet rs = stmt.executeQuery();
            rs.next();
            rs.close();
            stmt.close();
View Full Code Here

       
        {
            Connection conn = dataSource.getConnection();

            PreparedStatement stmt = conn.prepareStatement(sql);
            Assert.assertEquals(mockStmt, stmt.unwrap(MockPreparedStatement.class));
            ResultSet rs = stmt.executeQuery();
            rs.next();
            rs.close();
            stmt.close();
View Full Code Here

        {
            Connection conn = dataSource.getConnection();
            conn.setAutoCommit(false);

            PreparedStatement stmt = conn.prepareStatement(sql);
            Assert.assertSame(mockStmt, stmt.unwrap(MockPreparedStatement.class));
            ResultSet rs = stmt.executeQuery();
            rs.next();
            rs.close();
            stmt.close();
View Full Code Here

        {
            Connection conn = dataSource.getConnection();
            conn.setAutoCommit(false);
           
            PreparedStatement stmt = conn.prepareStatement(sql);
            Assert.assertSame(mockStmt, stmt.unwrap(MockPreparedStatement.class));
            ResultSet rs = stmt.executeQuery();
            rs.next();
            rs.close();
            stmt.close();
           
View Full Code Here

                Assert.assertEquals(50, oracleConn.getDefaultRowPrefetch());
            }

            PreparedStatement stmt = conn.prepareStatement(sql);

            oracleStmt = stmt.unwrap(OraclePreparedStatement.class);
            Assert.assertEquals(50, oracleStmt.getRowPrefetch());
           
            Assert.assertTrue(stmt.isWrapperFor(PreparedStatementHolder.class));
            stmtHolder = stmt.unwrap(PreparedStatementHolder.class);
            Assert.assertNotNull(stmtHolder);
View Full Code Here

            oracleStmt = stmt.unwrap(OraclePreparedStatement.class);
            Assert.assertEquals(50, oracleStmt.getRowPrefetch());
           
            Assert.assertTrue(stmt.isWrapperFor(PreparedStatementHolder.class));
            stmtHolder = stmt.unwrap(PreparedStatementHolder.class);
            Assert.assertNotNull(stmtHolder);
            Assert.assertEquals(0, stmtHolder.getHitCount());

            ResultSet rs = stmt.executeQuery();
            rs.next();
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.