org.apache.calcite.avatica.remote

## Class RemoteMeta

- java.lang.Object
- - org.apache.calcite.avatica.MetaImpl
  - - org.apache.calcite.avatica.remote.RemoteMeta

All Implemented Interfaces:
  Meta

    class RemoteMeta
    extends MetaImpl

Implementation of `Meta` for the remote driver.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.calcite.avatica.MetaImpl

`MetaImpl.ColumnNoNulls, MetaImpl.ColumnNullable, MetaImpl.ColumnNullableUnknown, MetaImpl.MetaAttribute, MetaImpl.MetaBestRowIdentifier, MetaImpl.MetaCatalog, MetaImpl.MetaClientInfoProperty, MetaImpl.MetaColumn, MetaImpl.MetaColumnPrivilege, MetaImpl.MetaCrossReference, MetaImpl.MetaExportedKey, MetaImpl.MetaFunction, MetaImpl.MetaFunctionColumn, MetaImpl.MetaImportedKey, MetaImpl.MetaIndexInfo, MetaImpl.MetaPrimaryKey, MetaImpl.MetaProcedure, MetaImpl.MetaProcedureColumn, MetaImpl.MetaPseudoColumn, MetaImpl.MetaSchema, MetaImpl.MetaSuperTable, MetaImpl.MetaSuperType, MetaImpl.MetaTable, MetaImpl.MetaTablePrivilege, MetaImpl.MetaTableType, MetaImpl.MetaTypeInfo, MetaImpl.MetaUdt, MetaImpl.MetaVersionColumn, MetaImpl.Named`

### Nested classes/interfaces inherited from interface org.apache.calcite.avatica.Meta

`Meta.ConnectionHandle, Meta.ConnectionProperties, Meta.CursorFactory, Meta.DatabaseProperty, Meta.ExecuteBatchResult, Meta.ExecuteResult, Meta.Factory, Meta.Frame, Meta.MetaResultSet, Meta.Pat, Meta.PrepareCallback, Meta.Signature, Meta.StatementHandle, Meta.StatementType, Meta.Style`

### Field Summary

Fields
`private Map<Meta.DatabaseProperty,Object>` `databaseProperties`
`(package private) Map<String,ConnectionPropertiesImpl>` `propsMap`
`(package private) Service` `service`

### Fields inherited from class org.apache.calcite.avatica.MetaImpl

`connection, connProps`

### Constructor Summary

Constructors
Constructor and Description
`RemoteMeta(AvaticaConnection connection, Service service)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `closeConnection(Meta.ConnectionHandle ch)` Closes a connection
`void` `closeStatement(Meta.StatementHandle h)` Closes a statement.
`void` `commit(Meta.ConnectionHandle ch)` Makes all changes since the last commit/rollback permanent.
`Meta.ConnectionProperties` `connectionSync(Meta.ConnectionHandle ch, Meta.ConnectionProperties connProps)` Synchronizes client and server view of connection properties.
`Meta.StatementHandle` `createStatement(Meta.ConnectionHandle ch)` Called during the creation of a statement to allocate a new handle.
`Meta.ExecuteResult` `execute(Meta.StatementHandle h, List<TypedValue> parameterValues, int maxRowsInFirstFrame)` Executes a prepared statement.
`Meta.ExecuteResult` `execute(Meta.StatementHandle h, List<TypedValue> parameterValues, long maxRowCount)` Executes a prepared statement.
`Meta.ExecuteBatchResult` `executeBatch(Meta.StatementHandle h, List<List<TypedValue>> parameterValues)` Executes a collection of bound parameter values on a prepared statement.
`Meta.Frame` `fetch(Meta.StatementHandle h, long offset, int fetchMaxRowCount)` Returns a frame of rows.
`Meta.MetaResultSet` `getCatalogs(Meta.ConnectionHandle ch)` Per `DatabaseMetaData.getCatalogs()`.
`Meta.MetaResultSet` `getColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern)` Per `DatabaseMetaData.getColumns(String, String, String, String)`.
`Map<Meta.DatabaseProperty,Object>` `getDatabaseProperties(Meta.ConnectionHandle ch)` Returns a map of static database properties.
`Meta.MetaResultSet` `getSchemas(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern)`
`Meta.MetaResultSet` `getTables(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, List<String> typeList)` Per `DatabaseMetaData.getTables(String, String, String, String[])`.
`Meta.MetaResultSet` `getTableTypes(Meta.ConnectionHandle ch)` Per `DatabaseMetaData.getTableTypes()`.
`Meta.MetaResultSet` `getTypeInfo(Meta.ConnectionHandle ch)` Per `DatabaseMetaData.getTypeInfo()`.
`void` `openConnection(Meta.ConnectionHandle ch, Map<String,String> info)` Opens (creates) a connection.
`Meta.StatementHandle` `prepare(Meta.ConnectionHandle ch, String sql, long maxRowCount)` Prepares a statement.
`Meta.ExecuteResult` `prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, int maxRowsInFirstFrame, Meta.PrepareCallback callback)` Prepares and executes a statement.
`Meta.ExecuteResult` `prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, Meta.PrepareCallback callback)` Prepares and executes a statement.
`Meta.ExecuteBatchResult` `prepareAndExecuteBatch(Meta.StatementHandle h, List<String> sqlCommands)` Prepares a statement and then executes a number of SQL commands in one pass.
`void` `rollback(Meta.ConnectionHandle ch)` Undoes all changes since the last commit/rollback.
`boolean` `syncResults(Meta.StatementHandle h, QueryState state, long offset)` Re-sets the `ResultSet` on a Statement.
`private Meta.MetaResultSet` `toResultSet(Class clazz, Service.ResultSetResponse response)`

### Methods inherited from class org.apache.calcite.avatica.MetaImpl

`checkParameterValueHasNull, collect, collect, columnMetaData, columnMetaData, columnMetaData, columnMetaData, createCursor, createEmptyResultSet, createIterable, createResultSet, fetch, fieldMetaData, getAttributes, getBestRowIdentifier, getClientInfoProperties, getColumnNullability, getColumnPrivileges, getCrossReference, getExportedKeys, getFunctionColumns, getFunctions, getImportedKeys, getIndexInfo, getPrimaryKeys, getProcedureColumns, getProcedures, getPseudoColumns, getSuperTables, getSuperTypes, getTablePrivileges, getUDTs, getVersionColumns`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### service

    final Service service

#### propsMap

    final Map<String,ConnectionPropertiesImpl> propsMap

#### databaseProperties

    private Map<Meta.DatabaseProperty,Object> databaseProperties

### Constructor Detail

#### RemoteMeta

    public RemoteMeta(AvaticaConnection connection,
                      Service service)

### Method Detail

#### toResultSet

    private Meta.MetaResultSet toResultSet(Class clazz,
                                           Service.ResultSetResponse response)

#### getDatabaseProperties

    public Map<Meta.DatabaseProperty,Object> getDatabaseProperties(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Returns a map of static database properties.

The provider can omit properties whose value is the same as the default.

Specified by:
  `getDatabaseProperties` in interface `Meta`
Overrides:
  `getDatabaseProperties` in class `MetaImpl`

#### createStatement

    public Meta.StatementHandle createStatement(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Called during the creation of a statement to allocate a new handle.

Specified by:
  `createStatement` in interface `Meta`
Overrides:
  `createStatement` in class `MetaImpl`
Parameters:
  `ch` - Connection handle

#### closeStatement

    public void closeStatement(Meta.StatementHandle h)

Description copied from interface: `Meta`
Closes a statement.

If the statement handle is not known, or is already closed, does nothing.

Parameters:
  `h` - Statement handle

#### openConnection

    public void openConnection(Meta.ConnectionHandle ch,
                               Map<String,String> info)

Description copied from interface: `Meta`
Opens (creates) a connection. The client allocates its own connection ID which the server is then made aware of through the `Meta.ConnectionHandle`. The Map `info` argument is analogous to the `Properties` typically passed to a "normal" JDBC Driver. Avatica specific properties should not be included -- only properties for the underlying driver.

Specified by:
  `openConnection` in interface `Meta`
Overrides:
  `openConnection` in class `MetaImpl`
Parameters:
  `ch` - A ConnectionHandle encapsulates information about the connection to be opened as provided by the client.
  `info` - A Map corresponding to the Properties typically passed to a JDBC Driver.

#### closeConnection

    public void closeConnection(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Closes a connection

Specified by:
  `closeConnection` in interface `Meta`
Overrides:
  `closeConnection` in class `MetaImpl`

#### connectionSync

    public Meta.ConnectionProperties connectionSync(Meta.ConnectionHandle ch,
                                                    Meta.ConnectionProperties connProps)

Description copied from interface: `Meta`
Synchronizes client and server view of connection properties.

Note: this interface is considered "experimental" and may undergo further changes as this functionality is extended to other aspects of state management for `Connection`, `Statement`, and `ResultSet`.

Specified by:
  `connectionSync` in interface `Meta`
Overrides:
  `connectionSync` in class `MetaImpl`

#### getCatalogs

    public Meta.MetaResultSet getCatalogs(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Per `DatabaseMetaData.getCatalogs()`.

Specified by:
  `getCatalogs` in interface `Meta`
Overrides:
  `getCatalogs` in class `MetaImpl`

#### getSchemas

    public Meta.MetaResultSet getSchemas(Meta.ConnectionHandle ch,
                                         String catalog,
                                         Meta.Pat schemaPattern)

Specified by:
  `getSchemas` in interface `Meta`
Overrides:
  `getSchemas` in class `MetaImpl`

#### getTables

    public Meta.MetaResultSet getTables(Meta.ConnectionHandle ch,
                                        String catalog,
                                        Meta.Pat schemaPattern,
                                        Meta.Pat tableNamePattern,
                                        List<String> typeList)

Description copied from interface: `Meta`
Per `DatabaseMetaData.getTables(String, String, String, String[])`.

Specified by:
  `getTables` in interface `Meta`
Overrides:
  `getTables` in class `MetaImpl`

#### getTableTypes

    public Meta.MetaResultSet getTableTypes(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Per `DatabaseMetaData.getTableTypes()`.

Specified by:
  `getTableTypes` in interface `Meta`
Overrides:
  `getTableTypes` in class `MetaImpl`

#### getTypeInfo

    public Meta.MetaResultSet getTypeInfo(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Per `DatabaseMetaData.getTypeInfo()`.

Specified by:
  `getTypeInfo` in interface `Meta`
Overrides:
  `getTypeInfo` in class `MetaImpl`

#### getColumns

    public Meta.MetaResultSet getColumns(Meta.ConnectionHandle ch,
                                         String catalog,
                                         Meta.Pat schemaPattern,
                                         Meta.Pat tableNamePattern,
                                         Meta.Pat columnNamePattern)

Description copied from interface: `Meta`
Per `DatabaseMetaData.getColumns(String, String, String, String)`.

Specified by:
  `getColumns` in interface `Meta`
Overrides:
  `getColumns` in class `MetaImpl`

#### prepare

    public Meta.StatementHandle prepare(Meta.ConnectionHandle ch,
                                        String sql,
                                        long maxRowCount)

Description copied from interface: `Meta`
Prepares a statement.

Parameters:
  `ch` - Connection handle
  `sql` - SQL query
  `maxRowCount` - Negative for no limit (different meaning than JDBC)
Returns:
  Signature of prepared statement

#### prepareAndExecute

    public Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h,
                                                String sql,
                                                long maxRowCount,
                                                Meta.PrepareCallback callback)
                                         throws NoSuchStatementException

Description copied from interface: `Meta`
Prepares and executes a statement.

Parameters:
  `h` - Statement handle
  `sql` - SQL query
  `maxRowCount` - Negative for no limit (different meaning than JDBC)
  `callback` - Callback to lock, clear and assign cursor
Returns:
  Result containing statement ID, and if a query, a result set and first frame of data
Throws:
  `NoSuchStatementException`

#### prepareAndExecute

    public Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h,
                                                String sql,
                                                long maxRowCount,
                                                int maxRowsInFirstFrame,
                                                Meta.PrepareCallback callback)
                                         throws NoSuchStatementException

Description copied from interface: `Meta`
Prepares and executes a statement.

Parameters:
  `h` - Statement handle
  `sql` - SQL query
  `maxRowCount` - Maximum number of rows for the entire query. Negative for no limit (different meaning than JDBC).
  `maxRowsInFirstFrame` - Maximum number of rows for the first frame. This value should always be less than or equal to `maxRowCount` as the number of results are guaranteed to be restricted by `maxRowCount` and the underlying database.
  `callback` - Callback to lock, clear and assign cursor
Returns:
  Result containing statement ID, and if a query, a result set and first frame of data
Throws:
  `NoSuchStatementException`

#### fetch

    public Meta.Frame fetch(Meta.StatementHandle h,
                            long offset,
                            int fetchMaxRowCount)
                     throws NoSuchStatementException,
                            MissingResultsException

Description copied from interface: `Meta`
Returns a frame of rows.

The frame describes whether there may be another frame. If there is not another frame, the current iteration is done when we have finished the rows in the this frame.

The default implementation always returns null.

Parameters:
  `h` - Statement handle
  `offset` - Zero-based offset of first row in the requested frame
  `fetchMaxRowCount` - Maximum number of rows to return; negative means no limit
Returns:
  Frame, or null if there are no more
Throws:
  `NoSuchStatementException`
  `MissingResultsException`

#### execute

    public Meta.ExecuteResult execute(Meta.StatementHandle h,
                                      List<TypedValue> parameterValues,
                                      long maxRowCount)
                               throws NoSuchStatementException

Description copied from interface: `Meta`
Executes a prepared statement.

Parameters:
  `h` - Statement handle
  `parameterValues` - A list of parameter values; may be empty, not null
  `maxRowCount` - Maximum number of rows to return; negative means no limit
Returns:
  Execute result
Throws:
  `NoSuchStatementException`

#### execute

    public Meta.ExecuteResult execute(Meta.StatementHandle h,
                                      List<TypedValue> parameterValues,
                                      int maxRowsInFirstFrame)
                               throws NoSuchStatementException

Description copied from interface: `Meta`
Executes a prepared statement.

Parameters:
  `h` - Statement handle
  `parameterValues` - A list of parameter values; may be empty, not null
  `maxRowsInFirstFrame` - Maximum number of rows to return in the Frame.
Returns:
  Execute result
Throws:
  `NoSuchStatementException`

#### syncResults

    public boolean syncResults(Meta.StatementHandle h,
                               QueryState state,
                               long offset)
                        throws NoSuchStatementException

Description copied from interface: `Meta`
Re-sets the `ResultSet` on a Statement. Not a JDBC method.

Returns:
  True if there are results to fetch after resetting to the given offset. False otherwise
Throws:
  `NoSuchStatementException`

#### commit

    public void commit(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Makes all changes since the last commit/rollback permanent. Analogous to `Connection.commit()`.

Parameters:
  `ch` - A reference to the real JDBC Connection

#### rollback

    public void rollback(Meta.ConnectionHandle ch)

Description copied from interface: `Meta`
Undoes all changes since the last commit/rollback. Analogous to `Connection.rollback()`;

Parameters:
  `ch` - A reference to the real JDBC Connection

#### prepareAndExecuteBatch

    public Meta.ExecuteBatchResult prepareAndExecuteBatch(Meta.StatementHandle h,
                                                          List<String> sqlCommands)
                                                   throws NoSuchStatementException

Description copied from interface: `Meta`
Prepares a statement and then executes a number of SQL commands in one pass.

Parameters:
  `h` - Statement handle
  `sqlCommands` - SQL commands to run
Returns:
  An array of update counts containing one element for each command in the batch.
Throws:
  `NoSuchStatementException`

#### executeBatch

    public Meta.ExecuteBatchResult executeBatch(Meta.StatementHandle h,
                                                List<List<TypedValue>> parameterValues)
                                         throws NoSuchStatementException

Description copied from interface: `Meta`
Executes a collection of bound parameter values on a prepared statement.

Parameters:
  `h` - Statement handle
  `parameterValues` - A collection of list of typed values, one list per batch
Returns:
  An array of update counts containing one element for each command in the batch.
Throws:
  `NoSuchStatementException`