Search in sources :

Example 6 with PreparedStatementHolder

use of com.alibaba.druid.pool.PreparedStatementHolder 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

PreparedStatementHolder (com.alibaba.druid.pool.PreparedStatementHolder)6 DruidConnectionHolder (com.alibaba.druid.pool.DruidConnectionHolder)5 DruidPooledConnection (com.alibaba.druid.pool.DruidPooledConnection)4 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 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 OracleConnection (oracle.jdbc.OracleConnection)1 OraclePreparedStatement (oracle.jdbc.internal.OraclePreparedStatement)1