home *** CD-ROM | disk | FTP | other *** search
- // EODatabaseChannel.h
- // Copyright (c) 1994, NeXT Software, Inc. All rights reserved.
-
- #import <EOControl/EOControl.h>
-
- @class EODatabaseContext;
- @class EODatabaseChannel;
- @class EOAdaptorChannel;
- @class EORelationship;
- @class EOEntity;
-
- // An EODatabaseChannel manipulates records as instances of classes specified
- // in the EOModel.
- //
- // An EODatabaseChannel works with an EODatabaseContext object, which handles
- // transactions. All of an EODatabaseChannel operations take place within the
- // context of transactions controlled or tracked by the EODatabaseContext.
- // An EODatabaseContext may work with several EODatabaseChannels, but a
- // channel is associated with only one context.
- //
- // Not all adaptors support multiple channels per context.
- //
- // An EODatabaseChannel creates a EOAdaptorChannel when initialized, and uses
- // this object to actually communicate with the database server.
-
- @interface EODatabaseChannel:NSObject
- {
- EODatabaseContext *_databaseContext;
- id _delegate;
- EOAdaptorChannel *_adaptorChannel;
- EOEntity *_currentEntity;
- EOEditingContext *_currentEditCtx;
- NSMutableArray *_fetchProperties;
- NSMutableArray *_fetchSpecifications;
- BOOL _isLocking;
- BOOL _isRefreshingObjects;
- struct {
- unsigned shouldSelectObjects:1;
- unsigned didSelectObjects:1;
- unsigned shouldUsePessimisticLock:1;
- unsigned int shouldUpdateSnapshot:1;
- unsigned int _RESERVED:28;
- } _delegateRespondsTo;
- }
-
- - initWithDatabaseContext:(EODatabaseContext *)databaseContext;
- // Initializes a newly allocated EODatabaseChannel with databaseContext
- // as its parent. Returns self, or nil if no more channels can be
- // associated with databaseContext.
- // The channel does not retain its context (but usually the context is
- // the object store of an editing context and is retained by it.
- // The channel is not automatically registered in the channel pool for
- // it parent context. Call [databaseContext registerChannel:channel]
- // to add it.
-
- - (void)setCurrentEntity:(EOEntity *)entity;
- // Sets an internal entity variable that is used for fetching.
- // -fetchObject uses the currentEntity to determine the class of object
- // to fetch. EODatabaseChannel clients can invoke this method after
- // issuing a select statement by sending -evaluateExpression: to the
- // database channel's adaptor channel to set the class of object fetched.
-
- - (void)setCurrentEditingContext:(EOEditingContext *)context;
- // Sets an internal context variable that is used for fetching.
- // -fetchObject uses the current editing context to determine where
- // store the object. EODatabaseChannel clients can invoke this method after
- // issuing a select statement by sending -evaluateExpression: to the
- // database channel's adaptor channel.
-
- - (void)selectObjectsWithFetchSpecification:(EOFetchSpecification *)fetchSpecification editingContext:(EOEditingContext *)context;
- // Selects objects by evaluating the qualifier; when fetched, objects will
- // be returned in the order prescribed by the fetch order. Raises an exception
- // if an error occurs.
-
- - (id)fetchObject;
- // Fetches and returns the next selected object; returns nil when there
- // are no more objects in the result set. Raises an exception
- // if an error occurs.
-
- - (BOOL)isFetchInProgress;
- // Returns YES if the database channel is fetching, NO otherwise. A
- // database channel is fetching if it's been sent a successful
- // -selectObjectsDescribedByQualifier:... message. A database channel
- // stops fetching when there are no more objects to fetch or when it's
- // sent a -cancelFetch message.
-
- - (void)cancelFetch;
- // Cancels any fetch currently in progress.
-
- - (EODatabaseContext *)databaseContext;
- // Returns the EODatabaseContext that controls transactions for the
- // channel.
-
- - (EOAdaptorChannel *)adaptorChannel;
- // Returns the EOAdaptorChannel used by the EODatabaseChannel for
- // communication with the database server.
-
- - (BOOL)isRefreshingObjects;
- - (void)setIsRefreshingObjects:(BOOL)yn;
-
- - (BOOL)isLocking;
- - (void)setIsLocking:(BOOL)isLocking;
- // Sets/returns whether the channel is fetching objects that are locked in
- // the database. Useful when fetching objects that result from a direct call
- // to the adaptorChannels evaluateExpression: method and when fetching multiple
- // result sets. This is reset to NO after each result set, so this must be reset
- // when multiple result sets or being fetched with locks.
-
- - (void)setDelegate:delegate;
- - delegate;
- // These methods return/set the delegate of the database channel. The channel's
- // delegate is normally set by the database context whenever it's delegate method
- // is set or whenever the database channel is created. This means that a database
- // context and all of it's channels will have the same delegate.
-
- @end
-
-
-