public class JdbcMeta extends Object implements ProtobufMeta
Meta upon an existing JDBC data source.| Modifier and Type | Class and Description |
|---|---|
static class |
JdbcMeta.ConnectionCacheSettings
Configurable connection cache settings.
|
static class |
JdbcMeta.StatementCacheSettings
Configurable statement cache settings.
|
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| Modifier and Type | Field and Description |
|---|---|
static int |
UNLIMITED_COUNT
Special value for
Statement#getLargeMaxRows() that means fetch
an unlimited number of rows in a single batch. |
| Constructor and Description |
|---|
JdbcMeta(String url)
Creates a JdbcMeta.
|
JdbcMeta(String url,
Properties info) |
JdbcMeta(String url,
Properties info,
MetricsSystem metrics)
Creates a JdbcMeta.
|
JdbcMeta(String url,
String user,
String password)
Creates a JdbcMeta.
|
public static final int UNLIMITED_COUNT
Statement#getLargeMaxRows() that means fetch
an unlimited number of rows in a single batch.
Any other negative value will return an unlimited number of rows but will do it in the default batch size, namely 100.
public JdbcMeta(String url) throws SQLException
url - a database url of the form
jdbc:subprotocol:subnameSQLExceptionpublic JdbcMeta(String url, String user, String password) throws SQLException
url - a database url of the form
jdbc:subprotocol:subnameuser - the database user on whose behalf the connection is being
madepassword - the user's passwordSQLExceptionpublic JdbcMeta(String url, Properties info) throws SQLException
SQLExceptionpublic JdbcMeta(String url, Properties info, MetricsSystem metrics) throws SQLException
url - a database url of the form
jdbc:subprotocol:subnameinfo - a list of arbitrary string tag/value pairs as
connection arguments; normally at least a "user" and
"password" property should be includedSQLExceptionprotected AtomicInteger getStatementIdGenerator()
protected com.google.common.cache.Cache<String,Connection> getConnectionCache()
protected com.google.common.cache.Cache<Integer,StatementInfo> getStatementCache()
protected static List<ColumnMetaData> columns(ResultSetMetaData metaData) throws SQLException
SQLExceptionprotected static List<AvaticaParameter> parameters(ParameterMetaData metaData) throws SQLException
SQLExceptionprotected static Meta.Signature signature(ResultSetMetaData metaData, ParameterMetaData parameterMetaData, String sql, Meta.StatementType statementType) throws SQLException
SQLExceptionprotected static Meta.Signature signature(ResultSetMetaData metaData) throws SQLException
SQLExceptionpublic Map<Meta.DatabaseProperty,Object> getDatabaseProperties(Meta.ConnectionHandle ch)
MetaThe provider can omit properties whose value is the same as the default.
getDatabaseProperties in interface Metapublic Meta.MetaResultSet getTables(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, List<String> typeList)
Metapublic Meta.MetaResultSet getColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern)
MetagetColumns in interface Metapublic Meta.MetaResultSet getSchemas(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern)
getSchemas in interface Metapublic Meta.MetaResultSet getCatalogs(Meta.ConnectionHandle ch)
MetagetCatalogs in interface Metapublic Meta.MetaResultSet getTableTypes(Meta.ConnectionHandle ch)
MetagetTableTypes in interface Metapublic Meta.MetaResultSet getProcedures(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat procedureNamePattern)
MetagetProcedures in interface Metapublic Meta.MetaResultSet getProcedureColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat procedureNamePattern, Meta.Pat columnNamePattern)
MetagetProcedureColumns in interface Metapublic Meta.MetaResultSet getColumnPrivileges(Meta.ConnectionHandle ch, String catalog, String schema, String table, Meta.Pat columnNamePattern)
MetagetColumnPrivileges in interface Metapublic Meta.MetaResultSet getTablePrivileges(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern)
MetagetTablePrivileges in interface Metapublic Meta.MetaResultSet getBestRowIdentifier(Meta.ConnectionHandle ch, String catalog, String schema, String table, int scope, boolean nullable)
MetagetBestRowIdentifier in interface Metapublic Meta.MetaResultSet getVersionColumns(Meta.ConnectionHandle ch, String catalog, String schema, String table)
MetagetVersionColumns in interface Metapublic Meta.MetaResultSet getPrimaryKeys(Meta.ConnectionHandle ch, String catalog, String schema, String table)
MetagetPrimaryKeys in interface Metapublic Meta.MetaResultSet getImportedKeys(Meta.ConnectionHandle ch, String catalog, String schema, String table)
MetagetImportedKeys in interface Metapublic Meta.MetaResultSet getExportedKeys(Meta.ConnectionHandle ch, String catalog, String schema, String table)
MetagetExportedKeys in interface Metapublic Meta.MetaResultSet getCrossReference(Meta.ConnectionHandle ch, String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)
MetagetCrossReference in interface Metapublic Meta.MetaResultSet getTypeInfo(Meta.ConnectionHandle ch)
MetagetTypeInfo in interface Metapublic Meta.MetaResultSet getIndexInfo(Meta.ConnectionHandle ch, String catalog, String schema, String table, boolean unique, boolean approximate)
MetagetIndexInfo in interface Metapublic Meta.MetaResultSet getUDTs(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern, int[] types)
Metapublic Meta.MetaResultSet getSuperTypes(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern)
MetagetSuperTypes in interface Metapublic Meta.MetaResultSet getSuperTables(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern)
MetagetSuperTables in interface Metapublic Meta.MetaResultSet getAttributes(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat typeNamePattern, Meta.Pat attributeNamePattern)
MetagetAttributes in interface Metapublic Meta.MetaResultSet getClientInfoProperties(Meta.ConnectionHandle ch)
MetagetClientInfoProperties in interface Metapublic Meta.MetaResultSet getFunctions(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat functionNamePattern)
MetagetFunctions in interface Metapublic Meta.MetaResultSet getFunctionColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat functionNamePattern, Meta.Pat columnNamePattern)
MetagetFunctionColumns in interface Metapublic Meta.MetaResultSet getPseudoColumns(Meta.ConnectionHandle ch, String catalog, Meta.Pat schemaPattern, Meta.Pat tableNamePattern, Meta.Pat columnNamePattern)
MetagetPseudoColumns in interface Metapublic Iterable<Object> createIterable(Meta.StatementHandle handle, QueryState state, Meta.Signature signature, List<TypedValue> parameterValues, Meta.Frame firstFrame)
MetaThe default implementation just returns iterable, which it
requires to be not null; derived classes may instead choose to execute the
relational expression in signature.
createIterable in interface Metaprotected Connection getConnection(String id) throws SQLException
SQLExceptionpublic Meta.StatementHandle createStatement(Meta.ConnectionHandle ch)
MetacreateStatement in interface Metach - Connection handlepublic void closeStatement(Meta.StatementHandle h)
MetaIf the statement handle is not known, or is already closed, does nothing.
closeStatement in interface Metah - Statement handlepublic void openConnection(Meta.ConnectionHandle ch, Map<String,String> info)
MetaMeta.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.openConnection in interface Metach - 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.protected Connection createConnection(String url, Properties info) throws SQLException
SQLExceptionpublic void closeConnection(Meta.ConnectionHandle ch)
MetacloseConnection in interface Metaprotected void apply(Connection conn, Meta.ConnectionProperties connProps) throws SQLException
SQLExceptionpublic Meta.ConnectionProperties connectionSync(Meta.ConnectionHandle ch, Meta.ConnectionProperties connProps)
MetaNote: 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.
connectionSync in interface Metapublic Meta.StatementHandle prepare(Meta.ConnectionHandle ch, String sql, long maxRowCount)
Metapublic Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, Meta.PrepareCallback callback) throws NoSuchStatementException
MetaprepareAndExecute in interface Metah - Statement handlesql - SQL querymaxRowCount - Negative for no limit (different meaning than JDBC)callback - Callback to lock, clear and assign cursorNoSuchStatementExceptionpublic Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, int maxRowsInFirstFrame, Meta.PrepareCallback callback) throws NoSuchStatementException
MetaprepareAndExecute in interface Metah - 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 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 cursorNoSuchStatementExceptionpublic boolean syncResults(Meta.StatementHandle sh, QueryState state, long offset) throws NoSuchStatementException
MetaResultSet on a Statement. Not a JDBC method.syncResults in interface MetaNoSuchStatementExceptionpublic Meta.Frame fetch(Meta.StatementHandle h, long offset, int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException
MetaThe 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.
fetch in interface Metah - Statement handleoffset - Zero-based offset of first row in the requested framefetchMaxRowCount - Maximum number of rows to return; negative means
no limitNoSuchStatementExceptionMissingResultsExceptionpublic Meta.ExecuteResult execute(Meta.StatementHandle h, List<TypedValue> parameterValues, long maxRowCount) throws NoSuchStatementException
Metaexecute in interface Metah - Statement handleparameterValues - A list of parameter values; may be empty, not nullmaxRowCount - Maximum number of rows to return; negative means
no limitNoSuchStatementExceptionpublic Meta.ExecuteResult execute(Meta.StatementHandle h, List<TypedValue> parameterValues, int maxRowsInFirstFrame) throws NoSuchStatementException
Metaexecute in interface Metah - Statement handleparameterValues - A list of parameter values; may be empty, not nullmaxRowsInFirstFrame - Maximum number of rows to return in the Frame.NoSuchStatementExceptionpublic void commit(Meta.ConnectionHandle ch)
MetaConnection.commit().public void rollback(Meta.ConnectionHandle ch)
MetaConnection.rollback();public Meta.ExecuteBatchResult prepareAndExecuteBatch(Meta.StatementHandle h, List<String> sqlCommands) throws NoSuchStatementException
MetaprepareAndExecuteBatch in interface Metah - Statement handlesqlCommands - SQL commands to runNoSuchStatementExceptionpublic Meta.ExecuteBatchResult executeBatch(Meta.StatementHandle h, List<List<TypedValue>> updateBatches) throws NoSuchStatementException
MetaexecuteBatch in interface Metah - Statement handleupdateBatches - A collection of list of typed values, one list per batchNoSuchStatementExceptionpublic Meta.ExecuteBatchResult executeBatchProtobuf(Meta.StatementHandle h, List<org.apache.calcite.avatica.proto.Requests.UpdateBatch> updateBatches) throws NoSuchStatementException
ProtobufMetaexecuteBatchProtobuf in interface ProtobufMetah - Statement handleupdateBatches - A collection of list of typed values, one list per batchNoSuchStatementExceptionCopyright © 2012-2025 Apache Software Foundation. All Rights Reserved.