Search in sources :

Example 6 with DruidConnectionHolder

use of com.alibaba.druid.pool.DruidConnectionHolder in project druid by alibaba.

the class PoolablePreparedStatementTest method setUp.

protected void setUp() throws Exception {
    DruidDataSource dataSource = new DruidDataSource();
    MockConnection mockConn = new MockConnection();
    DruidConnectionHolder connHolder = new DruidConnectionHolder(dataSource, mockConn, 0);
    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) {
                return (SQLException) error;
            }
            return new SQLException(error);
        }
    };
}
Also used : PreparedStatementHolder(com.alibaba.druid.pool.PreparedStatementHolder) SQLException(java.sql.SQLException) DruidPooledConnection(com.alibaba.druid.pool.DruidPooledConnection) DruidPooledPreparedStatement(com.alibaba.druid.pool.DruidPooledPreparedStatement) DruidConnectionHolder(com.alibaba.druid.pool.DruidConnectionHolder) MockPreparedStatement(com.alibaba.druid.mock.MockPreparedStatement) PreparedStatementKey(com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) MockConnection(com.alibaba.druid.mock.MockConnection)

Aggregations

DruidConnectionHolder (com.alibaba.druid.pool.DruidConnectionHolder)6 DruidPooledConnection (com.alibaba.druid.pool.DruidPooledConnection)5 PreparedStatementHolder (com.alibaba.druid.pool.PreparedStatementHolder)5 MockConnection (com.alibaba.druid.mock.MockConnection)3 DruidPooledPreparedStatement (com.alibaba.druid.pool.DruidPooledPreparedStatement)3 PreparedStatementKey (com.alibaba.druid.pool.DruidPooledPreparedStatement.PreparedStatementKey)3 PreparedStatementPool (com.alibaba.druid.pool.PreparedStatementPool)3 MockPreparedStatement (com.alibaba.druid.mock.MockPreparedStatement)2 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)2 MockCallableStatement (com.alibaba.druid.mock.MockCallableStatement)1 DruidPooledCallableStatement (com.alibaba.druid.pool.DruidPooledCallableStatement)1 DruidPooledResultSet (com.alibaba.druid.pool.DruidPooledResultSet)1 Field (java.lang.reflect.Field)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1