* EOAccess/EODatabase.m

* EOAccess/EODatabase.h
add _doesReleaseUnreferencedSnapshots
add dummy for incrementSnapshotCountForGlobalID
add dummy for decrementSnapshotCountForGlobalID
add disableSnapshotRefcounting
* EOAccess/EODatabaseContext.m
retain EOAdaptorChannel created by adaptor
This is documented in WO 4.5.
Otherwise it gets closed after the request's
autorelease pool is drained.
I tested this on OSX with the BookStore example.
added some dummies for future implementation
refactor objectsWithFetchSpecification: editingContext:
refactor commitChanges
* EOAccess/EODatabaseChannel.m
reformat
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m
add include
* EOControl/EOGenericRecord.m
add [self willChange] in setValue:forUndefinedKey:
this will make saving changes possible for EOGenericRecord
otherwise it was just showing them in memory



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30675 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-06-11 12:17:45 +00:00
parent 91c53d83dc
commit 6294a2b46f
7 changed files with 535 additions and 1064 deletions

View file

@ -1,3 +1,28 @@
2010-06-11 David Wetzel <dave@turbocat.de>
* EOAccess/EODatabase.m
* EOAccess/EODatabase.h
add _doesReleaseUnreferencedSnapshots
add dummy for incrementSnapshotCountForGlobalID
add dummy for decrementSnapshotCountForGlobalID
add disableSnapshotRefcounting
* EOAccess/EODatabaseContext.m
retain EOAdaptorChannel created by adaptor
This is documented in WO 4.5.
Otherwise it gets closed after the request's
autorelease pool is drained.
I tested this on OSX with the BookStore example.
added some dummies for future implementation
refactor objectsWithFetchSpecification: editingContext:
refactor commitChanges
* EOAccess/EODatabaseChannel.m
reformat
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLExpression.m
add include
* EOControl/EOGenericRecord.m
add [self willChange] in setValue:forUndefinedKey:
this will make saving changes possible for EOGenericRecord
otherwise it was just showing them in memory
2010-06-10 David Wetzel <dave@turbocat.de> 2010-06-10 David Wetzel <dave@turbocat.de>
* EOControl/EOGenericRecord.h * EOControl/EOGenericRecord.h
* EOControl/EOGenericRecord.m * EOControl/EOGenericRecord.m

View file

@ -72,6 +72,10 @@ GDL2ACCESS_EXPORT NSTimeInterval EODistantPastTimeInterval;
- (id)initWithModel: (EOModel *)model; - (id)initWithModel: (EOModel *)model;
- (void)incrementSnapshotCountForGlobalID:(EOGlobalID *)globalId;
- (void)decrementSnapshotCountForGlobalID:(EOGlobalID *)globalId;
+ (void)disableSnapshotRefcounting;
- (NSArray *)registeredContexts; - (NSArray *)registeredContexts;
- (void)registerContext: (EODatabaseContext *)context; - (void)registerContext: (EODatabaseContext *)context;

View file

@ -75,6 +75,7 @@ RCS_ID("$Id$")
NSString *EOGeneralDatabaseException = @"EOGeneralDatabaseException"; NSString *EOGeneralDatabaseException = @"EOGeneralDatabaseException";
NSTimeInterval EODistantPastTimeInterval = -603979776.0; NSTimeInterval EODistantPastTimeInterval = -603979776.0;
static BOOL _doesReleaseUnreferencedSnapshots = YES;
@implementation EODatabase @implementation EODatabase
@ -173,6 +174,29 @@ static NSMutableArray *databaseInstances;
[super dealloc]; [super dealloc];
} }
- (void)incrementSnapshotCountForGlobalID:(EOGlobalID *)globalId
{
if (!_doesReleaseUnreferencedSnapshots)
{
return;
}
GSOnceFLog(@"TODO: %s", __PRETTY_FUNCTION__);
}
- (void)decrementSnapshotCountForGlobalID:(EOGlobalID *)globalId
{
if (!_doesReleaseUnreferencedSnapshots)
{
return;
}
GSOnceFLog(@"TODO: %s", __PRETTY_FUNCTION__);
}
+ (void)disableSnapshotRefcounting
{
_doesReleaseUnreferencedSnapshots = NO;
}
- (NSArray *)registeredContexts - (NSArray *)registeredContexts
{ {
NSMutableArray *array = [NSMutableArray array]; NSMutableArray *array = [NSMutableArray array];

View file

@ -224,12 +224,13 @@ RCS_ID("$Id$")
- (void)setCurrentEditingContext: (EOEditingContext*)context - (void)setCurrentEditingContext: (EOEditingContext*)context
{ {
//OK if (context) {
EOCooperatingObjectStore *cooperatingObjectStore = [self databaseContext]; EOCooperatingObjectStore *cooperatingObjectStore = [self databaseContext];
EOObjectStore *objectStore = [context rootObjectStore]; EOObjectStore *objectStore = [context rootObjectStore];
[(EOObjectStoreCoordinator*)objectStore [(EOObjectStoreCoordinator*)objectStore
addCooperatingObjectStore: cooperatingObjectStore]; addCooperatingObjectStore: cooperatingObjectStore];
}
ASSIGN(_currentEditingContext, context); ASSIGN(_currentEditingContext, context);
} }
@ -302,8 +303,6 @@ RCS_ID("$Id$")
EODatabase *database=nil; EODatabase *database=nil;
id object = nil; id object = nil;
database = [_databaseContext database]; database = [_databaseContext database];
if (![self isFetchInProgress]) if (![self isFetchInProgress])
@ -342,6 +341,8 @@ RCS_ID("$Id$")
if transactionNestingLevel if transactionNestingLevel
adaptorContext transactionDidCommit adaptorContext transactionDidCommit
*/ */
return nil;
} }
else if([[_fetchSpecifications lastObject] fetchesRawRows]) // Testing against only one should be enough else if([[_fetchSpecifications lastObject] fetchesRawRows]) // Testing against only one should be enough
{ {

File diff suppressed because it is too large Load diff

View file

@ -51,6 +51,7 @@ RCS_ID("$Id$")
#ifndef GNUSTEP #ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h> #include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h> #include <GNUstepBase/NSDebug+GNUstepBase.h>
#include <GNUstepBase/NSObject+GNUstepBase.h>
#endif #endif
#include <EOControl/EONull.h> #include <EOControl/EONull.h>

View file

@ -772,6 +772,7 @@ inline BOOL infoForInstanceVariableWithImpPtr(id object,GDL2IMP_BOOL* impPtr,
- (void)setValue:(id)value forUndefinedKey:(NSString *)key - (void)setValue:(id)value forUndefinedKey:(NSString *)key
{ {
[self willChange];
[_dictionary setObject:value [_dictionary setObject:value
forKey:key]; forKey:key];
} }