Top Description Fields Constructors Methods
org.eclipse.persistence.internal.queries

public Class StatementQueryMechanism

extends CallQueryMechanism
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.queries.ExpressionQueryMechanism
Imports
java.util.Enumeration, .Vector, org.eclipse.persistence.exceptions.DatabaseException, .QueryException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.databaseaccess.DatabaseCall, .DatasourceCall, org.eclipse.persistence.internal.expressions.SQLModifyStatement, .SQLStatement, .SQLUpdateStatement, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.queries.Call, .DatabaseQuery, org.eclipse.persistence.sessions.SessionProfiler

Purpose: Mechanism used for all statement objects.

Responsibilities: Executes the appropriate statement.

Author
Yvon Lavoie
Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected SQLStatement
protected Vector<E>
sqlStatements

Normally only a single statement is used, however multiple table may require multiple statements on write.

Constructor Summary

AccessConstructor and Description
public
public
StatementQueryMechanism(DatabaseQuery
- owner of mechanism
query
)

INTERNAL: Return a new mechanism for the query

public
StatementQueryMechanism(DatabaseQuery
- owner of mechanism
query
,
SQLStatement
- sql statement
statement
)

Return a new mechanism for the query

Method Summary

Modifier and TypeMethod and Description
public void
clearStatement()

The statement is no longer require after prepare so can be released.

public DatabaseQueryMechanism
clone(DatabaseQuery queryClone)

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.clone.

Clone the mechanism for the specified query clone.
protected void
public Integer

Returns:

the row count.
deleteObject
()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.deleteObject.

INTERNAL: delete the object
public Object
public Expression
public SQLStatement
getSQLStatement()

INTERNAL: Return the sqlStatement

public Vector<E>
getSQLStatements()

Normally only a single statement is used, however multiple table may require multiple statements on write.

public boolean
hasMultipleStatements()

Normally only a single statement is used, however multiple table may require multiple statements on write.

public void
public void
insertObject(boolean
whether to reprepare the query.
reprepare
)

Overrides org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObject.

Insert the object if the reprepare flag is set, first reprepare the query.
public boolean
public boolean
public void
prepare()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.prepare.

INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query.
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
protected void
setCallFromStatement()

Pre-build the SQL call from the statement.

public void
setSQLStatement(SQLStatement statement)

Set the sqlStatement

protected void
setSQLStatements(Vector<E> sqlStatements)

Normally only a single statement is used, however multiple table may require multiple statements on write.

public void
trimFieldsForInsert()

INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert method

public Integer
Inherited from org.eclipse.persistence.internal.queries.CallQueryMechanism:
getDatabaseCallprepareCallprepareExecuteprepareJoiningsetCallHasCustomSQLArgumentsunprepareupdateForeignKeyFieldAfterInsertupdateForeignKeyFieldBeforeDelete

Field Detail

sqlStatementback to summary
protected SQLStatement sqlStatement
sqlStatementsback to summary
protected Vector<E> sqlStatements

Normally only a single statement is used, however multiple table may require multiple statements on write.

Constructor Detail

StatementQueryMechanismback to summary
public StatementQueryMechanism()
StatementQueryMechanismback to summary
public StatementQueryMechanism(DatabaseQuery query)

INTERNAL: Return a new mechanism for the query

Parameters
query:DatabaseQuery

- owner of mechanism

StatementQueryMechanismback to summary
public StatementQueryMechanism(DatabaseQuery query, SQLStatement statement)

Return a new mechanism for the query

Parameters
query:DatabaseQuery

- owner of mechanism

statement:SQLStatement

- sql statement

Method Detail

clearStatementback to summary
public void clearStatement()

The statement is no longer require after prepare so can be released.

cloneback to summary
public DatabaseQueryMechanism clone(DatabaseQuery queryClone)

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.clone.

Clone the mechanism for the specified query clone.

Annotations
@Override
configureDatabaseCallback to summary
protected void configureDatabaseCall(DatabaseCall call)

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.configureDatabaseCall.

Doc from org.eclipse.persistence.internal.queries.CallQueryMechanism.configureDatabaseCall.

Set the call level query options into the call.

Annotations
@Override
deleteObjectback to summary
public Integer deleteObject() throws DatabaseException

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.deleteObject.

INTERNAL: delete the object

Returns:Integer

the row count.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database.
executeNoSelectback to summary
public Object executeNoSelect() throws DatabaseException

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeNoSelect.

Update the object

Returns:Object

the row count.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database.
getSelectionCriteriaback to summary
public Expression getSelectionCriteria()

Overrides org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.getSelectionCriteria.

Return the selection criteria for the statement.

Annotations
@Override
getSQLStatementback to summary
public SQLStatement getSQLStatement()

INTERNAL: Return the sqlStatement

getSQLStatementsback to summary
public Vector<E> getSQLStatements()

Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialied to conserv space.

hasMultipleStatementsback to summary
public boolean hasMultipleStatements()

Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialized to conserve space.

insertObjectback to summary
public void insertObject() throws DatabaseException

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject.

Insert the object

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database.
insertObjectback to summary
public void insertObject(boolean reprepare)

Overrides org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObject.

Insert the object if the reprepare flag is set, first reprepare the query. Added for CR#3237

Parameters
reprepare:boolean

whether to reprepare the query.

Annotations
@Override
isCallQueryMechanismback to summary
public boolean isCallQueryMechanism()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.isCallQueryMechanism.

Return true if this is a call query mechanism

Annotations
@Override
isStatementQueryMechanismback to summary
public boolean isStatementQueryMechanism()

Overrides org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.isStatementQueryMechanism.

Return true if this is a statement query mechanism

Annotations
@Override
prepareback to summary
public void prepare()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.prepare.

INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query. This query is copied for concurrency so this prepare can only setup things that will apply to any future execution of this query.

Annotations
@Override
prepareCursorSelectAllRowsback to summary
public void prepareCursorSelectAllRows()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareCursorSelectAllRows.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareDeleteAllback to summary
public void prepareDeleteAll()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareDeleteAll.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareDeleteObjectback to summary
public void prepareDeleteObject()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareDeleteObject.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareDoesExistback to summary
public void prepareDoesExist(DatabaseField field)

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareDoesExist.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareExecuteNoSelectback to summary
public void prepareExecuteNoSelect()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.prepareExecuteNoSelect.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareExecuteSelectback to summary
public void prepareExecuteSelect()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareExecuteSelect.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareInsertObjectback to summary
public void prepareInsertObject()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.prepareInsertObject.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareSelectAllRowsback to summary
public void prepareSelectAllRows()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareSelectAllRows.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareSelectOneRowback to summary
public void prepareSelectOneRow()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareSelectOneRow.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareUpdateAllback to summary
public void prepareUpdateAll()

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.prepareUpdateAll.

Pre-build the SQL call from the statement.

Annotations
@Override
prepareUpdateObjectback to summary
public void prepareUpdateObject()

Overrides org.eclipse.persistence.internal.queries.CallQueryMechanism.prepareUpdateObject.

Pre-build the SQL call from the statement.

Annotations
@Override
setCallFromStatementback to summary
protected void setCallFromStatement()

Pre-build the SQL call from the statement.

setSQLStatementback to summary
public void setSQLStatement(SQLStatement statement)

Set the sqlStatement

setSQLStatementsback to summary
protected void setSQLStatements(Vector<E> sqlStatements)

Normally only a single statement is used, however multiple table may require multiple statements on write. This is lazy initialized to conserve space.

trimFieldsForInsertback to summary
public void trimFieldsForInsert()

INTERNAL Remove a potential sequence number field and invoke the ReturningPolicy trimModifyRowsForInsert method

updateObjectback to summary
public Integer updateObject() throws DatabaseException

Overrides org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.updateObject.

Update the object

Returns:Integer

the row count.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database.