in core/src/main/java/org/apache/calcite/avatica/Meta.java [64:374]
MetaResultSet getTables(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat tableNamePattern,
List<String> typeList);
/** Per {@link DatabaseMetaData#getColumns(String, String, String, String)}. */
MetaResultSet getColumns(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat tableNamePattern,
Pat columnNamePattern);
MetaResultSet getSchemas(ConnectionHandle ch, String catalog, Pat schemaPattern);
/** Per {@link DatabaseMetaData#getCatalogs()}. */
MetaResultSet getCatalogs(ConnectionHandle ch);
/** Per {@link DatabaseMetaData#getTableTypes()}. */
MetaResultSet getTableTypes(ConnectionHandle ch);
/** Per {@link DatabaseMetaData#getProcedures(String, String, String)}. */
MetaResultSet getProcedures(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat procedureNamePattern);
/** Per {@link DatabaseMetaData#getProcedureColumns(String, String, String, String)}. */
MetaResultSet getProcedureColumns(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat procedureNamePattern,
Pat columnNamePattern);
/** Per {@link DatabaseMetaData#getColumnPrivileges(String, String, String, String)}. */
MetaResultSet getColumnPrivileges(ConnectionHandle ch,
String catalog,
String schema,
String table,
Pat columnNamePattern);
/** Per {@link DatabaseMetaData#getTablePrivileges(String, String, String)}. */
MetaResultSet getTablePrivileges(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat tableNamePattern);
/** Per
* {@link DatabaseMetaData#getBestRowIdentifier(String, String, String, int, boolean)}. */
MetaResultSet getBestRowIdentifier(ConnectionHandle ch,
String catalog,
String schema,
String table,
int scope,
boolean nullable);
/** Per {@link DatabaseMetaData#getVersionColumns(String, String, String)}. */
MetaResultSet getVersionColumns(ConnectionHandle ch, String catalog, String schema, String table);
/** Per {@link DatabaseMetaData#getPrimaryKeys(String, String, String)}. */
MetaResultSet getPrimaryKeys(ConnectionHandle ch, String catalog, String schema, String table);
/** Per {@link DatabaseMetaData#getImportedKeys(String, String, String)}. */
MetaResultSet getImportedKeys(ConnectionHandle ch, String catalog, String schema, String table);
/** Per {@link DatabaseMetaData#getExportedKeys(String, String, String)}. */
MetaResultSet getExportedKeys(ConnectionHandle ch, String catalog, String schema, String table);
/** Per
* {@link DatabaseMetaData#getCrossReference(String, String, String, String, String, String)}. */
MetaResultSet getCrossReference(ConnectionHandle ch,
String parentCatalog,
String parentSchema,
String parentTable,
String foreignCatalog,
String foreignSchema,
String foreignTable);
/** Per {@link DatabaseMetaData#getTypeInfo()}. */
MetaResultSet getTypeInfo(ConnectionHandle ch);
/** Per {@link DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean)}. */
MetaResultSet getIndexInfo(ConnectionHandle ch, String catalog,
String schema,
String table,
boolean unique,
boolean approximate);
/** Per {@link DatabaseMetaData#getUDTs(String, String, String, int[])}. */
MetaResultSet getUDTs(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat typeNamePattern,
int[] types);
/** Per {@link DatabaseMetaData#getSuperTypes(String, String, String)}. */
MetaResultSet getSuperTypes(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat typeNamePattern);
/** Per {@link DatabaseMetaData#getSuperTables(String, String, String)}. */
MetaResultSet getSuperTables(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat tableNamePattern);
/** Per {@link DatabaseMetaData#getAttributes(String, String, String, String)}. */
MetaResultSet getAttributes(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat typeNamePattern,
Pat attributeNamePattern);
/** Per {@link DatabaseMetaData#getClientInfoProperties()}. */
MetaResultSet getClientInfoProperties(ConnectionHandle ch);
/** Per {@link DatabaseMetaData#getFunctions(String, String, String)}. */
MetaResultSet getFunctions(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat functionNamePattern);
/** Per {@link DatabaseMetaData#getFunctionColumns(String, String, String, String)}. */
MetaResultSet getFunctionColumns(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat functionNamePattern,
Pat columnNamePattern);
/** Per {@link DatabaseMetaData#getPseudoColumns(String, String, String, String)}. */
MetaResultSet getPseudoColumns(ConnectionHandle ch,
String catalog,
Pat schemaPattern,
Pat tableNamePattern,
Pat columnNamePattern);
/** Creates an iterable for a result set.
*
* <p>The default implementation just returns {@code iterable}, which it
* requires to be not null; derived classes may instead choose to execute the
* relational expression in {@code signature}. */
Iterable<Object> createIterable(StatementHandle stmt, QueryState state, Signature signature,
List<TypedValue> parameters, Frame firstFrame);
/** Prepares a statement.
*
* @param ch Connection handle
* @param sql SQL query
* @param maxRowCount Negative for no limit (different meaning than JDBC)
* @return Signature of prepared statement
*/
StatementHandle prepare(ConnectionHandle ch, String sql, long maxRowCount);
/** Prepares and executes a statement.
*
* @param h Statement handle
* @param sql SQL query
* @param maxRowCount Negative for no limit (different meaning than JDBC)
* @param callback Callback to lock, clear and assign cursor
*
* @return Result containing statement ID, and if a query, a result set and
* first frame of data
* @deprecated See {@link #prepareAndExecute(StatementHandle, String, long, int, PrepareCallback)}
*/
@Deprecated // to be removed before 2.0
ExecuteResult prepareAndExecute(StatementHandle h, String sql,
long maxRowCount, PrepareCallback callback) throws NoSuchStatementException;
/** Prepares and executes a statement.
*
* @param h Statement handle
* @param sql SQL query
* @param maxRowCount Maximum number of rows for the entire query. Negative for no limit
* (different meaning than JDBC).
* @param maxRowsInFirstFrame Maximum number of rows for the first frame. This value should
* always be less than or equal to {@code maxRowCount} as the number of results are guaranteed
* to be restricted by {@code maxRowCount} and the underlying database.
* @param callback Callback to lock, clear and assign cursor
*
* @return Result containing statement ID, and if a query, a result set and
* first frame of data
*/
ExecuteResult prepareAndExecute(StatementHandle h, String sql,
long maxRowCount, int maxRowsInFirstFrame, PrepareCallback callback)
throws NoSuchStatementException;
/** Prepares a statement and then executes a number of SQL commands in one pass.
*
* @param h Statement handle
* @param sqlCommands SQL commands to run
* @return An array of update counts containing one element for each command in the batch.
*/
ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h, List<String> sqlCommands)
throws NoSuchStatementException;
/** Executes a collection of bound parameter values on a prepared statement.
*
* @param h Statement handle
* @param parameterValues A collection of list of typed values, one list per batch
* @return An array of update counts containing one element for each command in the batch.
*/
ExecuteBatchResult executeBatch(StatementHandle h, List<List<TypedValue>> parameterValues)
throws NoSuchStatementException;
/** Returns a frame of rows.
*
* <p>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.
*
* <p>The default implementation always returns null.
*
* @param h Statement handle
* @param offset Zero-based offset of first row in the requested frame
* @param fetchMaxRowCount Maximum number of rows to return; negative means
* no limit
* @return Frame, or null if there are no more
*/
Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
NoSuchStatementException, MissingResultsException;
/** Executes a prepared statement.
*
* @param h Statement handle
* @param parameterValues A list of parameter values; may be empty, not null
* @param maxRowCount Maximum number of rows to return; negative means
* no limit
* @return Execute result
* @deprecated See {@link #execute(StatementHandle, List, int)}
*/
@Deprecated // to be removed before 2.0
ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
long maxRowCount) throws NoSuchStatementException;
/** Executes a prepared statement.
*
* @param h Statement handle
* @param parameterValues A list of parameter values; may be empty, not null
* @param maxRowsInFirstFrame Maximum number of rows to return in the Frame.
* @return Execute result
*/
ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
int maxRowsInFirstFrame) throws NoSuchStatementException;
/** Called during the creation of a statement to allocate a new handle.
*
* @param ch Connection handle
*/
StatementHandle createStatement(ConnectionHandle ch);
/** Closes a statement.
*
* <p>If the statement handle is not known, or is already closed, does
* nothing.
*
* @param h Statement handle
*/
void closeStatement(StatementHandle h);
/**
* Opens (creates) a connection. The client allocates its own connection ID which the server is
* then made aware of through the {@link ConnectionHandle}. The Map {@code info} argument is
* analogous to the {@link Properties} typically passed to a "normal" JDBC Driver. Avatica
* specific properties should not be included -- only properties for the underlying driver.
*
* @param ch A ConnectionHandle encapsulates information about the connection to be opened
* as provided by the client.
* @param info A Map corresponding to the Properties typically passed to a JDBC Driver.
*/
void openConnection(ConnectionHandle ch, Map<String, String> info);
/** Closes a connection */
void closeConnection(ConnectionHandle ch);
/**
* Re-sets the {@link ResultSet} on a Statement. Not a JDBC method.
*
* @return True if there are results to fetch after resetting to the given offset. False otherwise
*/
boolean syncResults(StatementHandle sh, QueryState state, long offset)
throws NoSuchStatementException;
/**
* Makes all changes since the last commit/rollback permanent. Analogous to
* {@link Connection#commit()}.
*
* @param ch A reference to the real JDBC Connection
*/
void commit(ConnectionHandle ch);
/**
* Undoes all changes since the last commit/rollback. Analogous to
* {@link Connection#rollback()};
*
* @param ch A reference to the real JDBC Connection
*/
void rollback(ConnectionHandle ch);
/** Synchronizes client and server view of connection properties.
*
* <p>Note: this interface is considered "experimental" and may undergo further changes as this
* functionality is extended to other aspects of state management for
* {@link java.sql.Connection}, {@link java.sql.Statement}, and {@link java.sql.ResultSet}.</p>
*/
ConnectionProperties connectionSync(ConnectionHandle ch, ConnectionProperties connProps);
/** Factory to create instances of {@link Meta}. */
interface Factory {
Meta create(List<String> args);
}