EODatabase
Inherits from: NSObject
Conforms to: NSObject
(NSObject)
Declared in: EOAccess/EODatabase.h
Class Description
An EODatabase object represents a single database server. It contains an EOAdaptor which is capable of communicating with the server, a list of EOModels that describe the server's schema, a list of EODatabaseContexts that are connected to the server, and a set of snapshots representing the state of all objects stored in the server.
Each of an EODatabase's EODatabaseContexts forms a separate transaction scope, and is in effect a separate logical user to the server. An EODatabaseContext uses one or more pairs of EODatabaseChannel and EOAdaptorChannel objects to manage data operations (insert, update, delete, and fetch). Adaptors may support a limited number of contexts per database or channels per context, but an application is guaranteed at least one of each.
For more information on the EODatabase class, see the sections:
Constants
EOAccess declares the following constants in EODatabase.h.
Constant | Type | Description |
EODistantPastTimeInterval | NSTimeInterval | The lower bound on timestamps. |
EOGeneralDatabaseException | NSString | The name of exceptions raised by the database sublayer when errors occur during interactions with a database server. |
Method Types
- Creating instances
- - initWithModel:
- - initWithAdaptor:
- Adding and removing models
- - addModel:
- - addModelIfCompatible:
- - removeModel:
- - models
- Accessing entities
- - entityForObject:
- - entityNamed:
- Recording snapshots
- - recordSnapshot:forGlobalID:
- - recordSnapshot:forSourceGlobalID:relationshipName:
- - recordSnapshots:
- - recordToManySnapshots:
- Forgetting snapshots
- - forgetSnapshotForGlobalID:
- - forgetSnapshotsForGlobalIDs:
- - forgetAllSnapshots
- Accessing snapshots and snapshot timestamps
- - snapshotForGlobalID:after:
- - snapshotForGlobalID:
- - snapshotForSourceGlobalID:relationshipName:after:
- - snapshotForSourceGlobalID:relationshipName:
- - snapshots
- - timestampForGlobalID:
- - timestampForSourceGlobalID:relationshipName:
- Snapshot reference counting
- - incrementSnapshotCountForGlobalID:
- - decrementSnapshotCountForGlobalID:
- + disableSnapshotRefcounting
- Registering database contexts
- - registerContext:
- - unregisterContext:
- - registeredContexts
- Accessing the adaptor
- - adaptor
- Managing the database connection
- - handleDroppedConnection
- Managing the result cache
- - invalidateResultCache
- - invalidateResultCacheForEntityNamed:
- - resultCacheForEntityNamed:
- - setResultCache:forEntityNamed:
Class Methods
disableSnapshotRefcounting
+ (void)disableSnapshotRefcounting
Instance Methods
adaptor
- (EOAdaptor *)adaptor
See Also: - initWithAdaptor:, - initWithModel:
addModel:
- (void)addModel:(EOModel
*)aModel
See Also: - addModelIfCompatible:, - models, - removeModel:
addModelIfCompatible:
- (BOOL)addModelIfCompatible:(EOModel
*)aModel
See Also: - addModel:, - models, - removeModel:
decrementSnapshotCountForGlobalID:
- (void)decrementSnapshotCountForGlobalID:(EOGlobalID
*)globalId
entityForObject:
- (EOEntity *)entityForObject:(id)anObject
See Also: - entityNamed:
entityNamed:
- (EOEntity *)entityNamed:(NSString
*)entityName
See Also: - entityForObject:
forgetAllSnapshots
- (void)forgetAllSnapshots
EOObjectsChangedInStoreNotification
(defined
in the EOControl framework's EOObjectStore class) describing the
invalidated object. For a description of snapshots and their role
in an application, see the class description.See Also: - forgetSnapshotForGlobalID:, - forgetSnapshotsForGlobalIDs:, - recordSnapshot:forGlobalID:, - recordSnapshots:, - recordSnapshot:forSourceGlobalID:relationshipName:, - recordToManySnapshots:
forgetSnapshotForGlobalID:
- (void)forgetSnapshotForGlobalID:(EOGlobalID
*)globalID
EOObjectsChangedInStoreNotification
(defined
in the EOControl framework's EOObjectStore class) describing the
invalidated object. For a description of snapshots and their role
in an application, see the class description.See Also: - forgetSnapshotsForGlobalIDs:, - forgetAllSnapshots, - recordSnapshot:forGlobalID:
forgetSnapshotsForGlobalIDs:
- (void)forgetSnapshotsForGlobalIDs:(NSArray
*)globalIDs
See Also: - forgetSnapshotForGlobalID:, - forgetAllSnapshots, - recordSnapshots:
handleDroppedConnection
- (void)handleDroppedConnection
You should never invoke this method; it's invoked automatically by the Framework.
incrementSnapshotCountForGlobalID:
- (void)incrementSnapshotCountForGlobalID:(EOGlobalID
*)globalId
initWithAdaptor:
- initWithAdaptor:(EOAdaptor
*)anAdaptor
Typically, you don't need to programmatically create EODatabase objects. Rather, they are created automatically by the control layer. See the class description for more information. If you do need to create an EODatabase programmatically, you should never associate more than one EODatabase with a given EOAdaptor. In general, use initWithModel:, which automatically selects the adaptor.
initWithModel:
- initWithModel:(EOModel
*)aModel
See Also: + adaptorWithModel: ( EOAdaptor), - adaptorName ( EOModel)
invalidateResultCache
- (void)invalidateResultCache
See Also: - invalidateResultCacheForEntityNamed:, - resultCacheForEntityNamed:
invalidateResultCacheForEntityNamed:
- (void)invalidateResultCacheForEntityNamed:(NSString
*)entityName
See Also: - invalidateResultCache, - resultCacheForEntityNamed:
models
- (NSArray *)models
See Also: - initWithModel:, - addModel:, - addModelIfCompatible:, - removeModel:
recordSnapshot:forGlobalID:
- (void)recordSnapshot:(NSDictionary
*)aSnapshot
forGlobalID:(EOGlobalID *)globalID
See Also: - globalIDForRow: ( EOEntity), - recordSnapshots:, - forgetSnapshotForGlobalID:
recordSnapshot:forSourceGlobalID:relationshipName:
- (void)recordSnapshot:(NSArray
*)globalIDs
forSourceGlobalID:(EOGlobalID
*)globalID
relationshipName:(NSString *)name
See Also: - recordSnapshot:forGlobalID:, - recordSnapshots:, - recordSnapshot:forGlobalID:, - snapshotForSourceGlobalID:relationshipName:
recordSnapshots:
- (void)recordSnapshots:(NSDictionary
*)snapshots
See Also: - recordSnapshot:forGlobalID:, - forgetSnapshotsForGlobalIDs:
recordToManySnapshots:
- (void)recordToManySnapshots:(NSDictionary
*)snapshots
See Also: - recordSnapshot:forSourceGlobalID:relationshipName:, - recordSnapshot:forGlobalID:, - snapshotForSourceGlobalID:relationshipName:
registerContext:
- (void)registerContext:(EODatabaseContext
*)aContext
See Also: - unregisterContext:, - registeredContexts
registeredContexts
- (NSArray *)registeredContexts
See Also: - registerContext:, - unregisterContext:
removeModel:
- (void)removeModel:(EOModel
*)aModel
See Also: - addModel:, - addModelIfCompatible:, - models
resultCacheForEntityNamed:
- (NSArray *)resultCacheForEntityNamed:(NSString
*)entityName
See Also: - invalidateResultCache, - invalidateResultCacheForEntityNamed:
setResultCache:forEntityNamed:
- (void)setResultCache:(NSArray
*)cache
forEntityNamed:(NSString *)entityName
See Also: - invalidateResultCache, - invalidateResultCacheForEntityNamed:, - resultCacheForEntityNamed:
setTimestampToNow
- (void)setTimestampToNow
snapshotForGlobalID:
- (NSDictionary *)snapshotForGlobalID:(EOGlobalID
*)globalID
snapshotForGlobalID:after:
- (NSDictionary *)snapshotForGlobalID:(EOGlobalID
*)globalId
after:(NSTimeInterval)timestamp
nil
if there
isn't a snapshot for the globalID or if the corresponding timestamp
is less than timestamp. For a description of snapshots and their
role in an application, see the class description.See Also: - recordSnapshot:forGlobalID:, - forgetSnapshotForGlobalID:
snapshotForSourceGlobalID:relationshipName:
- (NSArray *)snapshotForSourceGlobalID:(EOGlobalID
*)globalID
relationshipName:(NSString *)name
snapshotForSourceGlobalID:relationshipName:after:
- (NSArray *)snapshotForSourceGlobalID:(EOGlobalID
*)globalID
relationshipName:(NSString *)name
after:(NSTimeInterval)timestamp
nil
if
there isn't a to-many snapshot for globalId or
if the timestamp is less than timestamp. For a description of snapshots
and their role in an application, see the class description.snapshots
- (NSDictionary *)snapshots
See Also: - recordSnapshot:forSourceGlobalID:relationshipName:, - recordToManySnapshots:
timestampForGlobalID:
- (NSTimeInterval)timestampForGlobalID:(EOGlobalID
*)globalId
EODistantPastTimeInterval
if
there isn't a snapshot.timestampForSourceGlobalID:relationshipName:
- (NSTimeInterval)timestampForSourceGlobalID:(EOGlobalID
*)globalId
relationshipName:(NSString *)relationshipName
EODistantPastTimeInterval
if
there isn't a snapshot.unregisterContext:
- (void)unregisterContext:(EODatabaseContext
*)aContext
See Also: - registerContext:, - registeredContexts