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.
|
String[] |
getSchemaNames()
m Gets the names of all schemas within this DataContext.
|
protected abstract String[] |
getSchemaNamesInternal()
Gets schema names from the non-abstract implementation.
|
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) |
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, wait
executeQuery
public final DataContext refreshSchemas()
refreshSchemas
in interface DataContext
public final Schema[] getSchemas() throws MetaModelException
getSchemas
in interface DataContext
MetaModelException
- if an error occurs retrieving the schema modelpublic final String[] getSchemaNames() throws MetaModelException
getSchemaNames
in interface DataContext
MetaModelException
- if an error occurs retrieving the schema modelpublic final Schema getDefaultSchema() throws MetaModelException
getDefaultSchema
in interface DataContext
MetaModelException
- if an error occurs retrieving the schema modelpublic final InitFromBuilder query()
query
in interface DataContext
public Query parseQuery(String queryString) throws MetaModelException
Query
object.parseQuery
in interface DataContext
queryString
- 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
DataContext
QueryParameter
s as operands in the
WHERE clause, making it possible to reuse the same query with different
parameter values.compileQuery
in interface DataContext
query
- the query object to execute, possibly holding one or more
QueryParameter
s.CompiledQuery
after preparing the queryMetaModelException
- if preparing the query is unsuccesfulCompiledQuery
,
QueryParameter
public DataSet executeQuery(CompiledQuery compiledQuery, Object... values)
DataContext
executeQuery
in interface DataContext
compiledQuery
- 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 DataContext
DataSet
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 DataContext
name
- the name of the desired schemaMetaModelException
- if an error occurs retrieving the schema modelpublic final Column getColumnByQualifiedLabel(String columnName)
getColumnByQualifiedLabel
in interface DataContext
public final Table getTableByQualifiedLabel(String tableName)
getTableByQualifiedLabel
in interface DataContext
protected boolean isQualifiedPathDelim(char c)
protected abstract 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–2014 The Apache Software Foundation. All rights reserved.