use of com.alibaba.druid.pool.DruidPooledConnection in project druid by alibaba.
the class ConnectionTest4 method test_prepareStatement_1.
public void test_prepareStatement_1() throws Exception {
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
MockPreparedStatement raw = null;
{
PreparedStatement stmt = conn.prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
raw = stmt.unwrap(MockPreparedStatement.class);
stmt.close();
}
{
PreparedStatement stmt = conn.prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
Assert.assertSame(raw, stmt.unwrap(MockPreparedStatement.class));
stmt.close();
}
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledConnection in project druid by alibaba.
the class ConnectionTest4 method test_releaseSavepoint_1.
public void test_releaseSavepoint_1() throws Exception {
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
conn.getConnection().close();
{
SQLException error = null;
try {
conn.releaseSavepoint(null);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledConnection in project druid by alibaba.
the class ConnectionTest4 method test_prepareStatement_error6.
public void test_prepareStatement_error6() throws Exception {
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
conn.getConnection().close();
{
SQLException error = null;
try {
conn.prepareStatement("SELECT 1", new int[0]);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledConnection in project druid by alibaba.
the class ConnectionTest4 method test_prepareStatement_error5.
public void test_prepareStatement_error5() throws Exception {
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
{
SQLException error = null;
try {
conn.prepareStatement(null, new int[0]);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledConnection in project druid by alibaba.
the class ConnectionTest4 method test_prepareStatement_4.
public void test_prepareStatement_4() throws Exception {
DruidPooledConnection conn = dataSource.getConnection().unwrap(DruidPooledConnection.class);
MockPreparedStatement raw = null;
{
PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
raw = stmt.unwrap(MockPreparedStatement.class);
stmt.close();
}
{
PreparedStatement stmt = conn.prepareStatement("SELECT 1", 0);
Assert.assertEquals(raw, stmt.unwrap(MockPreparedStatement.class));
stmt.close();
}
conn.close();
}
Aggregations