mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-22 02:41:05 +00:00
* EOAccess/EODatabaseContext.m (-forgetSnapshotForGlobalID:):
Handle deleted globalIDs correctly. (-forgetSnapshotsForGlobalIDs:): Ditto. (-_commitTransaction, -_beginTransaction): Ditto. (-_rollbackTransaction): Implement. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@20836 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6a28dfbc6e
commit
1f9afe4934
2 changed files with 59 additions and 35 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-03-03 David Ayers <d.ayers@inode.at>
|
||||||
|
|
||||||
|
* EOAccess/EODatabaseContext.m (-forgetSnapshotForGlobalID:):
|
||||||
|
Handle deleted globalIDs correctly.
|
||||||
|
(-forgetSnapshotsForGlobalIDs:): Ditto.
|
||||||
|
(-_commitTransaction, -_beginTransaction): Ditto.
|
||||||
|
(-_rollbackTransaction): Implement.
|
||||||
|
|
||||||
2005-03-03 Matt Rice <ratmice@yahoo.com>
|
2005-03-03 Matt Rice <ratmice@yahoo.com>
|
||||||
David Ayers <d.ayers@inode.at>
|
David Ayers <d.ayers@inode.at>
|
||||||
|
|
||||||
|
|
|
@ -6334,22 +6334,24 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
|
|
||||||
if ([_uniqueStack count] > 0)
|
if ([_uniqueStack count] > 0)
|
||||||
{
|
{
|
||||||
NSMutableDictionary *snapshots = [_uniqueStack lastObject];
|
NSMutableDictionary *uniqueSS = [_uniqueStack lastObject];
|
||||||
|
NSMutableDictionary *uniqArSS = [_uniqueArrayStack lastObject];
|
||||||
|
NSMutableSet *deleteSS = [_deleteStack lastObject];
|
||||||
|
|
||||||
//call _deleteStack lastObject
|
[deleteSS addObject: gid];
|
||||||
[snapshots removeObjectForKey: gid];
|
[uniqueSS removeObjectForKey: gid];
|
||||||
snapshots = [_uniqueArrayStack lastObject];
|
[uniqArSS removeObjectForKey: gid];
|
||||||
[snapshots removeObjectForKey: gid];
|
|
||||||
}
|
}
|
||||||
[_database forgetSnapshotForGlobalID: gid]; //MG Really here ?
|
|
||||||
|
|
||||||
EOFLOGObjectFnStop();
|
EOFLOGObjectFnStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)forgetSnapshotsForGlobalIDs: (NSArray *)gids
|
- (void)forgetSnapshotsForGlobalIDs: (NSArray *)gids
|
||||||
{
|
{
|
||||||
unsigned i, n;
|
unsigned i, j, n, m;
|
||||||
NSMutableDictionary *snapshots;
|
NSMutableDictionary *snapshots;
|
||||||
|
NSMutableSet *deleteGIDs;
|
||||||
|
EOGlobalID *gid;
|
||||||
EOFLOGObjectFnStart();
|
EOFLOGObjectFnStart();
|
||||||
|
|
||||||
n = [_uniqueStack count];
|
n = [_uniqueStack count];
|
||||||
|
@ -6367,7 +6369,8 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
n = [_uniqueArrayStack count];
|
n = [_uniqueArrayStack count];
|
||||||
if (n>0)
|
if (n>0)
|
||||||
{
|
{
|
||||||
IMP oaiIMP=[_uniqueArrayStack methodForSelector: @selector(objectAtIndex:)];
|
IMP oaiIMP
|
||||||
|
= [_uniqueArrayStack methodForSelector: @selector(objectAtIndex:)];
|
||||||
|
|
||||||
for (i=0; i<n; i++)
|
for (i=0; i<n; i++)
|
||||||
{
|
{
|
||||||
|
@ -6380,12 +6383,19 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
if (n>0)
|
if (n>0)
|
||||||
{
|
{
|
||||||
IMP oaiIMP=[_deleteStack methodForSelector: @selector(objectAtIndex:)];
|
IMP oaiIMP=[_deleteStack methodForSelector: @selector(objectAtIndex:)];
|
||||||
|
IMP oaiIMP2=[gids methodForSelector: @selector(objectAtIndex:)];
|
||||||
|
|
||||||
|
m = [gids count];
|
||||||
for (i=0; i<n; i++)
|
for (i=0; i<n; i++)
|
||||||
{
|
{
|
||||||
snapshots = GDL2_ObjectAtIndexWithImp(_deleteStack,oaiIMP,i);
|
deleteGIDs = GDL2_ObjectAtIndexWithImp(_deleteStack,oaiIMP,i);
|
||||||
[snapshots removeObjectsForKeys: gids];
|
for (j=0; j<m; j++)
|
||||||
|
{
|
||||||
|
gid = GDL2_ObjectAtIndexWithImp(gids, oaiIMP2, j);
|
||||||
|
[deleteGIDs removeObject: gid];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
[_database forgetSnapshotsForGlobalIDs: gids];
|
[_database forgetSnapshotsForGlobalIDs: gids];
|
||||||
EOFLOGObjectFnStop();
|
EOFLOGObjectFnStop();
|
||||||
|
@ -6693,48 +6703,54 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _rollbackTransaction
|
- (void)_rollbackTransaction
|
||||||
{ // TODO
|
{
|
||||||
EOFLOGObjectFnStart();
|
EOFLOGObjectFnStart();
|
||||||
|
|
||||||
NSEmitTODO();
|
if ([_uniqueStack count] > 0)
|
||||||
[self notImplemented: _cmd];
|
{
|
||||||
|
[self forgetAllLocks];
|
||||||
|
|
||||||
|
[_uniqueStack removeLastObject];
|
||||||
|
[_uniqueArrayStack removeLastObject];
|
||||||
|
[_deleteStack removeLastObject];
|
||||||
|
}
|
||||||
|
|
||||||
EOFLOGObjectFnStop();
|
EOFLOGObjectFnStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _commitTransaction
|
- (void)_commitTransaction
|
||||||
{
|
{
|
||||||
EOFLOGObjectFnStart();
|
EOFLOGObjectFnStart();
|
||||||
|
|
||||||
NSEmitTODO();
|
|
||||||
|
|
||||||
NSDebugMLLog(@"EODatabaseContext", @"self=%p _uniqueStack %p=%@",
|
NSDebugMLLog(@"EODatabaseContext", @"self=%p _uniqueStack %p=%@",
|
||||||
self, _uniqueStack, _uniqueStack);
|
self, _uniqueStack, _uniqueStack);
|
||||||
|
|
||||||
if ([_uniqueStack count] > 0)
|
if ([_uniqueStack count] > 0)
|
||||||
{
|
{
|
||||||
NSMutableDictionary *snapshotsDict = AUTORELEASE(RETAIN([_uniqueStack lastObject]));
|
NSMutableDictionary *snapshotsDict
|
||||||
NSMutableDictionary *toManySnapshotsDict = AUTORELEASE(RETAIN([_uniqueArrayStack
|
= [_uniqueStack lastObject];
|
||||||
lastObject]));
|
NSMutableDictionary *toManySnapshotsDict
|
||||||
/*NSMutableDictionary *deleteSnapshotsDict
|
= [_uniqueArrayStack lastObject];
|
||||||
= AUTORELEASE(RETAIN([_deleteStack lastObject]));*/ //??
|
NSMutableSet *deleteSnapshotsSet
|
||||||
|
= [_deleteStack lastObject];
|
||||||
|
NSEnumerator *deletedGIDEnum
|
||||||
|
= [deleteSnapshotsSet objectEnumerator];
|
||||||
|
EOGlobalID *gid;
|
||||||
|
|
||||||
[_uniqueStack removeLastObject];
|
while ((gid = [deletedGIDEnum nextObject]))
|
||||||
[_uniqueArrayStack removeLastObject];
|
{
|
||||||
[_deleteStack removeLastObject];
|
[_database forgetSnapshotForGlobalID: gid];
|
||||||
|
}
|
||||||
[self forgetAllLocks];
|
|
||||||
|
|
||||||
[_database recordSnapshots: snapshotsDict];
|
[_database recordSnapshots: snapshotsDict];
|
||||||
[_database recordToManySnapshots: toManySnapshotsDict];
|
[_database recordToManySnapshots: toManySnapshotsDict];
|
||||||
|
|
||||||
/* //TODO
|
[self forgetAllLocks];
|
||||||
if (moified ojects)
|
|
||||||
call forgetSnapshotForGlobalID: ...
|
[_uniqueStack removeLastObject];
|
||||||
<<<<
|
[_uniqueArrayStack removeLastObject];
|
||||||
DESTROY(_modifiedObjects);
|
[_deleteStack removeLastObject];
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSDebugMLLog(@"EODatabaseContext", @"self=%p _uniqueStack %p=%@",
|
NSDebugMLLog(@"EODatabaseContext", @"self=%p _uniqueStack %p=%@",
|
||||||
|
@ -6749,7 +6765,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
|
|
||||||
[_uniqueStack addObject: [NSMutableDictionary dictionary]];
|
[_uniqueStack addObject: [NSMutableDictionary dictionary]];
|
||||||
[_uniqueArrayStack addObject: [NSMutableDictionary dictionary]];
|
[_uniqueArrayStack addObject: [NSMutableDictionary dictionary]];
|
||||||
[_deleteStack addObject: [NSMutableDictionary dictionary]]; //TODO: put an object in the dictionary
|
[_deleteStack addObject: [NSMutableSet set]];
|
||||||
|
|
||||||
NSDebugMLLog(@"EODatabaseContext", @"self=%p _uniqueStack %p=%@",
|
NSDebugMLLog(@"EODatabaseContext", @"self=%p _uniqueStack %p=%@",
|
||||||
self, _uniqueStack, _uniqueStack);
|
self, _uniqueStack, _uniqueStack);
|
||||||
|
|
Loading…
Reference in a new issue