home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / EODatabaseChannel.h < prev    next >
Encoding:
Text File  |  1996-09-09  |  4.9 KB  |  119 lines

  1. // EODatabaseChannel.h
  2. // Copyright (c) 1994, NeXT Software, Inc.  All rights reserved.
  3.  
  4. #import <EOControl/EOControl.h>
  5.  
  6. @class EODatabaseContext;
  7. @class EODatabaseChannel;
  8. @class EOAdaptorChannel;
  9. @class EORelationship;
  10. @class EOEntity;
  11.  
  12. // An EODatabaseChannel manipulates records as instances of classes specified
  13. // in the EOModel.
  14. //
  15. // An EODatabaseChannel works with an EODatabaseContext object, which handles
  16. // transactions.  All of an EODatabaseChannel operations take place within the
  17. // context of transactions controlled or tracked by the EODatabaseContext.
  18. // An EODatabaseContext may work with several EODatabaseChannels, but a
  19. // channel is associated with only one context.
  20. //
  21. // Not all adaptors support multiple channels per context.
  22. //
  23. // An EODatabaseChannel creates a EOAdaptorChannel when initialized, and uses
  24. // this object to actually communicate with the database server.
  25.  
  26. @interface EODatabaseChannel:NSObject
  27. {
  28.     EODatabaseContext *_databaseContext;
  29.     id _delegate;
  30.     EOAdaptorChannel *_adaptorChannel;
  31.     EOEntity *_currentEntity;
  32.     EOEditingContext *_currentEditCtx;
  33.     NSMutableArray *_fetchProperties;
  34.     NSMutableArray *_fetchSpecifications;
  35.     BOOL _isLocking;
  36.     BOOL _isRefreshingObjects;
  37.     struct {
  38.         unsigned shouldSelectObjects:1;
  39.         unsigned didSelectObjects:1;
  40.         unsigned shouldUsePessimisticLock:1;
  41.         unsigned int shouldUpdateSnapshot:1;
  42.         unsigned int _RESERVED:28;
  43.     } _delegateRespondsTo;
  44. }
  45.  
  46. - initWithDatabaseContext:(EODatabaseContext *)databaseContext;
  47.     // Initializes a newly allocated EODatabaseChannel with databaseContext
  48.     // as its parent. Returns self, or nil if no more channels can be
  49.     // associated with databaseContext.
  50.     // The channel does not retain its context (but usually the context is
  51.     // the object store of an editing context and is retained by it.
  52.     // The channel is not automatically registered in the channel pool for
  53.     // it parent context.  Call [databaseContext registerChannel:channel]
  54.     // to add it.
  55.  
  56. - (void)setCurrentEntity:(EOEntity *)entity;
  57.     // Sets an internal entity variable that is used for fetching.
  58.     // -fetchObject uses the currentEntity to determine the class of object
  59.     // to fetch.  EODatabaseChannel clients can invoke this method after
  60.     // issuing a select statement by sending -evaluateExpression: to the
  61.     // database channel's adaptor channel to set the class of object fetched.
  62.  
  63. - (void)setCurrentEditingContext:(EOEditingContext *)context;
  64.     // Sets an internal context variable that is used for fetching.
  65.     // -fetchObject uses the current editing context to determine where
  66.     // store the object.  EODatabaseChannel clients can invoke this method after
  67.     // issuing a select statement by sending -evaluateExpression: to the
  68.     // database channel's adaptor channel.
  69.  
  70. - (void)selectObjectsWithFetchSpecification:(EOFetchSpecification *)fetchSpecification editingContext:(EOEditingContext *)context;
  71.     // Selects objects by evaluating the qualifier; when fetched, objects will
  72.     // be returned in the order prescribed by the fetch order. Raises an exception
  73.     // if an error occurs.
  74.  
  75. - (id)fetchObject;
  76.     // Fetches and returns the next selected object; returns nil when there
  77.     // are no more objects in the result set. Raises an exception
  78.     // if an error occurs.
  79.  
  80. - (BOOL)isFetchInProgress;
  81.     // Returns YES if the database channel is fetching, NO otherwise. A
  82.     // database channel is fetching if it's been sent a successful
  83.     // -selectObjectsDescribedByQualifier:... message. A database channel
  84.     // stops fetching when there are no more objects to fetch or when it's
  85.     // sent a -cancelFetch message.
  86.  
  87. - (void)cancelFetch;
  88.     // Cancels any fetch currently in progress.
  89.  
  90. - (EODatabaseContext *)databaseContext;
  91.     // Returns the EODatabaseContext that controls transactions for the
  92.     // channel.
  93.  
  94. - (EOAdaptorChannel *)adaptorChannel;
  95.     // Returns the EOAdaptorChannel used by the EODatabaseChannel for
  96.     // communication with the database server.
  97.  
  98. - (BOOL)isRefreshingObjects;
  99. - (void)setIsRefreshingObjects:(BOOL)yn;
  100.  
  101. - (BOOL)isLocking;
  102. - (void)setIsLocking:(BOOL)isLocking;
  103.     // Sets/returns whether the channel is fetching objects that are locked in
  104.     // the database. Useful when fetching objects that result from a direct call
  105.     // to the adaptorChannels evaluateExpression: method and when fetching multiple
  106.     // result sets. This is reset to NO after each result set, so this must be reset
  107.     // when multiple result sets or being fetched with locks.
  108.  
  109. - (void)setDelegate:delegate;
  110. - delegate;
  111.     // These methods return/set the delegate of the database channel. The channel's
  112.     // delegate is normally set by the database context whenever it's delegate method
  113.     // is set or whenever the database channel is created. This means that a database
  114.     // context and all of it's channels will have the same delegate.
  115.  
  116. @end
  117.  
  118.  
  119.