Search in sources :

Example 6 with DruidPooledResultSet

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

the class ResultSetTest2 method test_closeError.

public void test_closeError() throws Exception {
    MockResultSet mock = new MockResultSet(null) {

        public void close() throws SQLException {
            throw new SQLException();
        }
    };
    DruidPooledResultSet rs = new DruidPooledResultSet(stmt, mock);
    SQLException error = null;
    try {
        rs.close();
    } catch (SQLException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
Also used : SQLException(java.sql.SQLException) MockResultSet(com.alibaba.druid.mock.MockResultSet) DruidPooledResultSet(com.alibaba.druid.pool.DruidPooledResultSet)

Example 7 with DruidPooledResultSet

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

the class ResultSetTest2 method setUp.

protected void setUp() throws Exception {
    stmt = new DruidPooledStatement(null, null) {

        protected SQLException checkException(Throwable error) throws SQLException {
            if (error instanceof SQLException) {
                return (SQLException) error;
            }
            return new SQLException(error);
        }
    };
    raw = new MockResultSet(null);
    raw.getRows().add(new Object[] { null });
    resultSet = new DruidPooledResultSet(stmt, raw);
}
Also used : DruidPooledStatement(com.alibaba.druid.pool.DruidPooledStatement) SQLException(java.sql.SQLException) MockResultSet(com.alibaba.druid.mock.MockResultSet) DruidPooledResultSet(com.alibaba.druid.pool.DruidPooledResultSet)

Aggregations

DruidPooledResultSet (com.alibaba.druid.pool.DruidPooledResultSet)7 MockResultSet (com.alibaba.druid.mock.MockResultSet)3 Connection (java.sql.Connection)3 PreparedStatement (java.sql.PreparedStatement)3 SQLException (java.sql.SQLException)3 DruidPooledStatement (com.alibaba.druid.pool.DruidPooledStatement)2 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)2 DruidConnectionHolder (com.alibaba.druid.pool.DruidConnectionHolder)1 DruidPooledConnection (com.alibaba.druid.pool.DruidPooledConnection)1 DruidPooledPreparedStatement (com.alibaba.druid.pool.DruidPooledPreparedStatement)1 PreparedStatementHolder (com.alibaba.druid.pool.PreparedStatementHolder)1 PreparedStatementPool (com.alibaba.druid.pool.PreparedStatementPool)1