oracle.toplink.sdk
Class SDKQueryMechanism

java.lang.Object
  |
  +--oracle.toplink.internal.queryframework.DatabaseQueryMechanism
        |
        +--oracle.toplink.sdk.SDKQueryMechanism
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SDKQueryMechanism
extends oracle.toplink.internal.queryframework.DatabaseQueryMechanism

The SDKQueryMechanism class implements the DatabaseQueryMechanism protocol by redirecting all queries to a collection of calls that is provided to the mechanism when it is built. So just about everything ends up going through executeSelectCalls() or executeNoSelectCalls(), which, in turn, send the appropriate message to the SDKAccessor.

Since:
TOPLink/Java 1.0
See Also:
SDKAccessor, SDKCall, AbstractSDKCall, Serialized Form

Constructor Summary
SDKQueryMechanism(DatabaseQuery query)
          Construct a new mechanism for the specified query.
SDKQueryMechanism(DatabaseQuery query, SDKCall call)
          Construct a new mechanism for the specified query and call.
 
Method Summary
TypeMethod
 void addCall(SDKCall call)
          Add a call.
 oracle.toplink.internal.databaseaccess.DatabaseCall cursorSelectAllRows()
          Read all rows from the database using a cursored stream.
 void deleteAll()
          Delete a collection of objects.
 java.lang.Integer deleteObject()
          Delete an object.
 java.lang.Integer executeNoSelect()
          Execute a raw (non-object), non-selecting database call.
 java.util.Vector executeSelect()
          Execute a raw (non-object) database call that returns a result.
 java.util.Vector getCalls()
          Return the mechanism's calls.
 void insertObject()
          Insert an object.
 boolean isCallQueryMechanism()
          Return true if this is a call query mechanism.
 void prepare()
          This is different from 'prepareForExecution()' in that this is called on the original query, and the other is called on the clone of the query.
 void prepareCursorSelectAllRows()
          Pre-pare for a cursored execute.
 void prepareDeleteAll()
          Prepare for a delete all.
 void prepareDeleteObject()
          Prepare for a delete.
 void prepareDoesExist(oracle.toplink.internal.helper.DatabaseField field)
          Pre-pare for a select execute.
 void prepareExecuteNoSelect()
          Prepare for a raw (non-object), non-selecting call.
 void prepareExecuteSelect()
          Prepare for a raw (non-object) select call.
 void prepareForExecution()
          All the query mechanism-related things are initialized here.
 void prepareInsertObject()
          Prepare for an insert.
 void prepareReportQuerySelectAllRows()
          Pre-pare for a select execute.
 void prepareReportQuerySubSelect()
          Pre-pare a report query for a sub-select.
 void prepareSelectAllReportRows()
          Prepare for a report query.
 void prepareSelectAllRows()
          Prepare for a select returning (possibly) multiple rows.
 void prepareSelectOneRow()
          Prepare for a select returning a single row.
 void prepareSelectRowForDoesExist(oracle.toplink.internal.helper.DatabaseField field)
          Prepare for an existence check.
 void prepareStartCursor()
          Prepare for a cursored select.
 void prepareUpdateObject()
          Prepare for an update.
 java.util.Vector selectAllReportRows()
          Read and return rows from the database for a report query.
 java.util.Vector selectAllRows()
          Read and return rows from the database.
 DatabaseRow selectOneRow()
          Read and return a row from the database.
 DatabaseRow selectRowForDoesExist(oracle.toplink.internal.helper.DatabaseField field)
          Read and return a row from the database for an existence check.
 oracle.toplink.internal.databaseaccess.DatabaseCall startCursor()
          Start reading all the rows from the database for a cursored stream or scrollable cursor.
 java.lang.String toString()
           
 java.lang.Integer updateObject()
          Update an object.
 
Methods inherited from class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
buildObjectsFromRows, buildSelectionCriteria, checkCacheForObject, clone, executeWrite, getModifyRow, getQuery, getSelectionCriteria, insertObjectForWrite, isEJBQLCallQueryMechanism, isExpressionQueryMechanism, isStatementQueryMechanism, setQuery, updateObjectForWrite
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SDKQueryMechanism

public SDKQueryMechanism(DatabaseQuery query)
Construct a new mechanism for the specified query.

SDKQueryMechanism

public SDKQueryMechanism(DatabaseQuery query,
                         SDKCall call)
Construct a new mechanism for the specified query and call.
Method Detail

addCall

public void addCall(SDKCall call)
Add a call.

cursorSelectAllRows

public oracle.toplink.internal.databaseaccess.DatabaseCall cursorSelectAllRows()
                                                                        throws SDKDataStoreException
Description copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Read all rows from the database using a cursored stream.
Overrides:
cursorSelectAllRows in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Following copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
DatabaseException - - an error has occurred on the database

deleteAll

public void deleteAll()
               throws SDKDataStoreException
Delete a collection of objects.

Assume the calls are correct.

Overrides:
deleteAll in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

deleteObject

public java.lang.Integer deleteObject()
                               throws SDKDataStoreException
Delete an object.

Assume the calls are correct.

Overrides:
deleteObject in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the number of rows deleted
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

executeNoSelect

public java.lang.Integer executeNoSelect()
                                  throws SDKDataStoreException
Execute a raw (non-object), non-selecting database call.

Assume the calls are correct.

Overrides:
executeNoSelect in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the number of rows affected
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

executeSelect

public java.util.Vector executeSelect()
                               throws SDKDataStoreException
Execute a raw (non-object) database call that returns a result.

Assume the calls are correct.

Overrides:
executeSelect in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the collection of rows
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

getCalls

public java.util.Vector getCalls()
Return the mechanism's calls.

insertObject

public void insertObject()
                  throws SDKDataStoreException
Insert an object.

Assume the calls are correct.

Overrides:
insertObject in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

isCallQueryMechanism

public boolean isCallQueryMechanism()
Return true if this is a call query mechanism.
Overrides:
isCallQueryMechanism in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism

prepare

public void prepare()
             throws SDKQueryException
This is different from 'prepareForExecution()' in that this is called on the original query, and the other is called on the clone 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.
Overrides:
prepare in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareCursorSelectAllRows

public void prepareCursorSelectAllRows()
                                throws SDKQueryException
Description copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Pre-pare for a cursored execute. This is sent to the original query before cloning.
Overrides:
prepareCursorSelectAllRows in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism

prepareDeleteAll

public void prepareDeleteAll()
                      throws SDKQueryException
Prepare for a delete all. This is sent to the original query before cloning.
Overrides:
prepareDeleteAll in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareDeleteObject

public void prepareDeleteObject()
                         throws SDKQueryException
Prepare for a delete. This is sent to the original query before cloning.
Overrides:
prepareDeleteObject in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareDoesExist

public void prepareDoesExist(oracle.toplink.internal.helper.DatabaseField field)
                      throws SDKQueryException
Description copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Pre-pare for a select execute. This is sent to the original query before cloning.
Overrides:
prepareDoesExist in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism

prepareExecuteNoSelect

public void prepareExecuteNoSelect()
                            throws SDKQueryException
Prepare for a raw (non-object), non-selecting call. This is sent to the original query before cloning.
Overrides:
prepareExecuteNoSelect in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareExecuteSelect

public void prepareExecuteSelect()
                          throws SDKQueryException
Prepare for a raw (non-object) select call. This is sent to the original query before cloning.
Overrides:
prepareExecuteSelect in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareForExecution

public void prepareForExecution()
                         throws SDKQueryException
All the query mechanism-related things are initialized here.
Overrides:
prepareForExecution in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareInsertObject

public void prepareInsertObject()
                         throws SDKQueryException
Prepare for an insert. This is sent to the original query before cloning.
Overrides:
prepareInsertObject in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareReportQuerySelectAllRows

public void prepareReportQuerySelectAllRows()
                                     throws SDKQueryException
Description copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Pre-pare for a select execute. This is sent to the original query before cloning.
Overrides:
prepareReportQuerySelectAllRows in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism

prepareReportQuerySubSelect

public void prepareReportQuerySubSelect()
                                 throws SDKQueryException
Description copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Pre-pare a report query for a sub-select.
Overrides:
prepareReportQuerySubSelect in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism

prepareSelectAllReportRows

public void prepareSelectAllReportRows()
                                throws SDKQueryException
Prepare for a report query. This is sent to the original query before cloning.
Throws:
SDKQueryException - if something is amiss

prepareSelectAllRows

public void prepareSelectAllRows()
                          throws SDKQueryException
Prepare for a select returning (possibly) multiple rows. This is sent to the original query before cloning.
Overrides:
prepareSelectAllRows in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareSelectOneRow

public void prepareSelectOneRow()
                         throws SDKQueryException
Prepare for a select returning a single row. This is sent to the original query before cloning.
Overrides:
prepareSelectOneRow in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

prepareSelectRowForDoesExist

public void prepareSelectRowForDoesExist(oracle.toplink.internal.helper.DatabaseField field)
                                  throws SDKQueryException
Prepare for an existence check. This is sent to the original query before cloning.
Throws:
SDKQueryException - if something is amiss

prepareStartCursor

public void prepareStartCursor()
                        throws SDKQueryException
Prepare for a cursored select. This is sent to the original query before cloning.
Throws:
SDKQueryException - if something is amiss

prepareUpdateObject

public void prepareUpdateObject()
                         throws SDKQueryException
Prepare for an update. This is sent to the original query before cloning.
Overrides:
prepareUpdateObject in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Throws:
SDKQueryException - if something is amiss

selectAllReportQueryRows

public java.util.Vector selectAllReportQueryRows()
                                          throws SDKDataStoreException
Description copied from class: oracle.toplink.internal.queryframework.DatabaseQueryMechanism
INTERNAL: Read all rows from the database.
Overrides:
selectAllReportQueryRows in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism

selectAllReportRows

public java.util.Vector selectAllReportRows()
                                     throws SDKDataStoreException
Read and return rows from the database for a report query.

Assume the calls are correct.

Returns:
the collection of rows
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

selectAllRows

public java.util.Vector selectAllRows()
                               throws SDKDataStoreException
Read and return rows from the database.

Assume the calls are correct.

Overrides:
selectAllRows in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the collection of rows
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

selectOneRow

public DatabaseRow selectOneRow()
                         throws SDKDataStoreException
Read and return a row from the database.

Assume the calls are correct.

Overrides:
selectOneRow in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the row
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

selectRowForDoesExist

public DatabaseRow selectRowForDoesExist(oracle.toplink.internal.helper.DatabaseField field)
                                  throws SDKDataStoreException
Read and return a row from the database for an existence check.

Assume the calls are correct.

Overrides:
selectRowForDoesExist in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the row
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

startCursor

public oracle.toplink.internal.databaseaccess.DatabaseCall startCursor()
                                                                throws SDKDataStoreException
Start reading all the rows from the database for a cursored stream or scrollable cursor. Return the DatabaseCall - the CursorPolicy will perform the actual reading of the rows from the database.

Assume the calls are correct.

Cursors are not currently supported.

Returns:
the call
Throws:
SDKDataStoreException - if an error has occurred on the "data store"

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

updateObject

public java.lang.Integer updateObject()
                               throws SDKDataStoreException
Update an object.

Assume the calls are correct.

Overrides:
updateObject in class oracle.toplink.internal.queryframework.DatabaseQueryMechanism
Returns:
the number of rows affected by the update
Throws:
SDKDataStoreException - if an error has occurred on the "data store