Package com.alibaba.druid.pool.DruidPooledPreparedStatement

Examples of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey


    @Override
    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
        checkState();

        PreparedStatementKey key = new PreparedStatementKey(sql, getCatalog(), MethodType.M6, autoGeneratedKeys);
        PreparedStatementHolder stmtHolder = null;

        boolean poolPreparedStatements = holder.isPoolPreparedStatements();

        if (poolPreparedStatements) {
View Full Code Here


    @Override
    public CallableStatement prepareCall(String sql) throws SQLException {
        checkState();

        PreparedStatementHolder stmtHolder = null;
        PreparedStatementKey key = new PreparedStatementKey(sql, getCatalog(), MethodType.Precall_1);

        boolean poolPreparedStatements = holder.isPoolPreparedStatements();

        if (poolPreparedStatements) {
            stmtHolder = holder.getStatementPool().get(key);
View Full Code Here

    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
                                         int resultSetHoldability) throws SQLException {
        checkState();

        PreparedStatementHolder stmtHolder = null;
        PreparedStatementKey key = new PreparedStatementKey(sql, getCatalog(), MethodType.Precall_2, resultSetType,
                                                            resultSetConcurrency, resultSetHoldability);

        boolean poolPreparedStatements = holder.isPoolPreparedStatements();

        if (poolPreparedStatements) {
View Full Code Here

    @Override
    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
        checkState();

        PreparedStatementHolder stmtHolder = null;
        PreparedStatementKey key = new PreparedStatementKey(sql, getCatalog(), MethodType.Precall_3, resultSetType,
                                                            resultSetConcurrency);

        boolean poolPreparedStatements = holder.isPoolPreparedStatements();

        if (poolPreparedStatements) {
View Full Code Here

            stmtHolder.setEnterOracleImplicitCache(true);
        } else {
            stmtHolder.setEnterOracleImplicitCache(false);
        }

        PreparedStatementKey key = stmtHolder.getKey();

        PreparedStatementHolder oldStmtHolder = map.put(key, stmtHolder);

        if (oldStmtHolder == stmtHolder) {
            return;
View Full Code Here

        MockConnection mockConn = new MockConnection();
        DruidConnectionHolder connHolder = new DruidConnectionHolder(dataSource, mockConn);
        DruidPooledConnection conn = new DruidPooledConnection(connHolder);

        raw = new MockPreparedStatement(null, null);
        stmt = new DruidPooledPreparedStatement(conn, new PreparedStatementHolder(new PreparedStatementKey("", null,
                                                                                                           null, 0, 0,
                                                                                                           0), raw)) {

            protected SQLException checkException(Throwable error) throws SQLException {
                if (error instanceof SQLException) {
View Full Code Here

    protected void setUp() throws Exception {
        MockConnection mockConn = new MockConnection();
        DruidConnectionHolder connHolder = new DruidConnectionHolder(dataSource, mockConn);
        conn = new DruidPooledConnection(connHolder);
        raw = new MockCallableStatement(null, null);
        stmt = new DruidPooledCallableStatement(conn, new PreparedStatementHolder(new PreparedStatementKey("", null,
                                                                                                           null, 0, 0,
                                                                                                           0), raw)) {

            protected SQLException checkException(Throwable error) throws SQLException {
                if (error instanceof SQLException) {
View Full Code Here

import com.alibaba.druid.pool.PreparedStatementPool.MethodType;

public class PreparedStatementKeyTest extends TestCase {

    public void test_0() throws Exception {
        PreparedStatementKey k1 = new PreparedStatementKey("select 'a'", "c1", MethodType.M1, 101, 102, 103);
        Assert.assertEquals(101, k1.getResultSetType());
        Assert.assertEquals(102, k1.getResultSetConcurrency());
        Assert.assertEquals(103, k1.getResultSetHoldability());
    }
View Full Code Here

        Assert.assertEquals(102, k1.getResultSetConcurrency());
        Assert.assertEquals(103, k1.getResultSetHoldability());
    }

    public void test_eq() throws Exception {
        Assert.assertEquals(new PreparedStatementKey("select 'a'", "c1", MethodType.M1, 101, 102, 103),
                            new PreparedStatementKey("select 'a'", "c1", MethodType.M1, 101, 102, 103));

    }
View Full Code Here

    }

    public void test_not_eq() throws Exception {
        Assert.assertFalse( //
        new PreparedStatementKey("select 'a'", "c1", MethodType.M1, 101, 102, 103).equals( //
        new PreparedStatementKey("select 'a'", "c1", MethodType.M1, 201, 102, 103)));

    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey

Copyright © 2018 www.massapicom. 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.