Package com.alibaba.druid.pool

Examples of com.alibaba.druid.pool.DruidPooledConnection.prepareStatement()


            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new int[0]);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new int[0]);
            Assert.assertEquals(raw, stmt.unwrap(MockPreparedStatement.class));
            stmt.close();
        }

        conn.close();
View Full Code Here


    public void test_prepareStatement_3() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new String[0]);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new String[0]);
View Full Code Here

            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new String[0]);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", new String[0]);
            Assert.assertEquals(raw, stmt.unwrap(MockPreparedStatement.class));
            stmt.close();
        }

        conn.close();
View Full Code Here

    public void test_prepareStatement_4() throws Exception {
        DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);

        MockPreparedStatement raw = null;
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
View Full Code Here

            PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
            raw = stmt.unwrap(MockPreparedStatement.class);
            stmt.close();
        }
        {
            PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
            Assert.assertEquals(raw, stmt.unwrap(MockPreparedStatement.class));
            stmt.close();
        }

        conn.close();
View Full Code Here

        conn.getConnection().close();

        {
            SQLException error = null;
            try {
                conn.prepareStatement("SELECT 1");
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

        EncodingConvertFilter filter = (EncodingConvertFilter) dataSource.getProxyFilters().get(0);

        DruidPooledConnection conn = dataSource.getConnection();

        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);
View Full Code Here

        Assert.assertEquals(0, dataSource.getActiveCount());
    }

    public void test_closePoolableStatement() throws Exception {
        DruidPooledConnection conn = (DruidPooledConnection) dataSource.getConnection();
        DruidPooledPreparedStatement stmt = (DruidPooledPreparedStatement) conn.prepareStatement("select 1");
        conn.close();
        conn.closePoolableStatement(stmt);
    }

    public void test_dup_close() throws Exception {
View Full Code Here

        DruidPooledResultSet rs_1_E;
        DruidPooledResultSet rs_1_F;
        DruidPooledResultSet rs_1_G;
        DruidPooledResultSet rs_1_H;

        stmt_0 = (DruidPooledPreparedStatement) conn.prepareStatement(sql_0);
        rs_0 = (DruidPooledResultSet) stmt_0.executeQuery();
       
        Assert.assertTrue(stmt_0.getPreparedStatementHolder().isInUse());

        stmt_1_A = (DruidPooledPreparedStatement) conn.prepareStatement(sql_1);
View Full Code Here

        stmt_0 = (DruidPooledPreparedStatement) conn.prepareStatement(sql_0);
        rs_0 = (DruidPooledResultSet) stmt_0.executeQuery();
       
        Assert.assertTrue(stmt_0.getPreparedStatementHolder().isInUse());

        stmt_1_A = (DruidPooledPreparedStatement) conn.prepareStatement(sql_1);
        rs_1_A = (DruidPooledResultSet) stmt_1_A.executeQuery();
       
        Assert.assertTrue(stmt_0.getPreparedStatementHolder().isInUse());
        Assert.assertTrue(stmt_1_A.getPreparedStatementHolder().isInUse());
       
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.