use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class DruidPooledStatementTest method test_isCloseOnCompletion_error.
public void test_isCloseOnCompletion_error() throws Exception {
Connection conn = dataSource.getConnection();
DruidPooledStatement stmt = (DruidPooledStatement) conn.createStatement();
Assert.assertEquals(0, dataSource.getPoolingCount());
Assert.assertEquals(1, dataSource.getActiveCount());
Assert.assertEquals(0, dataSource.getErrorCount());
Exception error = null;
try {
stmt.isCloseOnCompletion();
} catch (SQLFeatureNotSupportedException e) {
error = e;
}
Assert.assertNotNull(error);
Assert.assertEquals(0, dataSource.getErrorCount());
stmt.close();
conn.close();
Assert.assertEquals(1, dataSource.getPoolingCount());
Assert.assertEquals(0, dataSource.getActiveCount());
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest method setUp.
protected void setUp() throws Exception {
raw = new MockStatement(null);
stmt = new DruidPooledStatement(null, raw) {
protected SQLException checkException(Throwable error) throws SQLException {
if (error instanceof SQLException) {
return (SQLException) error;
}
return new SQLException(error);
}
};
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_FetchSize.
public void test_FetchSize() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.setFetchSize(144);
Assert.assertEquals(144, stmt.getFetchSize());
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.getFetchSize();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
stmt.setFetchSize(23);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_FetchDirection.
public void test_FetchDirection() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.setFetchDirection(144);
Assert.assertEquals(144, stmt.getFetchDirection());
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.getFetchDirection();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
stmt.setFetchDirection(23);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_setEscapeProcessing.
public void test_setEscapeProcessing() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.setEscapeProcessing(true);
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.setEscapeProcessing(true);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
Aggregations