Methods Summary |
---|
public void | clearStatement()The statement is no longer require after prepare so can be released.
// Only clear the statement if it is an expression query, otherwise the statement may still be needed.
if (isExpressionQueryMechanism()) {
setSQLStatement(null);
setSQLStatements(null);
}
|
public oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism | clone(oracle.toplink.essentials.queryframework.DatabaseQuery queryClone)Clone the mechanism for the specified query clone.
StatementQueryMechanism clone = (StatementQueryMechanism)super.clone(queryClone);
if ((!hasMultipleStatements()) && (getSQLStatement() != null)) {
clone.setSQLStatement((SQLStatement)sqlStatement.clone());
} else {
Vector currentStatements = getSQLStatements();
if (currentStatements != null) {
Vector statementClone = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(currentStatements.size());
Enumeration enumtr = currentStatements.elements();
while (enumtr.hasMoreElements()) {
statementClone.addElement(((SQLStatement)enumtr.nextElement()).clone());
}
clone.setSQLStatements(statementClone);
}
}
return clone;
|
public java.lang.Integer | deleteObject()INTERNAL:
delete the object
// Prepare the calls if not already set (prepare may not have had the modify row).
if ((!hasMultipleCalls()) && (getCall() == null)) {
prepareDeleteObject();
if ((!hasMultipleCalls()) && (getCall() == null)) {
return new Integer(1);// Must be 1 otherwise locking error will occur.
}
}
return super.deleteObject();
|
public java.lang.Integer | executeNoSelect()Update the object
// Prepare the calls if not already set (prepare may not have had the modify row).
if ((!hasMultipleCalls()) && (getCall() == null)) {
prepareExecuteNoSelect();
}
return super.executeNoSelect();
|
public oracle.toplink.essentials.internal.expressions.SQLStatement | getSQLStatement()INTERNAL:
Return the sqlStatement
return sqlStatement;
|
public java.util.Vector | getSQLStatements()Normally only a single statement is used, however multiple table may require multiple statements on write.
This is lazy initialied to conserv space.
if (sqlStatements == null) {
sqlStatements = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(3);
}
return sqlStatements;
|
public oracle.toplink.essentials.expressions.Expression | getSelectionCriteria()Return the selection criteria for the statement.
return getSQLStatement().getWhereClause();
|
public boolean | hasMultipleStatements()Normally only a single statement is used, however multiple table may require multiple statements on write.
This is lazy initialied to conserv space.
return (sqlStatements != null) && (!sqlStatements.isEmpty());
|
public void | insertObject()Insert the object
// Prepare the calls if not already set (prepare may not have had the modify row).
if ((!hasMultipleCalls()) && (getCall() == null)) {
prepareInsertObject();
}
super.insertObject();
|
public void | insertObject(boolean reprepare)Insert the object if the reprepare flag is set, first reprepare the query.
Added for CR#3237
if (reprepare) {
// Clear old calls, and reprepare.
setCalls(null);
prepareInsertObject();
}
insertObject();
|
public boolean | isCallQueryMechanism()Return true if this is a call query mechanism
return false;
|
public boolean | isStatementQueryMechanism()Return true if this is a statement query mechanism
return true;
|
public void | 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.
if ((!hasMultipleStatements()) && (getSQLStatement() == null)) {
throw QueryException.sqlStatementNotSetProperly(getQuery());
}
// Cannot call super yet as the call is not built.
|
public void | prepareCursorSelectAllRows()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareCursorSelectAllRows();
|
public void | prepareDeleteAll()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareDeleteAll();
|
public void | prepareDeleteObject()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareDeleteObject();
|
public void | prepareDoesExist(oracle.toplink.essentials.internal.helper.DatabaseField field)Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
getCall().returnOneRow();
prepareCall();
|
public void | prepareExecuteNoSelect()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareExecuteNoSelect();
|
public void | prepareExecuteSelect()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareExecuteSelect();
|
public void | prepareInsertObject()Pre-build the SQL call from the statement.
// Require modify row to prepare.
if (getModifyRow() == null) {
return;
}
if (hasMultipleStatements()) {
for (Enumeration statementEnum = getSQLStatements().elements();
statementEnum.hasMoreElements();) {
((SQLModifyStatement)statementEnum.nextElement()).setModifyRow(getModifyRow());
}
} else if (getSQLStatement() != null) {
((SQLModifyStatement)getSQLStatement()).setModifyRow(getModifyRow());
}
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareInsertObject();
|
public void | prepareSelectAllRows()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareSelectAllRows();
|
public void | prepareSelectOneRow()Pre-build the SQL call from the statement.
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareSelectOneRow();
|
public void | prepareUpdateAll()Pre-build the SQL call from the statement.
setCallFromStatement();// Will build an SQLUpdateAllStatement
clearStatement();// The statement is no longer require so can be released.
super.prepareUpdateAll();
|
public void | prepareUpdateObject()Pre-build the SQL call from the statement.
// Require modify row to prepare.
if (getModifyRow() == null) {
return;
}
if (hasMultipleStatements()) {
for (Enumeration statementEnum = getSQLStatements().elements();
statementEnum.hasMoreElements();) {
((SQLModifyStatement)statementEnum.nextElement()).setModifyRow(getModifyRow());
}
} else if (getSQLStatement() != null) {
((SQLModifyStatement)getSQLStatement()).setModifyRow(getModifyRow());
}
setCallFromStatement();
// The statement is no longer require so can be released.
clearStatement();
super.prepareUpdateObject();
|
protected void | setCallFromStatement()Pre-build the SQL call from the statement.
// Profile SQL generation.
getSession().startOperationProfile(SessionProfiler.SQL_GENERATION);
if (hasMultipleStatements()) {
for (Enumeration statementEnum = getSQLStatements().elements();
statementEnum.hasMoreElements();) {
// DatabaseCall call = ((SQLStatement) statementEnum.nextElement()).buildCall(getSession());
DatabaseCall call = null;
if (getDescriptor() != null) {
call = getDescriptor().buildCallFromStatement((SQLStatement)statementEnum.nextElement(), getSession());
} else {
call = ((SQLStatement)statementEnum.nextElement()).buildCall(getSession());
}
// In case of update call may be null if no update required.
if (call != null) {
addCall(call);
}
}
} else {
DatabaseCall call = null;
if (getDescriptor() != null) {
call = getDescriptor().buildCallFromStatement(getSQLStatement(), getSession());
} else {
call = getSQLStatement().buildCall(getSession());
}
// In case of update call may be null if no update required.
if (call != null) {
setCall(call);
}
}
// Profile SQL generation.
getSession().endOperationProfile(SessionProfiler.SQL_GENERATION);
|
public void | setSQLStatement(oracle.toplink.essentials.internal.expressions.SQLStatement statement)Set the sqlStatement
this.sqlStatement = statement;
|
protected void | setSQLStatements(java.util.Vector sqlStatements)Normally only a single statement is used, however multiple table may require multiple statements on write.
This is lazy initialied to conserv space.
this.sqlStatements = sqlStatements;
|
public java.lang.Integer | updateObject()Update the object
// Prepare the calls if not already set (prepare may not have had the modify row).
if ((!hasMultipleCalls()) && (getCall() == null)) {
prepareUpdateObject();
if ((!hasMultipleCalls()) && (getCall() == null)) {
return new Integer(1);// Must be 1 otherwise locking error will occur.
}
}
return super.updateObject();
|