EODatabaseChannel
Inherits from: NSObject
Declared in: EOAccess/EODatabaseChannel.h
Class Description
An EODatabaseChannel represents an independent communication channel to the database server. It's associated with an EODatabaseContext and an EODatabase, which, together with the EODatabaseChannel, form the database level of Enterprise Objects Framework's access layer. See the EODatabase class specification for more information.
An EODatabaseChannel has an EOAdaptorChannel that it uses to connect to the database server its EODatabase object represents. An EODatabaseChannel fetches database records as instances of enterprise object classes that are specified in its EODatabase's EOModel objects. An EODatabaseChannel also has an EODatabaseContext, which uses the channel to perform fetches and to lock rows in the database. All of the database level objects are used automatically by EOEditingContexts and other components of Enterprise Objects Framework. You rarely need to interact with them directly. In particular, you wouldn't ordinarily use an EODatabaseChannel to fetch objects. Rather, you'd use an EOEditingContext.
Method Types
- Creating instances
- - initWithDatabaseContext:
- Accessing cooperating objects
- - adaptorChannel
- - databaseContext
- Fetching objects
- - selectObjectsWithFetchSpecification:editingContext:
- - isFetchInProgress
- - fetchObject
- - cancelFetch
- Accessing internal fetch state
- - setCurrentEntity:
- - setCurrentEditingContext:
- - setIsLocking:
- - isLocking
- - setIsRefreshingObjects:
- - isRefreshingObjects
- Accessing the delegate
- - setDelegate:
- - delegate
Instance Methods
adaptorChannel
- (EOAdaptorChannel *)adaptorChannel
See Also: - initWithDatabaseContext:
cancelFetch
- (void)cancelFetch
See Also: - isFetchInProgress, - selectObjectsWithFetchSpecification:editingContext:, - fetchObject
databaseContext
- (EODatabaseContext *)databaseContext
See Also: - initWithDatabaseContext:
delegate
- (id)delegate
See Also: - setDelegate:
fetchObject
- (id)fetchObject
If no snapshot exists for the fetched object, the receiver sends its EODatabase a recordSnapshot:forGlobalID: message to record one. If a snapshot already exists (because the object was previously fetched), the receiver checks whether it should overwrite the old snapshot with the new one. It does so by asking the delegate with a databaseContext:shouldUpdateCurrentSnapshot:newSnapshot:globalID:databaseChannel: method. If the delegate doesn't respond to this method, the EODatabaseChannel overwrites the snapshot if it's locking or refreshing fetched objects. Further, if the EODatabaseChannel is refreshing fetched objects, it posts an EOObjectsChangedInStoreNotification on behalf of its EODatabaseContext (which causes any EOEditingContext using that EODatabaseContext to update its enterprise object with the values recorded in the new snapshot).
For information on locking and update strategies, see the EODatabaseContext class specification. For information on refreshing fetched objects, see the EOFetchSpecification class specification.
Ordinarily, you don't directly use an EODatabaseChannel to fetch objects. Rather, you use an EOEditingContext, which uses an underlying EODatabaseChannel to do its work.
See Also: - cancelFetch, - isFetchInProgress, - isLocking, - isRefreshingObjects
initWithDatabaseContext:
- initWithDatabaseContext:(EODatabaseContext
*)aDatabaseContext
Typically, you don't need to programmatically create EODatabaseChannel objects. Rather, they are created automatically by the control layer. See the EODatabase class description for more information.
isFetchInProgress
- (BOOL)isFetchInProgress
isLocking
- (BOOL)isLocking
See Also: - locksObjects (EOFetchSpecification)
isRefreshingObjects
- (BOOL)isRefreshingObjects
See Also: - refreshesRefetchedObjects (EOFetchSpecification), - fetchObject
selectObjectsWithFetchSpecification:editingContext:
- (void)selectObjectsWithFetchSpecification:(EOFetchSpecification
*)fetchSpecification
editingContext:(EOEditingContext
*)anEditingContext
Raises an exception if an error occurs; the particular exception depends on the specific error, and is indicated in the exception's description. Some possible reasons for failure are:
- fetchSpecification is invalid.
- The receiver's EODatabaseContext has no transaction in progress.
- The delegate disallows the select operation.
- The receiver's EOAdaptorChannel fails to perform the select operation.
This method invokes the delegate methods databaseContext:shouldSelectObjectsWithFetchSpecification:databaseChannel:, databaseContext:shouldUsePessimisticLockWithFetchSpecification: databaseChannel:, and databaseContext:didSelectObjectsWithFetchSpecification:databaseChannel:. See their descriptions in the EODatabaseContext class specification for more information.
You wouldn't ordinarily invoke this method directly; rather, you'd use an EOEditingContext to select and fetch enterprise objects.
See Also: - fetchObject
setCurrentEditingContext:
- (void)setCurrentEditingContext:(EOEditingContext
*)anEditingContext
See Also: - setCurrentEntity:
setCurrentEntity:
- (void)setCurrentEntity:(EOEntity
*)anEntity
See Also: - setCurrentEditingContext:
setDelegate:
- (void)setDelegate:(id)anObject
See Also: delegate
setIsLocking:
- (void)setIsLocking:(BOOL)flag
An EODatabaseChannel automatically sets this flag according to the fetch specification used in a selectObjectsWithFetchSpecification:editingContext: message. You might invoke this method directly if evaluating SQL directly with EOAdaptorChannel's evaluateExpression: method.
See Also: - locksObjects (EOFetchSpecification)
setIsRefreshingObjects:
- (void)setIsRefreshingObjects:(BOOL)flag
An EODatabaseChannel automatically sets this flag according to the fetch specification used in a selectObjectsWithFetchSpecification:editingContext: message. You might invoke this method directly if evaluating SQL directly with EOAdaptorChannel's evaluateExpression: method.
See Also: - refreshesRefetchedObjects (EOFetchSpecification)