Class ExpressionQueryMechanism
- java.lang.Object
-
- org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
-
- org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
-
- org.eclipse.persistence.internal.queries.CallQueryMechanism
-
- org.eclipse.persistence.internal.queries.StatementQueryMechanism
-
- org.eclipse.persistence.internal.queries.ExpressionQueryMechanism
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
JPQLCallQueryMechanism
,QueryByExampleMechanism
public class ExpressionQueryMechanism extends StatementQueryMechanism
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.
- Since:
- TOPLink/Java 1.0
- Author:
- Yvon Lavoie
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Expression
selectionCriteria
-
Fields inherited from class org.eclipse.persistence.internal.queries.StatementQueryMechanism
sqlStatement, sqlStatements
-
Fields inherited from class org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
call, calls
-
Fields inherited from class org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
query
-
-
Constructor Summary
Constructors Constructor Description ExpressionQueryMechanism()
ExpressionQueryMechanism(DatabaseQuery query)
Initialize the state of the queryExpressionQueryMechanism(DatabaseQuery query, Expression expression)
Initialize the state of the query
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Vector
aliasFields(ObjectExpression node, java.util.Vector fields)
Alias the supplied fields with respect to the expression node.java.util.Vector
aliasPresetFields(SQLSelectStatement statement)
If the fields in the statement have breen pre-set, e.g.Expression
buildBaseSelectionCriteria(boolean isSubSelect, java.util.Map clonedExpressions)
Create the appropriate where clause.Expression
buildBaseSelectionCriteria(boolean isSubSelect, java.util.Map clonedExpressions, boolean shouldUseAdditionalJoinExpression)
Create the appropriate where clause.SQLSelectStatement
buildBaseSelectStatement(boolean isSubSelect, java.util.Map clonedExpressions)
Return the appropriate select statement containing the fields in the table.SQLSelectStatement
buildBaseSelectStatement(boolean isSubSelect, java.util.Map 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
buildDeleteAllStatement(DatabaseTable table, Expression inheritanceExpression, SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, SQLCall selectCallForNotExist, SQLSelectStatement selectStatementForNotExist, java.util.Collection primaryKeyFields)
Return the appropriate delete statement Passing of a call/ statement pair is used because the same pair may be used several times.protected SQLDeleteStatement
buildDeleteAllStatementForMapping(SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, java.util.Vector sourceFields, java.util.Vector targetFields)
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.protected java.util.Vector
buildDeleteAllStatementsForMappings(SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, boolean dontCheckDescriptor)
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 java.util.Vector
buildDeleteAllStatementsForMappingsWithTempTable(ClassDescriptor descriptor, DatabaseTable rootTable, boolean dontCheckDescriptor)
Build delete statements with temporary table for ManyToMany and DirectCollection mappings.protected SQLDeleteStatement
buildDeleteStatement(DatabaseTable table)
Return the appropriate delete statementprotected 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
buildInsertStatement(DatabaseTable table)
Return the appropriate insert statementprotected 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 field)
Return the appropriate select statement to perform a does exist checkprotected java.util.Vector
buildStatementsForDeleteAllForTempTables()
Build SQLStatements for delete all using temporary table.protected java.util.Vector
buildStatementsForUpdateAllForTempTables(DatabaseTable table, java.util.HashMap databaseFieldsToValues, java.util.List<DatabaseField> primaryKeyFields)
protected SQLUpdateAllStatement
buildUpdateAllStatement(DatabaseTable table, java.util.HashMap databaseFieldsToValues, SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, java.util.Collection primaryKeyFields)
protected SQLModifyStatement
buildUpdateAllStatementForOracleAnonymousBlock(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap tablesToPrimaryKeyFields)
protected SQLUpdateStatement
buildUpdateStatement(DatabaseTable table)
Return the appropriate update statement with return update columns (if any)java.lang.Object
checkCacheForObject(AbstractRecord translationRow, AbstractSession session)
Perform a cache lookup for the query This is only called from read object query.void
clearStatement()
The statement is no longer require after prepare so can be released.DatabaseQueryMechanism
clone(DatabaseQuery queryClone)
Clone the mechanism for the specified query clone.protected SQLSelectStatement
createSQLSelectStatementForAssignedExpressionForUpdateAll(Expression value)
protected SQLSelectStatement
createSQLSelectStatementForModifyAll(Expression whereClause)
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
createSQLSelectStatementForModifyAllForTempTable(java.util.HashMap databaseFieldsToValues)
protected SQLSelectStatement
createSQLSelectStatementForUpdateAllForOracleAnonymousBlock(java.util.HashMap tables_databaseFieldsToValues)
protected static java.lang.String
getAliasTableName(SQLSelectStatement selectStatement, DatabaseTable table, DatasourcePlatform platform)
ExpressionBuilder
getExpressionBuilder()
Return an expression builder which is valid for usprotected ClassDescriptor
getHighestDescriptorMappingTable(DatabaseTable table)
Pass to this method a table mapped by query's descriptor.protected java.util.List<DatabaseField>
getPrimaryKeyFieldsForTable(ClassDescriptor descriptor, DatabaseTable table)
protected java.util.List<DatabaseField>
getPrimaryKeyFieldsForTable(DatabaseTable table)
Expression
getSelectionCriteria()
Return the selection criteria of the query.java.util.Vector
getSelectionFields(SQLSelectStatement statement, boolean includeAllSubclassFields)
Return the fields required in the select clause.boolean
isExpressionQueryMechanism()
Return true if this is an expression query mechanism.boolean
isStatementQueryMechanism()
Return true if this is a statement query mechanismvoid
prepare()
Override super to do nothing.void
prepareCursorSelectAllRows()
Pre-build the SQL statement from the expression.void
prepareDeleteAll()
Pre-build the SQL statement from the expression.protected void
prepareDeleteAll(java.util.List<DatabaseTable> tablesToIgnore, boolean isWhereClauseRequired)
Pre-build the SQL statement from the expression.protected void
prepareDeleteAllUsingTempStorage()
protected void
prepareDeleteAllUsingTempTables()
void
prepareDeleteObject()
Pre-build the SQL statement from the expression.void
prepareDoesExist(DatabaseField field)
Pre-build the SQL statement from the expression.void
prepareInsertObject()
Pre-build the SQL statement from the expression.void
prepareReportQuerySelectAllRows()
Pre-build the SQL statement from the expression.void
prepareReportQuerySubSelect()
Pre-build the SQL statement from the expression.void
prepareSelectAllRows()
Pre-build the SQL statement from the expression.void
prepareSelectOneRow()
Pre-build the SQL statement from the expression.void
prepareUpdateAll()
Pre-build the SQL statement from the expressions.protected void
prepareUpdateAllUsingOracleAnonymousBlock(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap tablesToPrimaryKeyFields)
Pre-build the SQL statement from the expressions.protected void
prepareUpdateAllUsingTempStorage(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap<DatabaseTable,java.util.List<DatabaseField>> tablesToPrimaryKeyFields)
protected void
prepareUpdateAllUsingTempTables(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap<DatabaseTable,java.util.List<DatabaseField>> tablesToPrimaryKeyFields)
Pre-build the SQL statement from the expressions.void
prepareUpdateObject()
Pre-build the SQL statement from the expression.java.util.Vector
selectAllReportQueryRows()
INTERNAL Read all rows from the database.java.util.Vector
selectAllRows()
Read all rows from the database.java.util.Vector
selectAllRowsFromConcreteTable()
Read all rows from the database.java.util.Vector
selectAllRowsFromTable()
Read all rows from the database.AbstractRecord
selectOneRow()
Read a single row from the database.AbstractRecord
selectOneRowFromConcreteTable()
Read a single row from the database.AbstractRecord
selectOneRowFromTable()
Read a single row from the database.void
setSelectionCriteria(Expression expression)
Set the selection criteria of the query.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.-
Methods inherited from class org.eclipse.persistence.internal.queries.StatementQueryMechanism
configureDatabaseCall, deleteObject, executeNoSelect, getSQLStatement, getSQLStatements, hasMultipleStatements, insertObject, insertObject, isCallQueryMechanism, prepareExecuteNoSelect, prepareExecuteSelect, setCallFromStatement, setSQLStatement, setSQLStatements, trimFieldsForInsert, updateObject
-
Methods inherited from class org.eclipse.persistence.internal.queries.CallQueryMechanism
getDatabaseCall, prepareCall, prepareExecute, prepareJoining, setCallHasCustomSQLArguments, unprepare, updateForeignKeyFieldAfterInsert, updateForeignKeyFieldBeforeDelete
-
Methods inherited from class org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism
addCall, computeAndSetItemOffset, cursorSelectAllRows, deleteAll, deleteAllUsingTempTables, execute, executeCall, executeCall, executeDeferredCall, executeNoSelectCall, executeSelect, executeSelectCall, generateKeysExecuteNoSelect, getCall, getCalls, hasMultipleCalls, prepareReportQueryItems, selectResultSet, selectRowForDoesExist, setCall, setCalls, updateAll, updateAllUsingTempTables
-
Methods inherited from class org.eclipse.persistence.internal.queries.DatabaseQueryMechanism
addWriteLockFieldForInsert, buildSelectionCriteria, clone, executeWrite, executeWriteWithChangeSet, getDescriptor, getExecutionSession, getModifyRow, getQuery, getReadObjectQuery, getSession, getTranslationRow, getWriteObjectQuery, insertObjectForWrite, isJPQLCallQueryMechanism, isQueryByExampleMechanism, performUserDefinedInsert, performUserDefinedUpdate, performUserDefinedWrite, registerObjectInIdentityMap, setQuery, shallowInsertObjectForWrite, updateForeignKeyFieldAfterInsert, updateObjectAndRowWithReturnRow, updateObjectAndRowWithSequenceNumber, updateObjectAndRowWithSequenceNumber, updateObjectForWrite, updateObjectForWriteWithChangeSet
-
-
-
-
Field Detail
-
selectionCriteria
protected Expression selectionCriteria
-
-
Constructor Detail
-
ExpressionQueryMechanism
public ExpressionQueryMechanism()
-
ExpressionQueryMechanism
public ExpressionQueryMechanism(DatabaseQuery query)
Initialize the state of the query- Parameters:
query
- - owner of mechanism
-
ExpressionQueryMechanism
public ExpressionQueryMechanism(DatabaseQuery query, Expression expression)
Initialize the state of the query- Parameters:
query
- - owner of mechanismexpression
- - selection criteria
-
-
Method Detail
-
aliasFields
protected java.util.Vector aliasFields(ObjectExpression node, java.util.Vector fields)
Alias the supplied fields with respect to the expression node. Return copies of the fields
-
aliasPresetFields
public java.util.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. Right now this just guesses that they're all from the base.
-
buildBaseSelectionCriteria
public Expression buildBaseSelectionCriteria(boolean isSubSelect, java.util.Map clonedExpressions)
Create the appropriate where clause. Since this is where the selection criteria gets cloned for the first time (long after the owning query has been) many interesting things happen here.
-
buildBaseSelectionCriteria
public Expression buildBaseSelectionCriteria(boolean isSubSelect, java.util.Map clonedExpressions, boolean shouldUseAdditionalJoinExpression)
Create the appropriate where clause. Since this is where the selection criteria gets cloned for the first time (long after the owning query has been) many interesting things happen here. Ability to switch off AdditionalJoinExpression is required for DeleteAllQuery.
-
buildBaseSelectStatement
public SQLSelectStatement buildBaseSelectStatement(boolean isSubSelect, java.util.Map clonedExpressions)
Return the appropriate select statement containing the fields in the table.
-
buildBaseSelectStatement
public SQLSelectStatement buildBaseSelectStatement(boolean isSubSelect, java.util.Map clonedExpressions, boolean shouldUseAdditionalJoinExpression)
Return the appropriate select statement containing the fields in the table. Ability to switch off AdditionalJoinExpression is required for DeleteAllQuery.
-
buildConcreteSelectStatement
protected SQLSelectStatement buildConcreteSelectStatement()
Return the appropriate select statement containing the fields in the table. This is used as a second read to a concrete class with subclasses in an abstract-multiple table read.
-
buildDeleteAllStatement
protected SQLDeleteStatement buildDeleteAllStatement(DatabaseTable table, Expression inheritanceExpression, SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, SQLCall selectCallForNotExist, SQLSelectStatement selectStatementForNotExist, java.util.Collection primaryKeyFields)
Return the appropriate delete statement Passing of a call/ statement pair is used because the same pair may be used several times. More elegant orangement of passing just a statement and creating the call in the method was rejected because the same call would've been potentially re-created several times. Preconditions: if selectCallForExist != null then selectStatementForExist != null; if selectCallForNotExist != null then selectStatementForNotExist != null.- Returns:
- SQLDeleteStatement
-
buildDeleteAllStatementForMapping
protected SQLDeleteStatement buildDeleteAllStatementForMapping(SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, java.util.Vector sourceFields, java.util.Vector targetFields)
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.- Returns:
- Vector
-
buildDeleteAllStatementsForMappingsWithTempTable
protected java.util.Vector buildDeleteAllStatementsForMappingsWithTempTable(ClassDescriptor descriptor, DatabaseTable rootTable, boolean dontCheckDescriptor)
Build delete statements with temporary table for ManyToMany and DirectCollection mappings. NOTE: A similar pattern also used in method buildDeleteAllStatementsForMappings(): if you are updating this method consider applying a similar update to that method as well.- Returns:
- Vector
-
shouldBuildDeleteStatementForMapping
protected boolean shouldBuildDeleteStatementForMapping(ForeignReferenceMapping frMapping, boolean dontCheckDescriptor, ClassDescriptor descriptor)
-
getAliasTableName
protected static java.lang.String getAliasTableName(SQLSelectStatement selectStatement, DatabaseTable table, DatasourcePlatform platform)
-
buildDeleteStatementForDeleteAllQuery
protected SQLDeleteStatement buildDeleteStatementForDeleteAllQuery(DatabaseTable table)
Used by DeleteAllQuery to create DeleteStatement in a simple case when selectionCriteria==null.
-
buildDeleteStatementForDeleteAllQuery
protected SQLDeleteStatement buildDeleteStatementForDeleteAllQuery(DatabaseTable table, Expression inheritanceExpression)
Used by DeleteAllQuery to create DeleteStatement in a simple case when selectionCriteria==null.
-
buildDeleteStatement
protected SQLDeleteStatement buildDeleteStatement(DatabaseTable table)
Return the appropriate delete statement
-
buildInsertStatement
protected SQLInsertStatement buildInsertStatement(DatabaseTable table)
Return the appropriate insert statement
-
buildNormalSelectStatement
protected SQLSelectStatement buildNormalSelectStatement()
Return the appropriate select statement containing the fields in the table.
-
shouldIncludeAllSubclassFields
protected boolean shouldIncludeAllSubclassFields(SQLSelectStatement selectStatement)
Return whether to include all subclass fields in select statement or not.
-
buildReportQuerySelectStatement
protected SQLSelectStatement buildReportQuerySelectStatement(boolean isSubSelect)
Return the appropriate select statement containing the fields in the table. Similar to super except the buildBaseSelectStatement will look after setting the fields to select.
-
buildReportQuerySelectStatement
protected SQLSelectStatement buildReportQuerySelectStatement(boolean isSubSelect, boolean useCustomaryInheritanceExpression, Expression inheritanceExpression, boolean shouldUseAdditionalJoinExpression)
Customary inheritance expression is required for DeleteAllQuery and UpdateAllQuery preparation. Ability to switch off AdditionalJoinExpression is required for DeleteAllQuery.
-
buildSelectStatementForDoesExist
protected SQLSelectStatement buildSelectStatementForDoesExist(DatabaseField field)
Return the appropriate select statement to perform a does exist check- Parameters:
field
- fields for does exist check.
-
buildUpdateAllStatement
protected SQLUpdateAllStatement buildUpdateAllStatement(DatabaseTable table, java.util.HashMap databaseFieldsToValues, SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, java.util.Collection primaryKeyFields)
-
buildUpdateStatement
protected SQLUpdateStatement buildUpdateStatement(DatabaseTable table)
Return the appropriate update statement with return update columns (if any)- Returns:
- SQLUpdateStatement
-
checkCacheForObject
public java.lang.Object checkCacheForObject(AbstractRecord translationRow, AbstractSession session)
Perform a cache lookup for the query This is only called from read object query. The query has already checked that the cache should be checked.- Overrides:
checkCacheForObject
in classDatabaseQueryMechanism
-
clearStatement
public void clearStatement()
The statement is no longer require after prepare so can be released.- Overrides:
clearStatement
in classStatementQueryMechanism
-
clone
public DatabaseQueryMechanism clone(DatabaseQuery queryClone)
Clone the mechanism for the specified query clone. Should not try to clone statements.- Overrides:
clone
in classStatementQueryMechanism
-
getExpressionBuilder
public ExpressionBuilder getExpressionBuilder()
Return an expression builder which is valid for us
-
getSelectionCriteria
public Expression getSelectionCriteria()
Return the selection criteria of the query.- Overrides:
getSelectionCriteria
in classStatementQueryMechanism
-
getSelectionFields
public java.util.Vector getSelectionFields(SQLSelectStatement statement, boolean includeAllSubclassFields)
Return the fields required in the select clause. This must now be called after normalization, so it will get the aliased fields
-
isExpressionQueryMechanism
public boolean isExpressionQueryMechanism()
Return true if this is an expression query mechanism.- Overrides:
isExpressionQueryMechanism
in classDatabaseQueryMechanism
-
isStatementQueryMechanism
public boolean isStatementQueryMechanism()
Return true if this is a statement query mechanism- Overrides:
isStatementQueryMechanism
in classStatementQueryMechanism
-
prepare
public void prepare() throws QueryException
Override super to do nothing.- Overrides:
prepare
in classStatementQueryMechanism
- Throws:
QueryException
-
prepareCursorSelectAllRows
public void prepareCursorSelectAllRows()
Pre-build the SQL statement from the expression.- Overrides:
prepareCursorSelectAllRows
in classStatementQueryMechanism
-
prepareDeleteAll
public void prepareDeleteAll()
Pre-build the SQL statement from the expression.- Overrides:
prepareDeleteAll
in classStatementQueryMechanism
-
prepareDeleteAll
protected void prepareDeleteAll(java.util.List<DatabaseTable> tablesToIgnore, boolean isWhereClauseRequired)
Pre-build the SQL statement from the expression. NOTE: A similar pattern also used in method buildDeleteAllStatementsForTempTable(): if you are updating this method consider applying a similar update to that method as well.
-
prepareDeleteAllUsingTempStorage
protected void prepareDeleteAllUsingTempStorage()
-
prepareDeleteAllUsingTempTables
protected void prepareDeleteAllUsingTempTables()
-
buildDeleteAllStatementsForMappings
protected java.util.Vector buildDeleteAllStatementsForMappings(SQLCall selectCallForExist, SQLSelectStatement selectStatementForExist, boolean dontCheckDescriptor)
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.- Returns:
- Vector
-
createSQLSelectStatementForModifyAll
protected SQLSelectStatement createSQLSelectStatementForModifyAll(Expression whereClause)
-
createSQLSelectStatementForModifyAll
protected SQLSelectStatement createSQLSelectStatementForModifyAll(Expression whereClause, Expression inheritanceExpression, ClassDescriptor desc, boolean useCustomaryInheritanceExpression, boolean shouldUseAdditionalJoinExpression)
Customary inheritance expression is required for DeleteAllQuery and UpdateAllQuery preparation. Ability to switch off AdditionalJoinExpression is required for DeleteAllQuery.
-
createSQLSelectStatementForAssignedExpressionForUpdateAll
protected SQLSelectStatement createSQLSelectStatementForAssignedExpressionForUpdateAll(Expression value)
-
prepareDeleteObject
public void prepareDeleteObject()
Pre-build the SQL statement from the expression.- Overrides:
prepareDeleteObject
in classStatementQueryMechanism
-
prepareDoesExist
public void prepareDoesExist(DatabaseField field)
Pre-build the SQL statement from the expression.- Overrides:
prepareDoesExist
in classStatementQueryMechanism
-
prepareInsertObject
public void prepareInsertObject()
Pre-build the SQL statement from the expression.- Overrides:
prepareInsertObject
in classStatementQueryMechanism
-
prepareReportQuerySelectAllRows
public void prepareReportQuerySelectAllRows()
Pre-build the SQL statement from the expression.- Overrides:
prepareReportQuerySelectAllRows
in classDatasourceCallQueryMechanism
-
prepareReportQuerySubSelect
public void prepareReportQuerySubSelect()
Pre-build the SQL statement from the expression. This is used for subselects, so does not normalize or generate the SQL as it needs the outer expression for this.- Overrides:
prepareReportQuerySubSelect
in classDatasourceCallQueryMechanism
-
prepareSelectAllRows
public void prepareSelectAllRows()
Pre-build the SQL statement from the expression.- Overrides:
prepareSelectAllRows
in classStatementQueryMechanism
-
prepareSelectOneRow
public void prepareSelectOneRow()
Pre-build the SQL statement from the expression.- Overrides:
prepareSelectOneRow
in classStatementQueryMechanism
-
prepareUpdateObject
public void prepareUpdateObject()
Pre-build the SQL statement from the expression.- Overrides:
prepareUpdateObject
in classStatementQueryMechanism
-
prepareUpdateAll
public void prepareUpdateAll()
Pre-build the SQL statement from the expressions.- Overrides:
prepareUpdateAll
in classStatementQueryMechanism
-
createSQLSelectStatementForUpdateAllForOracleAnonymousBlock
protected SQLSelectStatement createSQLSelectStatementForUpdateAllForOracleAnonymousBlock(java.util.HashMap tables_databaseFieldsToValues)
-
createSQLSelectStatementForModifyAllForTempTable
protected SQLSelectStatement createSQLSelectStatementForModifyAllForTempTable(java.util.HashMap databaseFieldsToValues)
-
buildUpdateAllStatementForOracleAnonymousBlock
protected SQLModifyStatement buildUpdateAllStatementForOracleAnonymousBlock(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap tablesToPrimaryKeyFields)
-
prepareUpdateAllUsingTempStorage
protected void prepareUpdateAllUsingTempStorage(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap<DatabaseTable,java.util.List<DatabaseField>> tablesToPrimaryKeyFields)
-
prepareUpdateAllUsingOracleAnonymousBlock
protected void prepareUpdateAllUsingOracleAnonymousBlock(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap tablesToPrimaryKeyFields)
Pre-build the SQL statement from the expressions.
-
prepareUpdateAllUsingTempTables
protected void prepareUpdateAllUsingTempTables(java.util.HashMap tables_databaseFieldsToValues, java.util.HashMap<DatabaseTable,java.util.List<DatabaseField>> tablesToPrimaryKeyFields)
Pre-build the SQL statement from the expressions.
-
buildStatementsForDeleteAllForTempTables
protected java.util.Vector buildStatementsForDeleteAllForTempTables()
Build SQLStatements for delete all using temporary table.- Returns:
- Vector
-
buildStatementsForUpdateAllForTempTables
protected java.util.Vector buildStatementsForUpdateAllForTempTables(DatabaseTable table, java.util.HashMap databaseFieldsToValues, java.util.List<DatabaseField> primaryKeyFields)
-
getPrimaryKeyFieldsForTable
protected java.util.List<DatabaseField> getPrimaryKeyFieldsForTable(DatabaseTable table)
-
getPrimaryKeyFieldsForTable
protected java.util.List<DatabaseField> getPrimaryKeyFieldsForTable(ClassDescriptor descriptor, DatabaseTable table)
-
selectAllReportQueryRows
public java.util.Vector selectAllReportQueryRows() throws DatabaseException
INTERNAL Read all rows from the database. The code to retrieve the full inheritance hierarchy was removed.- Overrides:
selectAllReportQueryRows
in classDatasourceCallQueryMechanism
- Returns:
- Vector containing the database rows.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
selectAllRows
public java.util.Vector selectAllRows() throws DatabaseException
Read all rows from the database.- Overrides:
selectAllRows
in classDatasourceCallQueryMechanism
- Returns:
- Vector containing the database rows.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
selectAllRowsFromConcreteTable
public java.util.Vector selectAllRowsFromConcreteTable() throws DatabaseException
Read all rows from the database. This is used only from query mechanism on a abstract-multiple table read.- Throws:
DatabaseException
-
selectAllRowsFromTable
public java.util.Vector selectAllRowsFromTable() throws DatabaseException
Read all rows from the database.- Returns:
- Vector containing the database rows.
- Throws:
DatabaseException
- - an error has occurred on the database.
-
selectOneRow
public AbstractRecord selectOneRow() throws DatabaseException
Read a single row from the database. Create an SQL statement object, use it to create an SQL command string, and delegate row building responsibility to the accessor.- Overrides:
selectOneRow
in classDatasourceCallQueryMechanism
- Returns:
- row containing data
- Throws:
DatabaseException
- - an error has occurred on the database
-
selectOneRowFromConcreteTable
public AbstractRecord selectOneRowFromConcreteTable() throws DatabaseException
Read a single row from the database. This is used from query mechanism during an abstract-multiple table read.- Throws:
DatabaseException
-
selectOneRowFromTable
public AbstractRecord selectOneRowFromTable() throws DatabaseException
Read a single row from the database. Create an SQL statement object, use it to create an SQL command string, and delegate row building responsibility to the accessor.- Throws:
DatabaseException
-
setSelectionCriteria
public void setSelectionCriteria(Expression expression)
Set the selection criteria of the query.
-
getHighestDescriptorMappingTable
protected ClassDescriptor getHighestDescriptorMappingTable(DatabaseTable table)
Pass to this method a table mapped by query's descriptor. Returns the highest descriptor in inheritance hierarchy that mapps this table.
-
-