Search in sources :

Example 26 with CallableStatement

use of java.sql.CallableStatement in project druid by alibaba.

the class FilterChainImplTest2 method test_getBoolean_1.

public void test_getBoolean_1() throws Exception {
    Connection conn = dataSource.getConnection();
    CallableStatement stmt = conn.prepareCall("select ?");
    stmt.registerOutParameter(1, Types.VARCHAR);
    Assert.assertFalse(stmt.getBoolean("1"));
    stmt.close();
    conn.close();
}
Also used : CallableStatement(java.sql.CallableStatement) Connection(java.sql.Connection)

Example 27 with CallableStatement

use of java.sql.CallableStatement in project druid by alibaba.

the class FilterChainImplTest2 method test_getFloat.

public void test_getFloat() throws Exception {
    Connection conn = dataSource.getConnection();
    CallableStatement stmt = conn.prepareCall("select ?");
    stmt.registerOutParameter(1, Types.VARCHAR);
    Assert.assertTrue(0F == stmt.getFloat(1));
    stmt.close();
    conn.close();
}
Also used : CallableStatement(java.sql.CallableStatement) Connection(java.sql.Connection)

Example 28 with CallableStatement

use of java.sql.CallableStatement in project druid by alibaba.

the class FilterChainImplTest2 method test_getString_1.

public void test_getString_1() throws Exception {
    Connection conn = dataSource.getConnection();
    CallableStatement stmt = conn.prepareCall("select ?");
    stmt.registerOutParameter(1, Types.VARCHAR);
    Assert.assertNull(stmt.getString("1"));
    stmt.close();
    conn.close();
}
Also used : CallableStatement(java.sql.CallableStatement) Connection(java.sql.Connection)

Example 29 with CallableStatement

use of java.sql.CallableStatement in project druid by alibaba.

the class FilterChainImplTest2 method test_getDouble.

public void test_getDouble() throws Exception {
    Connection conn = dataSource.getConnection();
    CallableStatement stmt = conn.prepareCall("select ?");
    stmt.registerOutParameter(1, Types.VARCHAR);
    Assert.assertTrue(0D == stmt.getDouble(1));
    stmt.close();
    conn.close();
}
Also used : CallableStatement(java.sql.CallableStatement) Connection(java.sql.Connection)

Example 30 with CallableStatement

use of java.sql.CallableStatement in project druid by alibaba.

the class FilterChainImplTest2 method test_getNCharacterStream.

public void test_getNCharacterStream() throws Exception {
    Connection conn = dataSource.getConnection();
    CallableStatement stmt = conn.prepareCall("select ?");
    stmt.registerOutParameter(1, Types.VARCHAR);
    Assert.assertNull(stmt.getNCharacterStream(1));
    stmt.close();
    conn.close();
}
Also used : CallableStatement(java.sql.CallableStatement) Connection(java.sql.Connection)

Aggregations

CallableStatement (java.sql.CallableStatement)259 SQLException (java.sql.SQLException)131 Connection (java.sql.Connection)123 ResultSet (java.sql.ResultSet)54 DatabaseAccessException (com.axway.ats.log.autodb.exceptions.DatabaseAccessException)45 DbConnection (com.axway.ats.core.dbaccess.DbConnection)28 Checkpoint (com.axway.ats.log.autodb.entities.Checkpoint)22 PreparedStatement (java.sql.PreparedStatement)21 ArrayList (java.util.ArrayList)21 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)20 Timestamp (java.sql.Timestamp)18 Test (org.junit.Test)16 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)15 Statement (java.sql.Statement)13 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)8 HashMap (java.util.HashMap)8 MockCallableStatement (com.alibaba.druid.mock.MockCallableStatement)7 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)6 OracleCallableStatement (oracle.jdbc.OracleCallableStatement)6 Session (org.hibernate.Session)6