mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 12:55:44 +00:00
* EOAccess/EOModel.m (-[_updateCache]): New method.
* EOAccess/EOEntity.m (-[EOModel _updateCache]): Declare private EOModel method. (-[setName:]): Insure model updates its cache. (-[setModel]): Set instance variable directly without retaining it. (-[_setModel]): Remove. (-[gcDecrementRefCountOfContainedObjects]): Do not decrement backward reference to owning model. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@20023 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8c6ec0c1c3
commit
a65e5d5f94
3 changed files with 56 additions and 26 deletions
10
ChangeLog
10
ChangeLog
|
@ -4,6 +4,16 @@
|
|||
* EOAccess/EOAttribute.m (_parent, -[setParent:]): Do not retain
|
||||
backward reference.
|
||||
(-[setName:): Mark as editited if parent is an entity.
|
||||
|
||||
* EOAccess/EOModel.m (-[_updateCache]): New method.
|
||||
* EOAccess/EOEntity.m
|
||||
(-[EOModel _updateCache]): Declare private EOModel method.
|
||||
(-[setName:]): Insure model updates its cache.
|
||||
(-[setModel]): Set instance variable directly without
|
||||
retaining it.
|
||||
(-[_setModel]): Remove.
|
||||
(-[gcDecrementRefCountOfContainedObjects]): Do not decrement
|
||||
backward reference to owning model.
|
||||
|
||||
2004-06-23 David Ayers <d.ayers@inode.at>
|
||||
|
||||
|
|
|
@ -86,6 +86,9 @@ RCS_ID("$Id$")
|
|||
#include "EOEntityPriv.h"
|
||||
#include "EOAttributePriv.h"
|
||||
|
||||
@interface EOModel (Privat)
|
||||
- (void)_updateCache;
|
||||
@end
|
||||
|
||||
NSString *EOFetchAllProcedureOperation = @"EOFetchAllProcedureOperation";
|
||||
NSString *EOFetchWithPrimaryKeyProcedureOperation = @"EOFetchWithPrimaryKeyProcedureOperation";
|
||||
|
@ -545,19 +548,16 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
NS_DURING
|
||||
{
|
||||
where = 1;
|
||||
[_model gcDecrementRefCount];
|
||||
|
||||
where = 2;
|
||||
EOFLOGObjectLevel(@"EOEntity", @"attributes gcDecrementRefCount");
|
||||
if (!_flags.attributesIsLazy)
|
||||
[(id)_attributes gcDecrementRefCount];
|
||||
|
||||
where = 3;
|
||||
where = 2;
|
||||
EOFLOGObjectLevel(@"EOEntity",
|
||||
@"propertiesToFault gcDecrementRefCount");
|
||||
[(id)_attributesByName gcDecrementRefCount];
|
||||
|
||||
where = 4;
|
||||
where = 3;
|
||||
EOFLOGObjectLevelArgs(@"EOEntity",
|
||||
@"attributesToFetch gcDecrementRefCount class=%@",
|
||||
[_attributesToFetch class]);
|
||||
|
@ -577,56 +577,56 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
[_attributesToFetch class],
|
||||
_attributesToFetch);
|
||||
|
||||
where = 5;
|
||||
where = 4;
|
||||
EOFLOGObjectLevelArgs(@"EOEntity",
|
||||
@"attributesToSave gcDecrementRefCount (class=%@)",
|
||||
[_attributesToSave class]);
|
||||
[(id)_attributesToSave gcDecrementRefCount];
|
||||
|
||||
where = 6;
|
||||
where = 5;
|
||||
EOFLOGObjectLevel(@"EOEntity",
|
||||
@"propertiesToFault gcDecrementRefCount");
|
||||
[(id)_propertiesToFault gcDecrementRefCount];
|
||||
|
||||
where = 7;
|
||||
where = 6;
|
||||
EOFLOGObjectLevel(@"EOEntity",
|
||||
@"rrelationships gcDecrementRefCount");
|
||||
if (!_flags.relationshipsIsLazy)
|
||||
[(id)_relationships gcDecrementRefCount];
|
||||
|
||||
where = 8;
|
||||
where = 7;
|
||||
EOFLOGObjectLevel(@"EOEntity",
|
||||
@"relationshipsByName gcDecrementRefCount");
|
||||
[(id)_relationshipsByName gcDecrementRefCount];
|
||||
|
||||
where = 9;
|
||||
where = 8;
|
||||
EOFLOGObjectLevel(@"EOEntity",
|
||||
@"primaryKeyAttributes gcDecrementRefCount");
|
||||
if (!_flags.primaryKeyAttributesIsLazy)
|
||||
[(id)_primaryKeyAttributes gcDecrementRefCount];
|
||||
|
||||
where = 10;
|
||||
where = 9;
|
||||
EOFLOGObjectLevel(@"EOEntity",
|
||||
@"classProperties gcDecrementRefCount");
|
||||
if (!_flags.classPropertiesIsLazy)
|
||||
[(id)_classProperties gcDecrementRefCount];
|
||||
|
||||
where = 11;
|
||||
where = 10;
|
||||
EOFLOGObjectLevelArgs(@"EOEntity",
|
||||
@"attributesUsedForLocking (%@) gcDecrementRefCount",
|
||||
[_attributesUsedForLocking class]);
|
||||
if (!_flags.attributesUsedForLockingIsLazy)
|
||||
[(id)_attributesUsedForLocking gcDecrementRefCount];
|
||||
|
||||
where = 12;
|
||||
where = 11;
|
||||
EOFLOGObjectLevel(@"EOEntity", @"subEntities gcDecrementRefCount");
|
||||
[(id)_subEntities gcDecrementRefCount];
|
||||
|
||||
where = 13;
|
||||
where = 12;
|
||||
EOFLOGObjectLevel(@"EOEntity", @"dbSnapshotKeys gcDecrementRefCount");
|
||||
[(id)_dbSnapshotKeys gcDecrementRefCount];
|
||||
|
||||
where = 14;
|
||||
where = 13;
|
||||
EOFLOGObjectLevel(@"EOEntity", @"_parent gcDecrementRefCount");
|
||||
[_parent gcDecrementRefCount];
|
||||
}
|
||||
|
@ -1883,6 +1883,7 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
name];
|
||||
|
||||
ASSIGN(_name, name);
|
||||
[_model _updateCache];
|
||||
}
|
||||
|
||||
- (void)setExternalName: (NSString *)name
|
||||
|
@ -2475,7 +2476,7 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
[_attributesToFetch class],
|
||||
_attributesToFetch);
|
||||
|
||||
[self _setModel: model];
|
||||
_model = model;
|
||||
}
|
||||
|
||||
- (void)setParentEntity: (EOEntity *)parent
|
||||
|
@ -2589,7 +2590,7 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
|
||||
//DESTROY v later because it may be still in use
|
||||
#define AUTORELEASE_SETNIL(v) { AUTORELEASE(v); v=nil; }
|
||||
- (void) _setIsEdited
|
||||
- (void)_setIsEdited
|
||||
{
|
||||
if(_flags.updating)
|
||||
return;
|
||||
|
@ -3428,15 +3429,6 @@ returns nil if there's no key in the instanceDictionaryInitializer
|
|||
return _instanceDictionaryInitializer;
|
||||
}
|
||||
|
||||
- (void) _setModel: (EOModel *)model
|
||||
{
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEntity", @"_setModel=%p", model);
|
||||
ASSIGN(_model, model);
|
||||
|
||||
EOFLOGObjectFnStop();
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation EOEntity (EOEntityRelationshipPrivate)
|
||||
|
|
|
@ -1799,4 +1799,32 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
|
|||
return entity;
|
||||
}
|
||||
|
||||
/*
|
||||
This method rebuilds the caches:
|
||||
_entitiesByName, _subEntitiesCache, _entitiesByClass
|
||||
from _entities. Insure this works for real entities and dictionaries
|
||||
which could be contained in _entities. Also note that className need
|
||||
not be unique.
|
||||
*/
|
||||
- (void)_updateCache
|
||||
{
|
||||
NSArray *names;
|
||||
EOEntity *entity;
|
||||
NSString *className;
|
||||
unsigned int i,c;
|
||||
|
||||
DESTROY(_entitiesByName);
|
||||
DESTROY(_subEntitiesCache);
|
||||
NSResetMapTable(_entitiesByClass);
|
||||
|
||||
names = [_entities valueForKey: @"name"];
|
||||
_entitiesByName = [[GCMutableDictionary alloc] initWithObjects: _entities
|
||||
forKeys: names];
|
||||
for (i = 0, c = [_entities count]; i < c; i++)
|
||||
{
|
||||
entity = [_entities objectAtIndex: i]; /* entity or dictionary */
|
||||
className = [entity valueForKey: @"className"];
|
||||
NSMapInsertIfAbsent(_entitiesByClass, className, entity);
|
||||
}
|
||||
}
|
||||
@end /* EOModel (EOModelPrivate) */
|
||||
|
|
Loading…
Reference in a new issue