Purpose: Mechanism used for all expression read queries. ExpressionQueryInterface understands how to deal with expressions.
Responsibilities: Translates the expression and creates the appropriate SQL statements. Retrieves the data from the database and return the results to the query.
| Modifier and Type | Field and Description |
|---|---|
| protected Expression |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | ExpressionQueryMechanism(DatabaseQuery
- owner of mechanism query, Expression - selection criteria expression)Initialize the state of the query |
| Modifier and Type | Method and Description |
|---|---|
| protected Vector | aliasFields(ObjectExpression node, Vector<E> fields)
Alias the supplied fields with respect to the expression node. |
| public Vector | aliasPresetFields(SQLSelectStatement statement)
If the fields in the statement have breen pre-set, e.g. for a subset of the fields in a partial attribute read, report query, or just a query for the class indicator, then try to alias those. |
| public Expression | buildBaseSelectionCriteria(boolean isSubSelect, Map<K, V> clonedExpressions)
Create the appropriate where clause. |
| public Expression | buildBaseSelectionCriteria(boolean isSubSelect, Map<K, V> clonedExpressions, boolean shouldUseAdditionalJoinExpression)
Create the appropriate where clause. |
| public SQLSelectStatement | buildBaseSelectStatement(boolean isSubSelect, Map<K, V> clonedExpressions)
Return the appropriate select statement containing the fields in the table. |
| public SQLSelectStatement | buildBaseSelectStatement(boolean isSubSelect, Map<K, V> clonedExpressions, boolean shouldUseAdditionalJoinExpression)
Return the appropriate select statement containing the fields in the table. |
| protected SQLSelectStatement | buildConcreteSelectStatement()
Return the appropriate select statement containing the fields in the table. |
| protected SQLDeleteStatement | Returns: SQLDeleteStatementReturn the appropriate delete statement Passing of a call/ statement pair is used because the same pair may be used several times. |
| protected SQLDeleteStatement | Returns: Vector<SQLDeleteAllStatement>Create SQLDeleteAllStatements for mappings that may be responsible for references to the objects to be deleted in the tables NOT mapped to any class: ManyToManyMapping and DirectCollectionMapping Note A similar pattern also used in method buildDeleteAllStatementsForMappingsWithTempTable(): if you are updating this method consider applying a similar update to that method as well. |
| private SQLDeleteAllStatementForTempTable | Returns: SQLDeleteAllStatementForTempTableBuild SQL delete statement which delete from target table using temporary table. |
| protected Vector | Returns: Vector<SQLDeleteAllStatement>Note A similar pattern also used in method buildDeleteAllStatementsForMappingsWithTempTable: if you are updating this method consider applying a similar update to that method as well. |
| protected Vector | Returns: Vector<SQLDeleteAllStatementForTempTable>Build delete statements with temporary table for ManyToMany and DirectCollection mappings. |
| private Vector | Returns: Vector<SQLDeleteAllStatementForTempTable>Build delete all SQLStatements using temporary table. |
| protected SQLDeleteStatement | |
| protected SQLDeleteStatement | buildDeleteStatementForDeleteAllQuery(DatabaseTable table)
Used by DeleteAllQuery to create DeleteStatement in a simple case when selectionCriteria==null. |
| protected SQLDeleteStatement | buildDeleteStatementForDeleteAllQuery(DatabaseTable table, Expression inheritanceExpression)
Used by DeleteAllQuery to create DeleteStatement in a simple case when selectionCriteria==null. |
| protected SQLInsertStatement | |
| protected SQLSelectStatement | buildNormalSelectStatement()
Return the appropriate select statement containing the fields in the table. |
| protected SQLSelectStatement | buildReportQuerySelectStatement(boolean isSubSelect)
Return the appropriate select statement containing the fields in the table. |
| protected SQLSelectStatement | buildReportQuerySelectStatement(boolean isSubSelect, boolean useCustomaryInheritanceExpression, Expression inheritanceExpression, boolean shouldUseAdditionalJoinExpression)
Customary inheritance expression is required for DeleteAllQuery and UpdateAllQuery preparation. |
| protected SQLSelectStatement | buildSelectStatementForDoesExist(DatabaseField
fields for does exist check. field)Return the appropriate select statement to perform a does exist check |
| protected Vector | Returns: Vector<SQLStatement>Build SQLStatements for delete all using temporary table. |
| protected Vector | buildStatementsForUpdateAllForTempTables(DatabaseTable table, HashMap<K, V> databaseFieldsToValues, List<DatabaseField> primaryKeyFields)
|
| protected SQLUpdateAllStatement | buildUpdateAllStatement(DatabaseTable table, HashMap<K, V> databaseFieldsToValues, SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, Collection<E> primaryKeyFields)
|
| protected SQLModifyStatement | buildUpdateAllStatementForOracleAnonymousBlock(HashMap<K, V> tables_databaseFieldsToValues, HashMap<K, V> tablesToPrimaryKeyFields)
|
| protected SQLUpdateStatement | Returns: SQLInsertStatementReturn the appropriate update statement |
| public Object | checkCacheForObject(AbstractRecord translationRow, AbstractSession session)
Overrides org. |
| public void | clearStatement()
Overrides org. |
| public DatabaseQueryMechanism | clone(DatabaseQuery queryClone)
Overrides org. |
| private List | cloneExpressions(List<Expression> originalExpressions, Map<Expression, Expression> clonedExpressions)
This method return the clones of the list of expressions. |
| private void | computeFieldExpressions(List<ReportItem> items, Map<K, V> clonedExpressions, SQLSelectStatement selectStatement, Vector<E> fieldExpressions)
|
| protected SQLSelectStatement | |
| protected SQLSelectStatement | |
| protected SQLSelectStatement | createSQLSelectStatementForModifyAll(Expression whereClause, Expression inheritanceExpression, ClassDescriptor desc, boolean useCustomaryInheritanceExpression, boolean shouldUseAdditionalJoinExpression)
Customary inheritance expression is required for DeleteAllQuery and UpdateAllQuery preparation. |
| protected SQLSelectStatement | |
| protected SQLSelectStatement | createSQLSelectStatementForUpdateAllForOracleAnonymousBlock(HashMap<K, V> tables_databaseFieldsToValues)
|
| private void | extractStatementFromItem(ReportItem item, Map<K, V> clonedExpressions, SQLSelectStatement selectStatement, Vector<E> fieldExpressions)
|
| protected static String | getAliasTableName(SQLSelectStatement selectStatement, DatabaseTable table, DatasourcePlatform platform)
|
| public ExpressionBuilder | |
| protected ClassDescriptor | getHighestDescriptorMappingTable(DatabaseTable table)
Pass to this method a table mapped by query's descriptor. |
| protected List | |
| protected List | |
| public Expression | getSelectionCriteria()
Overrides org. |
| public Vector | getSelectionFields(SQLSelectStatement statement, boolean includeAllSubclassFields)
Return the fields required in the select clause. |
| public boolean | isExpressionQueryMechanism()
Overrides org. |
| private boolean | |
| public boolean | isStatementQueryMechanism()
Overrides org. |
| public void | prepare()
Overrides org. |
| public void | prepareCursorSelectAllRows()
Overrides org. |
| public void | prepareDeleteAll()
Overrides org. |
| protected void | prepareDeleteAll(List<DatabaseTable> tablesToIgnore, boolean isWhereClauseRequired)
Pre-build the SQL statement from the expression. |
| protected void | |
| protected void | |
| public void | prepareDeleteObject()
Overrides org. |
| public void | prepareDoesExist(DatabaseField field)
Overrides org. |
| public void | prepareInsertObject()
Overrides org. |
| public void | prepareReportQuerySelectAllRows()
Pre-build the SQL statement from the expression.
|
| public void | prepareReportQuerySubSelect()
Overrides org. |
| public void | prepareSelectAllRows()
Overrides org. |
| public void | prepareSelectOneRow()
Overrides org. |
| public void | prepareUpdateAll()
Overrides org. |
| protected void | prepareUpdateAllUsingOracleAnonymousBlock(HashMap<K, V> tables_databaseFieldsToValues, HashMap<K, V> tablesToPrimaryKeyFields)
Pre-build the SQL statement from the expressions. |
| protected void | prepareUpdateAllUsingTempStorage(HashMap<K, V> tables_databaseFieldsToValues, HashMap<DatabaseTable, List<DatabaseField>> tablesToPrimaryKeyFields)
|
| protected void | prepareUpdateAllUsingTempTables(HashMap<K, V> tables_databaseFieldsToValues, HashMap<DatabaseTable, List<DatabaseField>> tablesToPrimaryKeyFields)
Pre-build the SQL statement from the expressions. |
| public void | prepareUpdateObject()
Overrides org. |
| public Vector | Returns: Vector containing the database rows.Overrides org. |
| public Vector | Returns: Vector containing the database rows.Overrides org. |
| public Vector | |
| public Vector | Returns: Vector containing the database rows.Read all rows from the database. |
| public AbstractRecord | selectOneRow()
Overrides org. |
| public AbstractRecord | |
| public AbstractRecord | |
| public void | |
| protected boolean | shouldBuildDeleteStatementForMapping(ForeignReferenceMapping frMapping, boolean dontCheckDescriptor, ClassDescriptor descriptor)
|
| protected boolean | shouldIncludeAllSubclassFields(SQLSelectStatement selectStatement)
Return whether to include all subclass fields in select statement or not. |