[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMIT][GDL2] Bugfixes EOEntity and EODatabaseDataSource
From: |
David Ayers |
Subject: |
[COMMIT][GDL2] Bugfixes EOEntity and EODatabaseDataSource |
Date: |
Thu, 15 May 2003 00:37:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030507 |
This fixes the bugs reported by Dirk Lattermann, thanks!
* EOAccess/EODatabaseDataSource.m ([EODatabaseDataSource
-initWithEditingContext:entityName:fetchSpecificationName:]):
Create default fetch specification if we cannot obtain one from
the entity by name as reported by Dirk Lattermann.
* EOAccess/EOEntity.h/m
([EOEntity -addFetchSpecification:withName:]): Corrected name and
initialization as reported by Dirk Lattermann.
Committed,
Cheers,
Dave
Index: EOAccess/EODatabaseDataSource.m
===================================================================
RCS file:
/cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EODatabaseDataSource.m,v
retrieving revision 1.6
diff -u -r1.6 EODatabaseDataSource.m
--- EOAccess/EODatabaseDataSource.m 31 Mar 2003 00:24:14 -0000 1.6
+++ EOAccess/EODatabaseDataSource.m 14 May 2003 21:31:07 -0000
@@ -77,17 +77,17 @@
@implementation EODatabaseDataSource
-- initWithEditingContext: (EOEditingContext *)editingContext
- entityName: (NSString *)entityName
+- (id)initWithEditingContext: (EOEditingContext *)editingContext
+ entityName: (NSString *)entityName
{
return [self initWithEditingContext: editingContext
entityName: entityName
fetchSpecificationName: nil];
}
-- initWithEditingContext: (EOEditingContext *)editingContext
- entityName: (NSString *)entityName
- fetchSpecificationName: (NSString *)fetchName
+- (id)initWithEditingContext: (EOEditingContext *)editingContext
+ entityName: (NSString *)entityName
+ fetchSpecificationName: (NSString *)fetchName
{
NSArray *stores;
EODatabaseContext *store = nil;
@@ -95,6 +95,7 @@
EOModel *model;
EOEntity *entity = nil;
id rootStore;
+ EOFetchSpecification *fetchSpec;
if ((self = [super init]))
{
@@ -146,8 +147,16 @@
self,
editingContext,
entityName];
-
- ASSIGN(_fetchSpecification, [entity fetchSpecificationNamed:fetchName]);
+
+ fetchSpec = [entity fetchSpecificationNamed: fetchName];
+ if (fetchSpec == nil)
+ {
+ fetchSpec = [EOFetchSpecification
+ fetchSpecificationWithEntityName: entityName
+ qualifier: nil
+ sortOrderings: nil];
+ }
+ ASSIGN(_fetchSpecification, fetchSpec);
}
return self;
Index: EOAccess/EOEntity.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EOEntity.h,v
retrieving revision 1.4
diff -u -r1.4 EOEntity.h
--- EOAccess/EOEntity.h 31 Mar 2003 00:24:14 -0000 1.4
+++ EOAccess/EOEntity.h 14 May 2003 21:31:08 -0000
@@ -235,7 +235,7 @@
- (void)removeRelationship: (EORelationship *)relationship;
- (void)addFetchSpecification: (EOFetchSpecification *)fetchSpec
- named: (NSString *)name;
+ withName: (NSString *)name;
- (void)removeFetchSpecificationNamed: (NSString *)name;
- (void)setClassName: (NSString*)name;
Index: EOAccess/EOEntity.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EOEntity.m,v
retrieving revision 1.17
diff -u -r1.17 EOEntity.m
--- EOAccess/EOEntity.m 5 May 2003 16:24:17 -0000 1.17
+++ EOAccess/EOEntity.m 14 May 2003 21:31:08 -0000
@@ -278,11 +278,12 @@
if (tmpObject)
{
+ tmpObject = AUTORELEASE([tmpObject mutableCopy]);
ASSIGN(_fetchSpecificationDictionary, tmpObject);
}
else
{
- _fetchSpecificationDictionary = [NSDictionary new];
+ _fetchSpecificationDictionary = [NSMutableDictionary new];
EOFLOGObjectLevelArgs(@"EOEntity",
@"Entity %@ - _fetchSpecificationDictionary %p [RC=%d]:%@",
@@ -331,7 +332,7 @@
//NSLog(@"fetchSpecName:%@ fetchSpec:%@", fetchSpecName,
fetchSpec);
[self addFetchSpecification: fetchSpec
- named: fetchSpecName];
+ withName: fetchSpecName];
}
}
}
@@ -519,6 +520,7 @@
DESTROY(_externalQuery);
DESTROY(_userInfo);
DESTROY(_docComment);
+ DESTROY(_fetchSpecificationDictionary);
DESTROY(_primaryKeyAttributeNames);
DESTROY(_classPropertyNames);
DESTROY(_classDescription);
@@ -2131,8 +2133,13 @@
}
- (void)addFetchSpecification: (EOFetchSpecification *)fetchSpec
- named: (NSString *)name
+ withName: (NSString *)name
{
+ if (_fetchSpecificationDictionary == nil)
+ {
+ _fetchSpecificationDictionary = [NSMutableDictionary new];
+ }
+
[_fetchSpecificationDictionary setObject: fetchSpec forKey: name];
ASSIGN(_fetchSpecificationNames, [[_fetchSpecificationDictionary allKeys]
sortedArrayUsingSelector:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMIT][GDL2] Bugfixes EOEntity and EODatabaseDataSource,
David Ayers <=