Search in sources :

Example 6 with Signature

use of org.apache.calcite.avatica.Meta.Signature in project calcite-avatica by apache.

the class AvaticaClosedPreparedStatementTest method newInstance.

@Override
protected PreparedStatement newInstance() throws Exception {
    UnregisteredDriver driver = new TestDriver();
    AvaticaConnection connection = new AvaticaConnection(driver, driver.createFactory(), "jdbc:avatica", new Properties()) {
    };
    StatementHandle handle = mock(StatementHandle.class);
    Signature signature = new Signature(Collections.emptyList(), "", Collections.emptyList(), Collections.emptyMap(), null, Meta.StatementType.SELECT);
    AvaticaPreparedStatement preparedStatement = new AvaticaPreparedStatement(connection, handle, signature, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT) {
    };
    preparedStatement.close();
    assertTrue("Prepared statement is not closed", preparedStatement.isClosed());
    return preparedStatement;
}
Also used : StatementHandle(org.apache.calcite.avatica.Meta.StatementHandle) Signature(org.apache.calcite.avatica.Meta.Signature) Properties(java.util.Properties)

Example 7 with Signature

use of org.apache.calcite.avatica.Meta.Signature in project calcite-avatica by apache.

the class AvaticaClosedResultSetTest method newInstance.

@Override
protected ResultSet newInstance() throws Exception {
    UnregisteredDriver driver = new TestDriver();
    AvaticaConnection connection = new AvaticaConnection(driver, driver.createFactory(), "jdbc:avatica", new Properties()) {
    };
    StatementHandle handle = mock(StatementHandle.class);
    AvaticaStatement statement = new AvaticaStatement(connection, handle, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT) {
    };
    Signature signature = new Signature(Collections.emptyList(), "", Collections.emptyList(), Collections.emptyMap(), null, Meta.StatementType.SELECT);
    AvaticaResultSet resultSet = new AvaticaResultSet(statement, new QueryState(""), signature, null, DateTimeUtils.UTC_ZONE, null);
    resultSet.close();
    assertTrue("Resultset is not closed", resultSet.isClosed());
    return resultSet;
}
Also used : StatementHandle(org.apache.calcite.avatica.Meta.StatementHandle) Signature(org.apache.calcite.avatica.Meta.Signature) Properties(java.util.Properties)

Aggregations

Signature (org.apache.calcite.avatica.Meta.Signature)7 StatementHandle (org.apache.calcite.avatica.Meta.StatementHandle)3 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 Properties (java.util.Properties)2 AvaticaParameter (org.apache.calcite.avatica.AvaticaParameter)2 ColumnMetaData (org.apache.calcite.avatica.ColumnMetaData)2 ConnectionPropertiesImpl (org.apache.calcite.avatica.ConnectionPropertiesImpl)2 Meta (org.apache.calcite.avatica.Meta)2 Cache (com.google.common.cache.Cache)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 PreparedStatement (java.sql.PreparedStatement)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AvaticaPreparedStatement (org.apache.calcite.avatica.AvaticaPreparedStatement)1 ScalarType (org.apache.calcite.avatica.ColumnMetaData.ScalarType)1 Frame (org.apache.calcite.avatica.Meta.Frame)1