public abstract class QueryPostprocessDataContext extends AbstractDataContext implements HasReadTypeConverters
| Modifier and Type | Field and Description |
|---|---|
static String |
INFORMATION_SCHEMA_NAME |
| Constructor and Description |
|---|
QueryPostprocessDataContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConverter(Column column,
TypeConverter<?,?> converter)
Adds a
TypeConverter to this DataContext's query engine (Query
Postprocessor) for read operations. |
protected Number |
executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed)
Executes a simple count query, if possible.
|
protected Row |
executePrimaryKeyLookupQuery(Table table,
List<SelectItem> selectItems,
Column primaryKeyColumn,
Object keyValue)
Executes a query which obtains a row by primary key (as defined by
Column.isPrimaryKey()). |
DataSet |
executeQuery(Query query)
Executes a query against the DataContext.
|
protected String |
getDefaultSchemaName()
Gets the name of the default schema.
|
protected abstract Schema |
getMainSchema() |
protected Schema |
getMainSchemaInternal()
Deprecated.
use
AbstractDataContext.getDefaultSchema() instead |
protected abstract String |
getMainSchemaName() |
protected Schema |
getSchemaByNameInternal(String name)
Gets a specific schema from the non-abstract implementation.
|
protected String[] |
getSchemaNamesInternal()
Gets schema names from the non-abstract implementation.
|
protected boolean |
isMainSchemaTable(Table table) |
protected boolean |
isScalarFunctionMaterialized(ScalarFunction function)
Determines if the subclass of this class can materialize
SelectItems with the given ScalarFunction. |
protected DataSet |
materializeFromItem(FromItem fromItem,
List<SelectItem> selectItems) |
protected abstract DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
Executes a simple one-table query against a table in the main schema of
the subclasses of this class.
|
protected DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int firstRow,
int maxRows)
Executes a simple one-table query against a table in the main schema of
the subclasses of this class.
|
protected DataSet |
materializeMainSchemaTable(Table table,
List<SelectItem> selectItems,
int firstRow,
int maxRows)
Executes a simple one-table query against a table in the main schema of
the subclasses of this class.
|
protected DataSet |
materializeMainSchemaTable(Table table,
List<SelectItem> selectItems,
List<FilterItem> whereItems,
int firstRow,
int maxRows)
Execute a simple one-table query against a table in the main schema of
the subclasses of this class.
|
protected DataSet |
materializeTable(Table table,
List<SelectItem> selectItems,
int firstRow,
int maxRows)
Deprecated.
|
protected DataSet |
materializeTable(Table table,
List<SelectItem> selectItems,
List<FilterItem> whereItems,
int firstRow,
int maxRows) |
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, onSchemaCacheRefreshed, parseQuery, query, refreshSchemaspublic static final String INFORMATION_SCHEMA_NAME
public DataSet executeQuery(Query query)
DataContextexecuteQuery in interface DataContextquery - the query object to executeDataSet produced from executing the queryprotected Number executeCountQuery(Table table, List<FilterItem> whereItems, boolean functionApproximationAllowed)
table - the table on which the count is requested.whereItems - a (sometimes empty) list of WHERE items.functionApproximationAllowed - whether approximation is allowed or not.protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn, Object keyValue)
Column.isPrimaryKey()). This method is provided to allow
subclasses to optimize lookup queries since they are quite common and
often a datastore can retrieve the row using some specialized means which
is much more performant than scanning all records manually.table - the table on which the lookup is requested.selectItems - the items to select from the lookup query.primaryKeyColumn - the column that is the primary keykeyValue - the primary key value that is specified in the lookup query.protected DataSet materializeFromItem(FromItem fromItem, List<SelectItem> selectItems)
protected DataSet materializeTable(Table table, List<SelectItem> selectItems, List<FilterItem> whereItems, int firstRow, int maxRows)
protected boolean isScalarFunctionMaterialized(ScalarFunction function)
SelectItems with the given ScalarFunction. Usually scalar
functions are applied by MetaModel on the client side, but when possible
they can also be handled by e.g.
materializeMainSchemaTable(Table, List, int, int) and
materializeMainSchemaTable(Table, List, List, int, int) in which
case MetaModel will not evaluate it client-side.function - @Deprecated protected DataSet materializeTable(Table table, List<SelectItem> selectItems, int firstRow, int maxRows)
protected boolean isMainSchemaTable(Table table)
protected final String[] getSchemaNamesInternal() throws MetaModelException
AbstractDataContextAbstractDataContext.refreshSchemas() method is
called.getSchemaNamesInternal in class AbstractDataContextMetaModelExceptionprotected String getDefaultSchemaName() throws MetaModelException
AbstractDataContextgetDefaultSchemaName in class AbstractDataContextMetaModelExceptionprotected final Schema getSchemaByNameInternal(String name) throws MetaModelException
AbstractDataContextAbstractDataContext.refreshSchemas() method is
called.getSchemaByNameInternal in class AbstractDataContextname - the name of the schema to getMetaModelException@Deprecated protected Schema getMainSchemaInternal()
AbstractDataContext.getDefaultSchema() insteadpublic void addConverter(Column column, TypeConverter<?,?> converter)
TypeConverter to this DataContext's query engine (Query
Postprocessor) for read operations. Note that this method should NOT be
invoked directly by consuming code. Rather use
Converters.addTypeConverter(DataContext, Column, TypeConverter)
to ensure conversion on both reads and writes.addConverter in interface HasReadTypeConvertersprotected abstract Schema getMainSchema() throws MetaModelException
MetaModelExceptionprotected abstract String getMainSchemaName() throws MetaModelException
MetaModelExceptionprotected DataSet materializeMainSchemaTable(Table table, List<SelectItem> selectItems, List<FilterItem> whereItems, int firstRow, int maxRows)
materializeMainSchemaTable(Table, List, int, int) and apply
WHERE item filtering afterwards.table - selectItems - whereItems - firstRow - maxRows - protected DataSet materializeMainSchemaTable(Table table, List<SelectItem> selectItems, int firstRow, int maxRows)
materializeMainSchemaTable(Table, Column[], int, int).table - selectItems - firstRow - maxRows - protected DataSet materializeMainSchemaTable(Table table, Column[] columns, int firstRow, int maxRows)
materializeMainSchemaTable(Table, Column[], int) and apply a
FirstRowDataSet if necessary.table - columns - firstRow - maxRows - protected abstract DataSet materializeMainSchemaTable(Table table, Column[] columns, int maxRows)
table - the table to querycolumns - the columns of the table to querymaxRows - the maximum amount of rows needed or -1 if all rows are
wanted.Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.