|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webobjects.eoaccess.EOAdaptorChannel
com.webobjects.jdbcadaptor.JDBCChannel
public class JDBCChannel
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.webobjects.eoaccess.EOAdaptorChannel |
---|
EOAdaptorChannel.Delegate |
Field Summary |
---|
Fields inherited from class com.webobjects.eoaccess.EOAdaptorChannel |
---|
AdaptorFailureKey, AdaptorOperationsKey, AdaptorOptimisticLockingFailure, FailedAdaptorOperationKey |
Constructor Summary | |
---|---|
JDBCChannel(JDBCContext context)
|
Method Summary | |
---|---|
void |
addStoredProceduresNamed(NSArray storedProcedureNames,
EOModel model)
The default implementation of this method does nothing. |
NSArray |
attributesToFetch()
An abstract method that should be implemented by subclasses to return the set of attributes to retrieve when fetchRow is next invoked. |
void |
cancelFetch()
An abstract method that should be implemented by subclasses to clear all result sets established by the last selectAttributes , executeStoredProcedure , or evaluateExpression message and terminate the current fetch, so that
isFetchInProgress returns false . |
void |
closeChannel()
An abstract method that should be implemented by subclasses to close the EOAdaptorChannel so that it can't perform operations with the server. |
int |
deleteRowsDescribedByQualifier(EOQualifier qualifier,
EOEntity entity)
An abstract method that should be implemented by subclasses to delete the rows described by qualifier from the database table corresponding to entity . |
EOModel |
describeModelWithTableNames(NSArray tableNames)
The default implementation of this method returns null . |
NSArray |
describeResults()
An abstract method that should be implemented by subclasses to return an array of EOAttributes describing the properties available in the current result set, as determined by selectAttributes , executeStoredProcedure , or a statement evaluated by
evaluateExpression . |
NSArray |
describeStoredProcedureNames()
The default implementation of this method returns an empty array. |
NSArray |
describeTableNames()
The default implementation of this method returns an empty array. |
void |
evaluateExpression(EOSQLExpression expression)
An abstract method that should be implemented by subclasses to send expression to the database server for evaluation, beginning a transaction first and committing it after evaluation if a transaction isn't already in progress. |
void |
executeStoredProcedure(EOStoredProcedure storedProcedure,
NSDictionary values)
An abstract method that should be implemented by subclasses to execute storedProcedure . |
NSMutableDictionary |
fetchRow()
An abstract method that should be implemented by subclasses to fetch the next row from the result set of the last selectAttributes , executeStoredProcedure , or evaluateExpression message sent to the receiver. |
void |
insertRow(NSDictionary row,
EOEntity entity)
An abstract method that should be implemented by subclasses to insert the values of row into the table in the database that corresponds to entity . |
boolean |
isFetchInProgress()
An abstract method that should be implemented by subclasses to return true if the receiver is fetching, false otherwise. |
boolean |
isOpen()
An abstract method that should be implemented by subclasses to return true if the channel has been opened with openChannel , false if not. |
void |
openChannel()
An abstract method that should be implemented by subclasses to put the channel, and both its context and adaptor, into a state where they are ready to perform database operations. |
NSDictionary |
primaryKeyForNewRowWithEntity(EOEntity entity)
|
NSArray |
primaryKeysForNewRowsWithEntity(int count,
EOEntity entity)
Returns an NSArray of primary key dictionaries for the number of new rows specified by count in the database table that corresponds to entity . |
NSDictionary |
returnValuesForLastStoredProcedureInvocation()
An abstract method that should be implemented by subclasses to return values from the execution of a stored procedure. |
int |
rowsProcessedCount()
|
void |
selectAttributes(NSArray attributes,
EOFetchSpecification fetchSpec,
boolean yn,
EOEntity entity)
An abstract method that should be implemented by subclasses to select attributes in rows matching the qualifier in fetchSpecification and set the receiver's attributes to fetch. |
void |
setAttributesToFetch(NSArray attributes)
An abstract method that should be implemented by subclasses to specify the set of attributes used to describe fetch data from a corresponding select. |
int |
updateValuesInRowsDescribedByQualifier(NSDictionary row,
EOQualifier qualifier,
EOEntity entity)
An abstract method that should be implemented by subclasses to update the rows described by qualifier with the values in row . |
Methods inherited from class com.webobjects.eoaccess.EOAdaptorChannel |
---|
adaptorContext, delegate, deleteRowDescribedByQualifier, dictionaryWithObjectsForAttributes, lockRowComparingAttributes, performAdaptorOperation, performAdaptorOperations, setDelegate, updateValuesInRowDescribedByQualifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCChannel(JDBCContext context)
Method Detail |
---|
public boolean isOpen()
EOAdaptorChannel
true
if the channel has been opened with openChannel
, false
if not.
isOpen
in class EOAdaptorChannel
true
if the channel has been opened with openChannel()
.EOAdaptorChannel.openChannel()
,
EOAdaptorChannel.closeChannel()
public void openChannel()
EOAdaptorChannel
openChannel
in class EOAdaptorChannel
EOAdaptorChannel.isOpen()
,
EOAdaptorChannel.closeChannel()
public void closeChannel()
EOAdaptorChannel
If the receiver is the last open channel in an adaptor context and if the channel's adaptor context has outstanding transactions, closing the channel has server-dependent results: some database servers roll back all outstanding transactions but others do nothing. Regardless of whether outstanding transactions are rolled back, this method has the side effect of closing the receiver's adaptor context's connection with the database if the receiver is its adaptor context's last open channel.
closeChannel
in class EOAdaptorChannel
EOAdaptorChannel.cancelFetch()
,
EOAdaptorContext.hasOpenTransaction()
public void insertRow(NSDictionary row, EOEntity entity)
EOAdaptorChannel
row
into the table in the database that corresponds to entity
. row
is a dictionary whose keys are attribute names and whose values are the values to insert. Row
keys must refer to attributes that all belong to entity
and that are either non- flattened or all flattened through the same relationship path. Should throw a runtime exception on failure. Some possible reasons for failure are:
insertRow
in class EOAdaptorChannel
row
- An NSDictionary whose keys are attribute names and whose values are the values that will be inserted.entity
- The entity that corresponds to row
.EOEntity
public int updateValuesInRowsDescribedByQualifier(NSDictionary row, EOQualifier qualifier, EOEntity entity)
EOAdaptorChannel
qualifier
with the values in row
. row
is a dictionary whose keys are attribute names and whose values are the new values for those attributes (the
dictionary need only contain entries for the attributes being changed). Should return the number of updated rows. Should throw a runtime exception if an error occurs. Some possible reasons for failure are:
updateValuesInRowsDescribedByQualifier
in class EOAdaptorChannel
row
- The new values for row(s).qualifier
- Describes row(s) to update.entity
- The entity corresponding to the row(s) to update.
(NSDictionary row, EOQualifier qualifier, EOEntity entity)
,
EOEntity
,
EOQualifier
public int deleteRowsDescribedByQualifier(EOQualifier qualifier, EOEntity entity)
EOAdaptorChannel
qualifier
from the database table corresponding to entity
. Should return the number of rows deleted. Should throw a runtime exception on failure. Some possible reasons
for failure are:
deleteRowsDescribedByQualifier
in class EOAdaptorChannel
qualifier
- Describes the row(s) to delete.entity
- The entity corresponding to the row(s) to delete.
EOAdaptorChannel.deleteRowDescribedByQualifier(EOQualifier qualifier, EOEntity entity)
,
EOAdaptorChannel.isFetchInProgress()
,
EOAdaptorContext.hasOpenTransaction()
,
EOEntity
,
EOQualifier
public void selectAttributes(NSArray attributes, EOFetchSpecification fetchSpec, boolean yn, EOEntity entity)
EOAdaptorChannel
fetchSpecification
and set the receiver's attributes to fetch. The selected rows compose one or more result sets, each row of which should be returned by
subsequent fetchRow
calls according to fetchSpecification
's sort orderings. If the yn
flag is true
, the rows should be locked if possible so that no other user can modify them. The lock specification in
fetchSpecification
should be ignored. Should throw a runtime exception if an error occurs. Some possible reasons for failure are:
selectAttributes
in class EOAdaptorChannel
attributes
- An array of the attributes to select.fetchSpec
- Describes the row(s) to select.yn
- true
if rows should be locked.entity
- The entity corresponding to the row(s) to be selected.EOAdaptorChannel.fetchRow()
,
EOEntity
,
EOFetchSpecification
,
EOSortOrdering
public void evaluateExpression(EOSQLExpression expression)
EOAdaptorChannel
expression
to the database server for evaluation, beginning a transaction first and committing it after evaluation if a transaction isn't already in progress. Should throw a runtime exception if an error
occurs. An adaptor channel uses this method to send SQL expressions to the database.
If expression
results in a select operation being performed, you can fetch the results as you would if you had invoked selectAttributes
. You must use the method setAttributesToFetch
before you begin fetching. If expression
evaluates
to multiple result sets, you must invoke setAttributesToFetch
before you begin fetching each subsequent set.
evaluateExpression
invokes the delegate methods adaptorChannelShouldEvaluateExpression
and adaptorChannelDidEvaluateExpression
.
The upper layers of the Framework never invoke evaluateExpression
directly. Thus, in adaptors for data stores that don't naturally support an expression language (for example, flat file adaptors), the implementation of this method doesn't need to do anything in order for the
adaptor to work with the Framework.
evaluateExpression
in class EOAdaptorChannel
expression
- An expression to be evaluated by the database server.EOAdaptorChannel.fetchRow()
,
EOAdaptorChannel.selectAttributes( NSArray attributes, EOFetchSpecification fetchSpecification, boolean flag, EOEntity entity)
,
EOAdaptorChannel.setAttributesToFetch(NSArray attributes)
,
EOAdaptorChannel.Delegate.adaptorChannelShouldEvaluateExpression( EOAdaptorChannel channel, EOSQLExpression expression)
,
EOAdaptorChannel.Delegate.adaptorChannelDidEvaluateExpression( EOAdaptorChannel channel, EOSQLExpression expression)
,
EOSQLExpression
public boolean isFetchInProgress()
EOAdaptorChannel
true
if the receiver is fetching, false
otherwise. An adaptor channel is fetching if: selectAttributes
.executeStoredProcedure
.evaluateExpression
resulted in a select operation being performed.
An adaptor channel stops fetching when there are no more records to fetch or when cancelFetch
is invoked.
isFetchInProgress
in class EOAdaptorChannel
true
if the receiver is fetching, else false
.EOAdaptorChannel.fetchRow()
,
EOAdaptorChannel.evaluateExpression(EOSQLExpression expression)
,
EOAdaptorChannel.selectAttributes(NSArray attributes, EOFetchSpecification fetchSpecification, boolean flag, EOEntity entity)
,
EOAdaptorChannel.executeStoredProcedure(EOStoredProcedure storedProcedure, NSDictionary values)
public NSArray describeResults()
EOAdaptorChannel
selectAttributes
, executeStoredProcedure
, or a statement evaluated by
evaluateExpression
. Only invoke this method if a fetch is in progress as determined by isFetchInProgress
.
describeResults
in class EOAdaptorChannel
EOAdaptorChannel.selectAttributes(NSArray attributes, EOFetchSpecification fetchSpecification, boolean flag, EOEntity entity)
,
EOAdaptorChannel.executeStoredProcedure(EOStoredProcedure storedProcedure, NSDictionary values)
,
EOAdaptorChannel.evaluateExpression(EOSQLExpression expression)
,
EOAdaptorChannel.isFetchInProgress()
,
EOAttribute
public void setAttributesToFetch(NSArray attributes)
EOAdaptorChannel
attributes
used to describe fetch data from a corresponding select. attribute
is an array of the attributes to fetch. This method should be invoked after
evaluateExpression
but before the first call to fetchRow
. This method should throw a runtime exception if invoked when there is no fetch in progress.
setAttributesToFetch
in class EOAdaptorChannel
attributes
- An array of the attributes to fetch.EOAdaptorChannel.selectAttributes( NSArray attributes, EOFetchSpecification fetchSpecification, boolean flag, EOEntity entity)
,
EOAdaptorChannel.evaluateExpression(EOSQLExpression expression)
,
EOAdaptorChannel.fetchRow()
public NSArray attributesToFetch()
EOAdaptorChannel
fetchRow
is next invoked.
attributesToFetch
in class EOAdaptorChannel
EOAdaptorChannel.fetchRow()
public void cancelFetch()
EOAdaptorChannel
selectAttributes
, executeStoredProcedure
, or evaluateExpression
message and terminate the current fetch, so that
isFetchInProgress
returns false
.
cancelFetch
in class EOAdaptorChannel
EOAdaptorChannel.selectAttributes(NSArray attributes, EOFetchSpecification fetchSpecification, boolean flag, EOEntity entity)
,
EOAdaptorChannel.executeStoredProcedure(EOStoredProcedure storedProcedure, NSDictionary values)
,
EOAdaptorChannel.evaluateExpression(EOSQLExpression expression)
,
EOAdaptorChannel.isFetchInProgress()
public NSDictionary primaryKeyForNewRowWithEntity(EOEntity entity)
primaryKeyForNewRowWithEntity
in class EOAdaptorChannel
EOAdaptorChannel.primaryKeysForNewRowsWithEntity(int count, EOEntity entity)
public NSArray primaryKeysForNewRowsWithEntity(int count, EOEntity entity)
EOAdaptorChannel
count
in the database table that corresponds to entity
. The primary keys returned from this method are dictionaries whose keys are the primary key attribute names. For
example, suppose you've got a table MOVIE with primary key MOVIE_ID, and the corresponding Movie entity's primary key attribute is movieID. In this scenario, each dictionary in the NSArray returned from this method has one entry whose key is movieID and whose value is the unique value to
assign.
If the primary key is compound (made up of more than one attribute), the dictionary should contain an entry for each primary key attribute. Note, however, that the Enterprise Objects Frameworks adaptors don't handle compound primary keys; they return null if the primary key is compound.
primaryKeysForNewRowsWithEntity
in class EOAdaptorChannel
count
- The number of new rows for which to generate primary keys.entity
- The entity for which to assign primary keys.
null
if the adaptor is unable to provide the primary key values.EOEntity
public NSArray describeTableNames()
EOAdaptorChannel
This method is used in conjunction with describeStoredProcedureNames
to build a default model in EOModeler.
describeTableNames
in class EOAdaptorChannel
EOAdaptorChannel.describeModelWithTableNames(NSArray tableNames)
public NSArray describeStoredProcedureNames()
EOAdaptorChannel
This method is used in conjunction with addStoredProceduresNamed
to build a default model in EOModeler.
describeStoredProcedureNames
in class EOAdaptorChannel
EOAdaptorChannel.addStoredProceduresNamed( NSArray storedProcedureNames, EOModel model)
public EOModel describeModelWithTableNames(NSArray tableNames)
EOAdaptorChannel
null
. It can be overridden by subclasses to create and return a default model containing entities for the tables specified in tableNames
and assign the adaptor name and connection dictionary to the new model.
This method is typically used in conjunction with describeTableNames
and describeStoredProcedureNames
.
describeModelWithTableNames
in class EOAdaptorChannel
tableNames
- The entity names for database tables.
tableNames
.EOAdaptorChannel.describeTableNames()
,
EOAdaptorChannel.describeStoredProcedureNames()
,
EOModel
public void addStoredProceduresNamed(NSArray storedProcedureNames, EOModel model)
EOAdaptorChannel
storedProcedureNames
and then to add them to model
. Should throw a runtime exception if an error
occurs.
This method is used in conjunction with describeStoredProcedureNames
to build a default model in EOModeler.
addStoredProceduresNamed
in class EOAdaptorChannel
storedProcedureNames
- The names of stored procedures to add to a model.model
- The model to which to add stored procedures.EOAdaptorChannel.describeStoredProcedureNames()
,
EOModel
,
EOStoredProcedure
public void executeStoredProcedure(EOStoredProcedure storedProcedure, NSDictionary values)
EOAdaptorChannel
storedProcedure
. Any arguments to the stored procedure are in values
, a dictionary whose keys are the argument names. You should use fetchRow
to get result rows and
returnValuesForLastStoredProcedureInvocation
to get return arguments and result status, if any. Should throw a runtime exception if an error occurs.
The upper layers of the Framework never invoke executeStoredProcedure
directly. Thus, in adaptors for data stores that don't naturally support stored procedures, the implementation of this method doesn't need to do anything in order for the adaptor to work with the Framework.
executeStoredProcedure
in class EOAdaptorChannel
storedProcedure
- The stored procedure to execute.values
- A dictionary whose keys are the argument names and whose values are the argument values to be passed to storedProcedure
.EOAdaptorChannel.returnValuesForLastStoredProcedureInvocation()
,
EOAdaptorChannel.fetchRow()
,
(EOStoredProcedure storedProcedure, NSDictionary values)
,
EOStoredProcedure
public NSDictionary returnValuesForLastStoredProcedureInvocation()
EOAdaptorChannel
executeStoredProcedure
. The dictionary returned by this method should have entries whose keys are the names of the stored procedure's
parameters and whose values are the parameter values. The dictionary also should contain a special entry for the stored procedure's return value with the key "returnValue".
Should return an empty dictionary for stored procedures that have void return types. Should return null
if the stored procedure has results to fetch. In this case, you must use fetchRow
until there are no more results to fetch before the return value will be
available.
returnValuesForLastStoredProcedureInvocation
in class EOAdaptorChannel
EOAdaptorChannel.executeStoredProcedure(EOStoredProcedure storedProcedure, NSDictionary values)
,
EOAdaptorChannel.fetchRow()
,
EOStoredProcedure
public NSMutableDictionary fetchRow()
EOAdaptorChannel
selectAttributes
, executeStoredProcedure
, or evaluateExpression
message sent to the receiver. Should return values for the
receiver's attributesToFetch
in a dictionary whose keys are the attribute names. When there are no more rows in the current result set, this method should return null
and invoke the delegate method adaptorChannelDidChangeResultSet
if there are more
results sets.
When there are no more rows or result sets, this method should return null
, end the fetch, and invoke adaptorChannelDidFinishFetching
. isFetchInProgress
returns true
until the fetch is canceled or until this method exhausts all
result sets and returns null
.
adaptorChannelWillFetchRow
and adaptorChannelDidFetchRow
. Should throw a runtime exception if an error occurs.
fetchRow
in class EOAdaptorChannel
attributesToFetch
in a dictionary whose keys are the attribute names.EOAdaptorChannel.executeStoredProcedure(EOStoredProcedure storedProcedure, NSDictionary values)
,
EOAdaptorChannel.selectAttributes(NSArray attributes, EOFetchSpecification fetchSpecification, boolean flag, EOEntity entity)
,
EOAdaptorChannel.evaluateExpression(EOSQLExpression expression)
,
EOAdaptorChannel.attributesToFetch()
,
(EOAdaptorChannel channel)
,
EOAdaptorChannel.Delegate.adaptorChannelDidFinishFetching( EOAdaptorChannel channel)
,
EOAdaptorChannel.Delegate.adaptorChannelWillFetchRow( EOAdaptorChannel channel)
,
EOAdaptorChannel.Delegate.adaptorChannelDidFetchRow(EOAdaptorChannel channel , NSMutableDictionary row)
,
EOAdaptorChannel.setAttributesToFetch(NSArray attributes)
public int rowsProcessedCount()
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |