Interface Meta
- All Known Subinterfaces:
ProtobufMeta
Also holds other abstract methods that are not related to metadata that each provider must implement. This is not ideal.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Connection handle.static interface
A pojo containing various client-settableConnection
properties.static final class
static enum
Database property.static class
Response from a collection of SQL commands or parameter values in a single batch.static class
Response from execute.static interface
Factory to create instances ofMeta
.static class
A collection of rows.static class
Meta data from which a result set can be constructed.static class
Wrapper to remind API calls that a parameter is a pattern (allows '%' and '_' wildcards, per the JDBC spec) rather than a string to be matched exactly.static interface
API to put a result set into a statement, being careful to enforce thread-safety and not to overwrite existing open result sets.static class
Result of preparing a statement.static class
Statement handle.static enum
Type of statement.static enum
How logical fields are represented in the objects returned by the iterator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes a connectionvoid
Closes a statement.void
Makes all changes since the last commit/rollback permanent.connectionSync
(Meta.ConnectionHandle ch, Meta.ConnectionProperties connProps) Synchronizes client and server view of connection properties.createIterable
(Meta.StatementHandle stmt, QueryState state, Meta.Signature signature, List<TypedValue> parameters, Meta.Frame firstFrame) Creates an iterable for a result set.Called during the creation of a statement to allocate a new handle.execute
(Meta.StatementHandle h, List<TypedValue> parameterValues, int maxRowsInFirstFrame) Executes a prepared statement.execute
(Meta.StatementHandle h, List<TypedValue> parameterValues, long maxRowCount) Deprecated.executeBatch
(Meta.StatementHandle h, List<List<TypedValue>> parameterValues) Executes a collection of bound parameter values on a prepared statement.fetch
(Meta.StatementHandle h, long offset, int fetchMaxRowCount) Returns a frame of rows.getAttributes
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern, Meta.Pat attributeNamePattern) getBestRowIdentifier
(Meta.ConnectionHandle ch, String catalog, String schema, String table, int scope, boolean nullable) getColumnPrivileges
(Meta.ConnectionHandle ch, String catalog, String schema, String table, Meta.Pat columnNamePattern) getColumns
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern) getCrossReference
(Meta.ConnectionHandle ch, String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) Returns a map of static database properties.getExportedKeys
(Meta.ConnectionHandle ch, String catalog, String schema, String table) getFunctionColumns
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat functionNamePattern, Meta.Pat columnNamePattern) getFunctions
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat functionNamePattern) getImportedKeys
(Meta.ConnectionHandle ch, String catalog, String schema, String table) getIndexInfo
(Meta.ConnectionHandle ch, String catalog, String schema, String table, boolean unique, boolean approximate) getPrimaryKeys
(Meta.ConnectionHandle ch, String catalog, String schema, String table) getProcedureColumns
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat procedureNamePattern, Meta.Pat columnNamePattern) getProcedures
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat procedureNamePattern) getPseudoColumns
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern) getSchemas
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern) getSuperTables
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern) getSuperTypes
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern) getTablePrivileges
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern) getTables
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, List<String> typeList) getUDTs
(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern, int[] types) getVersionColumns
(Meta.ConnectionHandle ch, String catalog, String schema, String table) void
openConnection
(Meta.ConnectionHandle ch, Map<String, String> info) Opens (creates) a connection.prepare
(Meta.ConnectionHandle ch, String sql, long maxRowCount) Prepares a statement.prepareAndExecute
(Meta.StatementHandle h, String sql, long maxRowCount, int maxRowsInFirstFrame, Meta.PrepareCallback callback) Prepares and executes a statement.prepareAndExecute
(Meta.StatementHandle h, String sql, long maxRowCount, Meta.PrepareCallback callback) prepareAndExecuteBatch
(Meta.StatementHandle h, List<String> sqlCommands) Prepares a statement and then executes a number of SQL commands in one pass.void
Undoes all changes since the last commit/rollback.boolean
syncResults
(Meta.StatementHandle sh, QueryState state, long offset) Re-sets theResultSet
on a Statement.
-
Method Details
-
getDatabaseProperties
Returns a map of static database properties.The provider can omit properties whose value is the same as the default.
-
getTables
Meta.MetaResultSet getTables(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, List<String> typeList) -
getColumns
Meta.MetaResultSet getColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern) -
getSchemas
-
getCatalogs
-
getTableTypes
-
getProcedures
Meta.MetaResultSet getProcedures(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat procedureNamePattern) -
getProcedureColumns
Meta.MetaResultSet getProcedureColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat procedureNamePattern, Meta.Pat columnNamePattern) -
getColumnPrivileges
Meta.MetaResultSet getColumnPrivileges(Meta.ConnectionHandle ch, String catalog, String schema, String table, Meta.Pat columnNamePattern) -
getTablePrivileges
Meta.MetaResultSet getTablePrivileges(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern) -
getBestRowIdentifier
Meta.MetaResultSet getBestRowIdentifier(Meta.ConnectionHandle ch, String catalog, String schema, String table, int scope, boolean nullable) -
getVersionColumns
Meta.MetaResultSet getVersionColumns(Meta.ConnectionHandle ch, String catalog, String schema, String table) -
getPrimaryKeys
Meta.MetaResultSet getPrimaryKeys(Meta.ConnectionHandle ch, String catalog, String schema, String table) -
getImportedKeys
Meta.MetaResultSet getImportedKeys(Meta.ConnectionHandle ch, String catalog, String schema, String table) -
getExportedKeys
Meta.MetaResultSet getExportedKeys(Meta.ConnectionHandle ch, String catalog, String schema, String table) -
getCrossReference
Meta.MetaResultSet getCrossReference(Meta.ConnectionHandle ch, String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) -
getTypeInfo
-
getIndexInfo
Meta.MetaResultSet getIndexInfo(Meta.ConnectionHandle ch, String catalog, String schema, String table, boolean unique, boolean approximate) -
getUDTs
Meta.MetaResultSet getUDTs(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern, int[] types) -
getSuperTypes
Meta.MetaResultSet getSuperTypes(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern) -
getSuperTables
Meta.MetaResultSet getSuperTables(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern) -
getAttributes
Meta.MetaResultSet getAttributes(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern, Meta.Pat attributeNamePattern) -
getClientInfoProperties
-
getFunctions
Meta.MetaResultSet getFunctions(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat functionNamePattern) -
getFunctionColumns
Meta.MetaResultSet getFunctionColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat functionNamePattern, Meta.Pat columnNamePattern) -
getPseudoColumns
Meta.MetaResultSet getPseudoColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern) -
createIterable
Iterable<Object> createIterable(Meta.StatementHandle stmt, QueryState state, Meta.Signature signature, List<TypedValue> parameters, Meta.Frame firstFrame) Creates an iterable for a result set.The default implementation just returns
iterable
, which it requires to be not null; derived classes may instead choose to execute the relational expression insignature
. -
prepare
Prepares a statement.- Parameters:
ch
- Connection handlesql
- SQL querymaxRowCount
- Negative for no limit (different meaning than JDBC)- Returns:
- Signature of prepared statement
-
prepareAndExecute
@Deprecated Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, Meta.PrepareCallback callback) throws NoSuchStatementException Prepares and executes a statement.- Parameters:
h
- Statement handlesql
- SQL querymaxRowCount
- 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
Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, int maxRowsInFirstFrame, Meta.PrepareCallback callback) throws NoSuchStatementException Prepares and executes a statement.- Parameters:
h
- Statement handlesql
- SQL querymaxRowCount
- 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 tomaxRowCount
as the number of results are guaranteed to be restricted bymaxRowCount
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
-
prepareAndExecuteBatch
Meta.ExecuteBatchResult prepareAndExecuteBatch(Meta.StatementHandle h, List<String> sqlCommands) throws NoSuchStatementException Prepares a statement and then executes a number of SQL commands in one pass.- Parameters:
h
- Statement handlesqlCommands
- SQL commands to run- Returns:
- An array of update counts containing one element for each command in the batch.
- Throws:
NoSuchStatementException
-
executeBatch
Meta.ExecuteBatchResult executeBatch(Meta.StatementHandle h, List<List<TypedValue>> parameterValues) throws NoSuchStatementException Executes a collection of bound parameter values on a prepared statement.- Parameters:
h
- Statement handleparameterValues
- 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
-
fetch
Meta.Frame fetch(Meta.StatementHandle h, long offset, int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException 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 handleoffset
- Zero-based offset of first row in the requested framefetchMaxRowCount
- Maximum number of rows to return; negative means no limit- Returns:
- Frame, or null if there are no more
- Throws:
NoSuchStatementException
MissingResultsException
-
execute
@Deprecated Meta.ExecuteResult execute(Meta.StatementHandle h, List<TypedValue> parameterValues, long maxRowCount) throws NoSuchStatementException Deprecated.Executes a prepared statement.- Parameters:
h
- Statement handleparameterValues
- A list of parameter values; may be empty, not nullmaxRowCount
- Maximum number of rows to return; negative means no limit- Returns:
- Execute result
- Throws:
NoSuchStatementException
-
execute
Meta.ExecuteResult execute(Meta.StatementHandle h, List<TypedValue> parameterValues, int maxRowsInFirstFrame) throws NoSuchStatementException Executes a prepared statement.- Parameters:
h
- Statement handleparameterValues
- A list of parameter values; may be empty, not nullmaxRowsInFirstFrame
- Maximum number of rows to return in the Frame.- Returns:
- Execute result
- Throws:
NoSuchStatementException
-
createStatement
Called during the creation of a statement to allocate a new handle.- Parameters:
ch
- Connection handle
-
closeStatement
Closes a statement.If the statement handle is not known, or is already closed, does nothing.
- Parameters:
h
- Statement handle
-
openConnection
Opens (creates) a connection. The client allocates its own connection ID which the server is then made aware of through theMeta.ConnectionHandle
. The Mapinfo
argument is analogous to theProperties
typically passed to a "normal" JDBC Driver. Avatica specific properties should not be included -- only properties for the underlying driver.- 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
Closes a connection -
syncResults
boolean syncResults(Meta.StatementHandle sh, QueryState state, long offset) throws NoSuchStatementException Re-sets theResultSet
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
Makes all changes since the last commit/rollback permanent. Analogous toConnection.commit()
.- Parameters:
ch
- A reference to the real JDBC Connection
-
rollback
Undoes all changes since the last commit/rollback. Analogous toConnection.rollback()
;- Parameters:
ch
- A reference to the real JDBC Connection
-
connectionSync
Meta.ConnectionProperties connectionSync(Meta.ConnectionHandle ch, Meta.ConnectionProperties connProps) 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
, andResultSet
.
-
execute(StatementHandle, List, int)