@InterfaceStability.Evolving public abstract class AbstractDataContext extends Object implements DataContext
| Constructor and Description |
|---|
AbstractDataContext() |
| Modifier and Type | Method and Description |
|---|---|
CompiledQuery |
compileQuery(Query query)
Compiles a query, preparing it for reuse.
|
DataSet |
executeQuery(CompiledQuery compiledQuery,
Object... values)
Executes a compiled query with given values as parameters.
|
DataSet |
executeQuery(String queryString)
Parses and executes a string-based SQL query.
|
Column |
getColumnByQualifiedLabel(String columnName)
Finds a column in the DataContext based on a fully qualified column
label.
|
Schema |
getDefaultSchema()
Gets the default schema of this DataContext.
|
protected abstract String |
getDefaultSchemaName()
Gets the name of the default schema.
|
Schema |
getSchemaByName(String name)
Gets a schema by a specified name.
|
protected abstract Schema |
getSchemaByNameInternal(String name)
Gets a specific schema from the non-abstract implementation.
|
List<String> |
getSchemaNames()
m Gets the names of all schemas within this DataContext.
|
protected abstract List<String> |
getSchemaNamesInternal()
Gets schema names from the non-abstract implementation.
|
List<Schema> |
getSchemas()
Gets all schemas within this DataContext.
|
Table |
getTableByQualifiedLabel(String tableName)
Finds a table in the DataContext based on a fully qualified table label.
|
protected boolean |
isQualifiedPathDelim(char c) |
protected void |
onSchemaCacheRefreshed()
Method invoked when schemas have been refreshed using
refreshSchemas(). |
Query |
parseQuery(String queryString)
Parses a string-based SQL query and produces a corresponding
Query object. |
InitFromBuilder |
query()
Starts building a query using the query builder API.
|
DataContext |
refreshSchemas()
Enforces a refresh of the schemas.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteQuerypublic final DataContext refreshSchemas()
refreshSchemas in interface DataContextprotected void onSchemaCacheRefreshed()
refreshSchemas(). Can be overridden to add
callback functionality in subclasses.public final List<Schema> getSchemas() throws MetaModelException
getSchemas in interface DataContextMetaModelException - if an error occurs retrieving the schema modelpublic final List<String> getSchemaNames() throws MetaModelException
getSchemaNames in interface DataContextMetaModelException - if an error occurs retrieving the schema modelpublic final Schema getDefaultSchema() throws MetaModelException
getDefaultSchema in interface DataContextMetaModelException - if an error occurs retrieving the schema modelpublic final InitFromBuilder query()
query in interface DataContextpublic Query parseQuery(String queryString) throws MetaModelException
Query object.parseQuery in interface DataContextqueryString - the SQL query to parseQuery object corresponding to the SQL query.MetaModelException - in case the parsing was unsuccesful.public CompiledQuery compileQuery(Query query) throws MetaModelException
DataContextQueryParameters as operands in the
WHERE clause, making it possible to reuse the same query with different
parameter values.compileQuery in interface DataContextquery - the query object to execute, possibly holding one or more
QueryParameters.CompiledQuery after preparing the queryMetaModelException - if preparing the query is unsuccesfulCompiledQuery,
QueryParameterpublic DataSet executeQuery(CompiledQuery compiledQuery, Object... values)
DataContextexecuteQuery in interface DataContextcompiledQuery - the compiledQuery object to executevalues - the values for parameters in the CompiledQuery.DataSet produced from executing the query.public final DataSet executeQuery(String queryString) throws MetaModelException
DataContext.parseQuery(String) and then DataContext.executeQuery(Query) with
the parsed query.executeQuery in interface DataContextqueryString - the SQL query to parseDataSet produced from executing the queryMetaModelException - if either parsing or executing the query produces an
exceptionpublic final Schema getSchemaByName(String name) throws MetaModelException
getSchemaByName in interface DataContextname - the name of the desired schemaMetaModelException - if an error occurs retrieving the schema modelpublic final Column getColumnByQualifiedLabel(String columnName)
getColumnByQualifiedLabel in interface DataContextpublic final Table getTableByQualifiedLabel(String tableName)
getTableByQualifiedLabel in interface DataContextprotected boolean isQualifiedPathDelim(char c)
protected abstract List<String> getSchemaNamesInternal()
refreshSchemas() method is called.protected abstract String getDefaultSchemaName()
protected abstract Schema getSchemaByNameInternal(String name)
refreshSchemas() method is called.name - the name of the schema to getCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.