mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 09:40:59 +00:00
Optimizations :
2005-02-13 Manuel Guesdon <mguesdon@orange-concept.com> * EOControl/EOClassDescription.m: o use IMPs o avoid NSString build in -addObject:toPropertyWithKey: o avoid NSString build in -removeObject:fromPropertyWithKey: * EOAccess/EODatabaseContext.m: o added and use EODatabaseContext_globalIDForObjectWithImpPtr o use IMPs * EOAccess/EOEntity.m: o use IMPs * EOAccess/EOAttribute.m: o use IMPs o optimized -validateValue * EOAccess/EODatabaseContextPriv.h: o added EODatabaseContext_globalIDForObjectWithImpPtr * EOControl/EOPriv.[hm]: o added more helpers * EOControl/EOEditingContext.m: o use IMPs * EOControl/EOGenericRecord.m: o use IMPs in descriptions * EOAdaptors/Postgres95Values.m: o use GDL2StringDefaultCStringEncoding() in +newValueForCharactersType:length:attribute: * EOAdaptors/Postgres95Channel.m: o IMP optimizations * EOAdaptors/Postgres95Adaptor.m: o IMP optimizations git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@20700 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bd72217067
commit
8f9ee35c5c
14 changed files with 1249 additions and 550 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2005-02-13 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* EOControl/EOClassDescription.m:
|
||||
o use IMPs
|
||||
o avoid NSString build in -addObject:toPropertyWithKey:
|
||||
o avoid NSString build in -removeObject:fromPropertyWithKey:
|
||||
* EOAccess/EODatabaseContext.m:
|
||||
o added and use EODatabaseContext_globalIDForObjectWithImpPtr
|
||||
o use IMPs
|
||||
* EOAccess/EOEntity.m:
|
||||
o use IMPs
|
||||
* EOAccess/EOAttribute.m:
|
||||
o use IMPs
|
||||
o optimized -validateValue
|
||||
* EOAccess/EODatabaseContextPriv.h:
|
||||
o added EODatabaseContext_globalIDForObjectWithImpPtr
|
||||
* EOControl/EOPriv.[hm]:
|
||||
o added more helpers
|
||||
* EOControl/EOEditingContext.m:
|
||||
o use IMPs
|
||||
* EOControl/EOGenericRecord.m:
|
||||
o use IMPs in descriptions
|
||||
* EOAdaptors/Postgres95Values.m:
|
||||
o use GDL2StringDefaultCStringEncoding() in
|
||||
+newValueForCharactersType:length:attribute:
|
||||
* EOAdaptors/Postgres95Channel.m:
|
||||
o IMP optimizations
|
||||
* EOAdaptors/Postgres95Adaptor.m:
|
||||
o IMP optimizations
|
||||
|
||||
2005-02-11 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
|
||||
* EOAccess/EOAdaptor.m:
|
||||
|
|
|
@ -1136,8 +1136,7 @@ return nexexp
|
|||
switch (_argumentType)
|
||||
{
|
||||
case EOFactoryMethodArgumentIsNSString:
|
||||
value = [GDL2NSString_alloc() initWithData: [NSData dataWithBytes: bytes
|
||||
length: length]
|
||||
value = [GDL2NSString_alloc() initWithData: GDL2DataWithBytesAndLength(bytes,length)
|
||||
encoding: encoding];//For efficiency reasons, the returned value is NOT autoreleased !
|
||||
|
||||
value = [(id)valueClass performSelector: _valueFactoryMethod
|
||||
|
@ -1169,7 +1168,7 @@ return nexexp
|
|||
|
||||
if(!value)
|
||||
value = [GDL2NSString_alloc()
|
||||
initWithData: [NSData dataWithBytes: bytes length: length]
|
||||
initWithData: GDL2DataWithBytesAndLength(bytes,length)
|
||||
encoding: encoding];//For efficiency reasons, the returned value is NOT autoreleased !
|
||||
|
||||
return value;
|
||||
|
@ -1408,42 +1407,58 @@ return nexexp
|
|||
{
|
||||
if (valueClass == GDL2NSNumberClass)
|
||||
{
|
||||
if ([[self valueType] isEqualToString: @"i"] == YES)
|
||||
*valueP = [NSNumber numberWithInt:
|
||||
[*valueP intValue]];
|
||||
else if ([_valueType isEqualToString: @"I"] == YES)
|
||||
*valueP = [NSNumber numberWithUnsignedInt:
|
||||
char valueTypeChar=[self _valueTypeChar];
|
||||
switch(valueTypeChar)
|
||||
{
|
||||
case 'i':
|
||||
*valueP = [NSNumber numberWithInt:
|
||||
[*valueP intValue]];
|
||||
break;
|
||||
case 'I':
|
||||
*valueP = [NSNumber numberWithUnsignedInt:
|
||||
[*valueP unsignedIntValue]];
|
||||
break;
|
||||
case 'c':
|
||||
*valueP = [NSNumber numberWithChar:
|
||||
[*valueP intValue]];
|
||||
break;
|
||||
case 'C':
|
||||
*valueP = [NSNumber numberWithUnsignedChar:
|
||||
[*valueP unsignedIntValue]];
|
||||
else if ([_valueType isEqualToString: @"c"] == YES)
|
||||
*valueP = [NSNumber numberWithChar:
|
||||
[*valueP intValue]];
|
||||
else if ([_valueType isEqualToString: @"C"] == YES)
|
||||
*valueP = [NSNumber numberWithUnsignedChar:
|
||||
[*valueP unsignedIntValue]];
|
||||
else if ([_valueType isEqualToString: @"s"] == YES)
|
||||
*valueP = [NSNumber numberWithShort:
|
||||
[*valueP shortValue]];
|
||||
else if ([_valueType isEqualToString: @"S"] == YES)
|
||||
*valueP = [NSNumber numberWithUnsignedShort:
|
||||
[*valueP unsignedShortValue]];
|
||||
else if ([_valueType isEqualToString: @"l"] == YES)
|
||||
*valueP = [NSNumber numberWithLong:
|
||||
[*valueP longValue]];
|
||||
else if ([_valueType isEqualToString: @"L"] == YES)
|
||||
*valueP = [NSNumber numberWithUnsignedLong:
|
||||
[*valueP unsignedLongValue]];
|
||||
else if ([_valueType isEqualToString: @"u"] == YES)
|
||||
*valueP = [NSNumber numberWithLongLong:
|
||||
[*valueP longLongValue]];
|
||||
else if ([_valueType isEqualToString: @"U"] == YES)
|
||||
*valueP = [NSNumber numberWithUnsignedLongLong:
|
||||
[*valueP unsignedLongLongValue]];
|
||||
else if ([_valueType isEqualToString: @"f"] == YES)
|
||||
*valueP = [NSNumber numberWithFloat:
|
||||
[*valueP floatValue]];
|
||||
else
|
||||
*valueP = [NSNumber numberWithDouble:
|
||||
[*valueP doubleValue]];
|
||||
break;
|
||||
case 's':
|
||||
*valueP = [NSNumber numberWithShort:
|
||||
[*valueP shortValue]];
|
||||
break;
|
||||
case 'S':
|
||||
*valueP = [NSNumber numberWithUnsignedShort:
|
||||
[*valueP unsignedShortValue]];
|
||||
break;
|
||||
case 'l':
|
||||
*valueP = [NSNumber numberWithLong:
|
||||
[*valueP longValue]];
|
||||
break;
|
||||
case 'L':
|
||||
*valueP = [NSNumber numberWithUnsignedLong:
|
||||
[*valueP unsignedLongValue]];
|
||||
break;
|
||||
case 'u':
|
||||
*valueP = [NSNumber numberWithLongLong:
|
||||
[*valueP longLongValue]];
|
||||
break;
|
||||
case 'U':
|
||||
*valueP = [NSNumber numberWithUnsignedLongLong:
|
||||
[*valueP unsignedLongLongValue]];
|
||||
break;
|
||||
case 'f':
|
||||
*valueP = [NSNumber numberWithFloat:
|
||||
[*valueP floatValue]];
|
||||
break;
|
||||
default:
|
||||
*valueP = [NSNumber numberWithDouble:
|
||||
[*valueP doubleValue]];
|
||||
break;
|
||||
};
|
||||
}
|
||||
else if (valueClass == GDL2NSDecimalNumberClass)
|
||||
*valueP = [NSDecimalNumber
|
||||
|
|
|
@ -351,12 +351,13 @@ static Class _contextClass = Nil;
|
|||
|
||||
if (model && editingContext)
|
||||
{
|
||||
IMP enumNO=NULL; // nextObject
|
||||
edObjectStore = (EOObjectStoreCoordinator *)[editingContext rootObjectStore];
|
||||
cooperatingObjectStores = [edObjectStore cooperatingObjectStores]; // get all EODatabaseContexts
|
||||
|
||||
storeEnum = [cooperatingObjectStores objectEnumerator];
|
||||
|
||||
while ((coObjectStore = [storeEnum nextObject]))
|
||||
while ((coObjectStore = GDL2NextObjectWithImpPtr(storeEnum,&enumNO)))
|
||||
{
|
||||
if ([coObjectStore isKindOfClass: [EODatabaseContext class]])
|
||||
{
|
||||
|
@ -488,13 +489,14 @@ static Class _contextClass = Nil;
|
|||
{
|
||||
NSEnumerator *channelsEnum;
|
||||
NSValue *channel = nil;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
channelsEnum = [_registeredChannels objectEnumerator];
|
||||
|
||||
NSDebugMLLog(@"EODatabaseContext",@"REGISTERED CHANNELS nb=%d",
|
||||
[_registeredChannels count]);
|
||||
|
||||
while ((channel = [channelsEnum nextObject]))
|
||||
while ((channel = GDL2NextObjectWithImpPtr(channelsEnum,&enumNO)))
|
||||
{
|
||||
if ([(EODatabaseChannel *)[channel nonretainedObjectValue]
|
||||
isFetchInProgress] == NO)
|
||||
|
@ -599,6 +601,7 @@ May raise an exception if transaction has began or if you want pessimistic lock
|
|||
{
|
||||
NSEnumerator *channelsEnum = [_registeredChannels objectEnumerator];
|
||||
EODatabaseChannel *channel = nil;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
_delegate = delegate;
|
||||
|
||||
|
@ -625,7 +628,7 @@ May raise an exception if transaction has began or if you want pessimistic lock
|
|||
_delegateRespondsTo.shouldFetchArrayFault =
|
||||
[delegate respondsToSelector: @selector(databaseContext:shouldFetchArrayFault:)];
|
||||
|
||||
while ((channel = [channelsEnum nextObject]))
|
||||
while ((channel = GDL2NextObjectWithImpPtr(channelsEnum,&enumNO)))
|
||||
[channel setDelegate: delegate];
|
||||
}
|
||||
|
||||
|
@ -1271,6 +1274,7 @@ userInfo = {
|
|||
if ([objsArray count] > 0)
|
||||
{
|
||||
IMP globalIDForObjectIMP=NULL;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
qualArray = [NSMutableArray arrayWithCapacity: 5];
|
||||
|
||||
|
@ -1280,8 +1284,8 @@ userInfo = {
|
|||
@"relationship %@ isFlattened", relationship);
|
||||
|
||||
relEnum = [[relationship componentRelationships] objectEnumerator];
|
||||
|
||||
while ((relationship = [relEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((relationship = GDL2NextObjectWithImpPtr(relEnum,&enumNO)))
|
||||
{
|
||||
// TODO rebuild object array for relationship path
|
||||
|
||||
|
@ -1292,7 +1296,8 @@ userInfo = {
|
|||
}
|
||||
|
||||
objEnum = [objsArray objectEnumerator];
|
||||
while ((obj = [objEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((obj = GDL2NextObjectWithImpPtr(objEnum,&enumNO)))
|
||||
{
|
||||
EOGlobalID* gid=nil;
|
||||
relObj = [obj storedValueForKey: [relationship name]];
|
||||
|
@ -1350,6 +1355,7 @@ userInfo = {
|
|||
|
||||
if (!array)
|
||||
{
|
||||
IMP enumNO=NULL; // nextObject
|
||||
array = [NSMutableArray arrayWithCapacity: 8];
|
||||
|
||||
entityName = [fetch entityName];//OK
|
||||
|
@ -1935,9 +1941,10 @@ userInfo = {
|
|||
|
||||
relationshipKeyPathEnum = [[fetch prefetchingRelationshipKeyPaths]
|
||||
objectEnumerator];
|
||||
|
||||
while ((relationshipKeyPath = [relationshipKeyPathEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((relationshipKeyPath = GDL2NextObjectWithImpPtr(relationshipKeyPathEnum,&enumNO)))
|
||||
{
|
||||
IMP rkeyEnumNO=NULL; // nextObject
|
||||
NSArray *relationshipKeyArray = [relationshipKeyPath
|
||||
componentsSeparatedByString: @"."];
|
||||
NSEnumerator *relationshipKeyEnum;
|
||||
|
@ -1946,7 +1953,7 @@ userInfo = {
|
|||
NSString *relationshipKey;
|
||||
|
||||
relationshipKeyEnum = [relationshipKeyArray objectEnumerator];
|
||||
while ((relationshipKey = [relationshipKeyEnum nextObject]))
|
||||
while ((relationshipKey = GDL2NextObjectWithImpPtr(relationshipKeyEnum,&rkeyEnumNO)))
|
||||
{
|
||||
relationship = [currentEntity relationshipNamed: relationshipKey];
|
||||
currentEntity = [relationship destinationEntity];
|
||||
|
@ -1997,6 +2004,7 @@ userInfo = {
|
|||
|
||||
if ([self isObjectLockedWithGlobalID: gid] == NO)
|
||||
{
|
||||
IMP enumNO=NULL; // nextObject
|
||||
snapshot = EODatabaseContext_snapshotForGlobalIDWithImpPtr(self,NULL,gid);
|
||||
|
||||
if (_delegateRespondsTo.shouldLockObject == YES &&
|
||||
|
@ -2031,7 +2039,8 @@ userInfo = {
|
|||
lockAttributes = [NSMutableArray arrayWithCapacity: 8];
|
||||
|
||||
attrsEnum = [primaryKeyAttributes objectEnumerator];
|
||||
while ((attribute = [attrsEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((attribute = GDL2NextObjectWithImpPtr(attrsEnum,&enumNO)))
|
||||
{
|
||||
NSString *name = [attribute name];
|
||||
|
||||
|
@ -2040,7 +2049,8 @@ userInfo = {
|
|||
}
|
||||
|
||||
attrsEnum = [attrsUsedForLocking objectEnumerator];
|
||||
while ((attribute = [attrsEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((attribute = GDL2NextObjectWithImpPtr(attrsEnum,&enumNO)))
|
||||
{
|
||||
NSString *name = [attribute name];
|
||||
|
||||
|
@ -2130,10 +2140,11 @@ userInfo = {
|
|||
|
||||
if (_delegateRespondsTo.shouldInvalidateObject == YES)
|
||||
{
|
||||
IMP enumNO=NULL; // nextObject
|
||||
array = [NSMutableArray array];
|
||||
enumerator = [globalIDs objectEnumerator];
|
||||
|
||||
while ((gid = [enumerator nextObject]))
|
||||
while ((gid = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
if ([_delegate databaseContext: self
|
||||
shouldInvalidateObjectWithGlobalID: gid
|
||||
|
@ -2410,6 +2421,7 @@ forDatabaseOperation:(EODatabaseOperation *)op
|
|||
|
||||
- (void)recordChangesInEditingContext
|
||||
{
|
||||
IMP selfGIDFO=NULL; // _globalIDForObject:
|
||||
int which = 0;
|
||||
NSArray *objects[3] = {nil, nil, nil};
|
||||
|
||||
|
@ -2756,7 +2768,7 @@ forDatabaseOperation:(EODatabaseOperation *)op
|
|||
iValue++)
|
||||
{
|
||||
id aValue = GDL2ObjectAtIndexWithImp(relationshipSnapshotValue,svObjectAtIndexIMP,iValue);
|
||||
EOGlobalID *aValueGID = [self _globalIDForObject: aValue];
|
||||
EOGlobalID *aValueGID = EODatabaseContext_globalIDForObjectWithImpPtr(self,&selfGIDFO,aValue);
|
||||
|
||||
NSDebugMLLog(@"EODatabaseContext",
|
||||
@"YYYY valuesGIDs=%@",
|
||||
|
@ -4158,7 +4170,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
NSDebugMLLog(@"EODatabaseContext", @"dictionary=%@ ",
|
||||
[object debugDictionaryDescription]);
|
||||
|
||||
gid = [self _globalIDForObject: object]; //OK
|
||||
gid = EODatabaseContext_globalIDForObjectWithImpPtr(self,NULL,object);
|
||||
NSDebugMLLog(@"EODatabaseContext", @"gid=%@", gid);
|
||||
|
||||
databaseOpe = [self databaseOperationForGlobalID: gid]; //OK
|
||||
|
@ -5398,6 +5410,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
NSDictionary *dbSnapshot = nil;
|
||||
NSEnumerator *attrNameEnum = nil;
|
||||
id attrName = nil;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -5411,8 +5424,8 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
dbSnapshot, dbSnapshot);
|
||||
|
||||
attrNameEnum = [newRow keyEnumerator];
|
||||
|
||||
while ((attrName = [attrNameEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((attrName = GDL2NextObjectWithImpPtr(attrNameEnum,&enumNO)))
|
||||
{
|
||||
EOAttribute *attribute = [entity attributeNamed: attrName];
|
||||
id newRowValue = nil;
|
||||
|
@ -5541,30 +5554,34 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
NSString* relationshipName = nil;
|
||||
IMP globalIDForObjectIMP=NULL;
|
||||
IMP toManySnapArrayObjectAtIndexIMP=NULL;
|
||||
IMP objsEnumNO=NULL;
|
||||
IMP objectsOAI=NULL;
|
||||
|
||||
qualifierArray = [NSMutableArray array];
|
||||
valuesArray = [NSMutableArray array];
|
||||
toManySnapshotArray = [NSMutableArray array];
|
||||
qualifierArray = GDL2MutableArray();
|
||||
valuesArray = GDL2MutableArray();
|
||||
toManySnapshotArray = GDL2MutableArray();
|
||||
toManySnapArrayObjectAtIndexIMP=[toManySnapshotArray methodForSelector: GDL2_objectAtIndexSEL];
|
||||
relationshipName = [relationship name];
|
||||
|
||||
objsEnum = [objects objectEnumerator];
|
||||
while ((object = [objsEnum nextObject]))
|
||||
objsEnumNO=NULL;
|
||||
while ((object = GDL2NextObjectWithImpPtr(objsEnum,&objsEnumNO)))
|
||||
{
|
||||
values = [NSMutableDictionary dictionaryWithCapacity: 4];
|
||||
IMP joinsEnumNO=NO;
|
||||
values = GDL2MutableDictionaryWithCapacity(4);
|
||||
|
||||
fault = [object valueForKey: relationshipName];
|
||||
[EOFault clearFault: fault];
|
||||
|
||||
joinsEnum = [[relationship joins] objectEnumerator];
|
||||
while ((join = [joinsEnum nextObject]))
|
||||
while ((join = GDL2NextObjectWithImpPtr(joinsEnum,&joinsEnumNO)))
|
||||
{
|
||||
[values setObject: [object valueForKey: [[join sourceAttribute] name]]
|
||||
forKey: [[join destinationAttribute] name]];
|
||||
}
|
||||
|
||||
[valuesArray addObject: values];
|
||||
[toManySnapshotArray addObject: [NSMutableArray array]];
|
||||
[toManySnapshotArray addObject: GDL2MutableArray()];
|
||||
|
||||
[qualifierArray addObject: [EOQualifier qualifierToMatchAllValues:
|
||||
values]];
|
||||
|
@ -5590,18 +5607,22 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
IMP oaiIMP=[valuesArray methodForSelector: GDL2_objectAtIndexSEL];
|
||||
|
||||
objsEnum = [array objectEnumerator];
|
||||
while ((object = [objsEnum nextObject]))
|
||||
objsEnumNO=NULL;
|
||||
while ((object = GDL2NextObjectWithImpPtr(objsEnum,&objsEnumNO)))
|
||||
{
|
||||
IMP objectVFK=NULL; // valueForKey:
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
IMP keyEnumNO=NULL; // nextObject
|
||||
IMP valuesOFK=NULL; // objectForKey:
|
||||
equal = YES;
|
||||
values = GDL2ObjectAtIndexWithImp(valuesArray,oaiIMP,i);
|
||||
|
||||
keyEnum = [values keyEnumerator];
|
||||
while ((key = [keyEnum nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(keyEnum,&keyEnumNO)))
|
||||
{
|
||||
if ([[object valueForKey: key]
|
||||
isEqual: [values objectForKey:key]] == NO)
|
||||
if ([GDL2ValueForKeyWithImpPtr(object,&objectVFK,key)
|
||||
isEqual: GDL2ObjectForKeyWithImpPtr(values,&valuesOFK,key)] == NO)
|
||||
{
|
||||
equal = NO;
|
||||
break;
|
||||
|
@ -5613,7 +5634,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
EOGlobalID* gid = nil;
|
||||
id snapshot = GDL2ObjectAtIndexWithImp(toManySnapshotArray,toManySnapArrayObjectAtIndexIMP,i);
|
||||
|
||||
[[[objects objectAtIndex: i] valueForKey: relationshipName]
|
||||
[[GDL2ObjectAtIndexWithImpPtr(objects,&objectsOAI,i) valueForKey: relationshipName]
|
||||
addObject: object];
|
||||
|
||||
gid=EOEditingContext_globalIDForObjectWithImpPtr(editingContext,&globalIDForObjectIMP,object);
|
||||
|
@ -5635,7 +5656,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
id snapshot = GDL2ObjectAtIndexWithImp(toManySnapshotArray,toManySnapArrayObjectAtIndexIMP,i);
|
||||
EOGlobalID* gid=EOEditingContext_globalIDForObjectWithImpPtr(editingContext,
|
||||
&globalIDForObjectIMP,
|
||||
[objects objectAtIndex: i]);
|
||||
GDL2ObjectAtIndexWithImpPtr(objects,&objectsOAI,i));
|
||||
[_database recordSnapshot: snapshot
|
||||
forSourceGlobalID: gid
|
||||
relationshipName: relationshipName];
|
||||
|
@ -6914,7 +6935,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
{
|
||||
|
||||
BOOL isPKValid = NO;
|
||||
EOGlobalID *gid = [self _globalIDForObject: object]; //OK
|
||||
EOGlobalID *gid = EODatabaseContext_globalIDForObjectWithImpPtr(self,NULL,object);
|
||||
NSDebugMLLog(@"EODatabaseContext", @"gid=%@", gid);
|
||||
|
||||
|
||||
|
@ -6934,11 +6955,12 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
{
|
||||
//merge pk2 into pk
|
||||
NSEnumerator *pk2Enum = [pk2 keyEnumerator];
|
||||
IMP pk2EnumNO=NULL; // nextObject
|
||||
NSMutableDictionary *realPK
|
||||
= [NSMutableDictionary dictionaryWithDictionary: pk];//revoir
|
||||
id key = nil;
|
||||
|
||||
while ((key = [pk2Enum nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(pk2Enum,&pk2EnumNO)))
|
||||
{
|
||||
[realPK setObject: [pk2 objectForKey: key]
|
||||
forKey: key];
|
||||
|
@ -7395,3 +7417,27 @@ NSDictionary* EODatabaseContext_snapshotForGlobalIDWithImpPtr(EODatabaseContext*
|
|||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
EOGlobalID* EODatabaseContext_globalIDForObjectWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,id object)
|
||||
{
|
||||
if (dbContext)
|
||||
{
|
||||
IMP imp=NULL;
|
||||
if (impPtr)
|
||||
imp=*impPtr;
|
||||
if (!imp)
|
||||
{
|
||||
if (GSObjCClass(dbContext)==GDL2EODatabaseContextClass
|
||||
&& GDL2EODatabaseContext__globalIDForObjectIMP)
|
||||
imp=GDL2EODatabaseContext__globalIDForObjectIMP;
|
||||
else
|
||||
imp=[dbContext methodForSelector:GDL2__globalIDForObjectSEL];
|
||||
if (impPtr)
|
||||
*impPtr=imp;
|
||||
}
|
||||
return (*imp)(dbContext,GDL2__globalIDForObjectSEL,object);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,5 +74,6 @@
|
|||
@end
|
||||
|
||||
GDL2ACCESS_EXPORT NSDictionary* EODatabaseContext_snapshotForGlobalIDWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,EOGlobalID* gid);
|
||||
GDL2ACCESS_EXPORT EOGlobalID* EODatabaseContext_globalIDForObjectWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,id object);
|
||||
|
||||
#endif /* __EODatabaseContextPriv_h__ */
|
||||
|
|
|
@ -1171,9 +1171,10 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
//VERIFY
|
||||
if (!attr)
|
||||
{
|
||||
IMP enumNO=NULL;
|
||||
attrEnum = [[self primaryKeyAttributes] objectEnumerator];
|
||||
|
||||
while ((attr = [attrEnum nextObject]))
|
||||
while ((attr = GDL2NextObjectWithImpPtr(attrEnum,&enumNO)))
|
||||
{
|
||||
if ([[attr name] isEqual: attributeName])
|
||||
return attr;
|
||||
|
@ -1366,10 +1367,11 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
if (!rel)
|
||||
{
|
||||
EORelationship *tmpRel = nil;
|
||||
IMP enumNO=NULL;
|
||||
|
||||
relEnum = [_hiddenRelationships objectEnumerator];
|
||||
|
||||
while (!rel && (tmpRel = [relEnum nextObject]))
|
||||
while (!rel && (tmpRel = GDL2NextObjectWithImpPtr(relEnum,&enumNO)))
|
||||
{
|
||||
if ([[tmpRel name] isEqual: relationshipNamed])
|
||||
rel = tmpRel;
|
||||
|
@ -1646,18 +1648,22 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
else
|
||||
{
|
||||
//Seems OK
|
||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity: count];
|
||||
NSMutableArray *array = GDL2MutableArrayWithCapacity(count);
|
||||
IMP pkanOAI=NULL;
|
||||
IMP rowOFK=NULL;
|
||||
IMP arrayAO=NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSString *key = [primaryKeyAttributeNames objectAtIndex: i];
|
||||
id value = [row objectForKey: key];
|
||||
NSString *key = GDL2ObjectAtIndexWithImpPtr(primaryKeyAttributeNames,&pkanOAI,i);
|
||||
id value = GDL2ObjectForKeyWithImpPtr(row,&rowOFK,key);
|
||||
|
||||
[array addObject: [EOKeyValueQualifier qualifierWithKey: key
|
||||
operatorSelector:
|
||||
EOQualifierOperatorEqual
|
||||
value: value]];
|
||||
GDL2AddObjectWithImpPtr(array,&arrayAO,
|
||||
[EOKeyValueQualifier qualifierWithKey: key
|
||||
operatorSelector:
|
||||
EOQualifierOperatorEqual
|
||||
value: value]);
|
||||
}
|
||||
|
||||
qualifier = [EOAndQualifier qualifierWithQualifierArray: array];
|
||||
|
@ -1693,20 +1699,23 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
NSMutableDictionary *dict = nil;
|
||||
int i, count;
|
||||
NSArray *primaryKeyAttributes = [self primaryKeyAttributes];
|
||||
IMP pkaOAI=NULL;
|
||||
IMP rowOFK=NULL;
|
||||
IMP dictSOFK=NULL;
|
||||
|
||||
count = [primaryKeyAttributes count];
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOAttribute *attr = [primaryKeyAttributes objectAtIndex: i];
|
||||
id value = [row objectForKey: [attr name]];
|
||||
EOAttribute *attr = GDL2ObjectAtIndexWithImpPtr(primaryKeyAttributes,&pkaOAI,i);
|
||||
NSString* attrName = [attr name];
|
||||
id value = GDL2ObjectForKeyWithImpPtr(row,&rowOFK,attrName);
|
||||
|
||||
if (!value)
|
||||
value = GDL2EONull;
|
||||
|
||||
[dict setObject: value
|
||||
forKey: [attr name]];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,value,attrName);
|
||||
}
|
||||
|
||||
return dict;
|
||||
|
@ -1714,7 +1723,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
|
||||
- (BOOL)isValidAttributeUsedForLocking: (EOAttribute *)anAttribute
|
||||
{
|
||||
if (!([anAttribute isKindOfClass: [EOAttribute class]]
|
||||
if (!([anAttribute isKindOfClass: GDL2EOAttributeClass]
|
||||
&& [[self attributesByName] objectForKey: [anAttribute name]]))
|
||||
return NO;
|
||||
|
||||
|
@ -1726,7 +1735,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
|
||||
- (BOOL)isValidPrimaryKeyAttribute: (EOAttribute *)anAttribute
|
||||
{
|
||||
if (!([anAttribute isKindOfClass: [EOAttribute class]]
|
||||
if (!([anAttribute isKindOfClass: GDL2EOAttributeClass]
|
||||
&& [[self attributesByName] objectForKey: [anAttribute name]]))
|
||||
return NO;
|
||||
|
||||
|
@ -1743,18 +1752,20 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
id value = nil;
|
||||
int i, count;
|
||||
BOOL isValid = YES;
|
||||
IMP pkanOAI=NULL;
|
||||
IMP objectVFK=NULL;
|
||||
|
||||
primaryKeyAttributeNames = [self primaryKeyAttributeNames];
|
||||
count = [primaryKeyAttributeNames count];
|
||||
|
||||
for (i = 0; isValid && i < count; i++)
|
||||
{
|
||||
key = [primaryKeyAttributeNames objectAtIndex: i];
|
||||
key = GDL2ObjectAtIndexWithImpPtr(primaryKeyAttributeNames,&pkanOAI,i);
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
value = [object valueForKey: key];
|
||||
if (value == nil || value == GDL2EONull || value == [NSNull null])
|
||||
value = GDL2ValueForKeyWithImpPtr(object,&objectVFK,key);
|
||||
if (_isNilOrEONull(value))
|
||||
isValid = NO;
|
||||
}
|
||||
NS_HANDLER
|
||||
|
@ -1771,7 +1782,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
{
|
||||
id thePropertyName;
|
||||
|
||||
if (!([aProperty isKindOfClass: [EOAttribute class]]
|
||||
if (!([aProperty isKindOfClass: GDL2EOAttributeClass]
|
||||
|| [aProperty isKindOfClass: [EORelationship class]]))
|
||||
return NO;
|
||||
|
||||
|
@ -1849,6 +1860,8 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
|
||||
if (gidkeyValues)
|
||||
{
|
||||
IMP pkanOAI=NULL;
|
||||
IMP dfpkSOFK=NULL;
|
||||
dictionaryForPrimaryKey = [self _dictionaryForPrimaryKey];
|
||||
|
||||
NSAssert1(dictionaryForPrimaryKey,
|
||||
|
@ -1859,10 +1872,10 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
id key = [primaryKeyAttributeNames objectAtIndex: i];
|
||||
id key = GDL2ObjectAtIndexWithImpPtr(primaryKeyAttributeNames,&pkanOAI,i);
|
||||
|
||||
[dictionaryForPrimaryKey setObject: gidkeyValues[i]
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dictionaryForPrimaryKey,&dfpkSOFK,
|
||||
gidkeyValues[i],key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2287,16 +2300,19 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
NSEnumerator *enumerator;
|
||||
EORelationship *rel;
|
||||
EOAttribute *attr;
|
||||
IMP enumNO=NULL;
|
||||
|
||||
enumerator = [[self attributes] objectEnumerator];
|
||||
while ((attr = [enumerator nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((attr = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
if ([attr isFlattened] && [[attr realAttribute] isEqual: property])
|
||||
return YES;
|
||||
}
|
||||
|
||||
enumerator = [[self relationships] objectEnumerator];
|
||||
while ((rel = [enumerator nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((rel = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
if ([rel referencesProperty: property])
|
||||
return YES;
|
||||
|
@ -2612,13 +2628,19 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
{
|
||||
NSArray *array = [self attributesUsedForLocking];
|
||||
int i, n = [array count];
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity: n];
|
||||
NSMutableDictionary *dict = GDL2MutableDictionaryWithCapacity(n);
|
||||
IMP arrayOAI=NULL;
|
||||
IMP dictSOFK=NULL;
|
||||
IMP aRowOFK=NULL;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
id key = [(EOAttribute *)[array objectAtIndex: i] name];
|
||||
id key = [(EOAttribute *)GDL2ObjectAtIndexWithImpPtr(array,&arrayOAI,i)
|
||||
name];
|
||||
|
||||
[dict setObject: [aRow objectForKey:key] forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,
|
||||
GDL2ObjectForKeyWithImpPtr(aRow,&aRowOFK,key),
|
||||
key);
|
||||
}
|
||||
|
||||
return dict;
|
||||
|
@ -2676,18 +2698,23 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
{
|
||||
id keyArray[count];
|
||||
int i;
|
||||
IMP rowOFK=NULL;
|
||||
IMP pkanOAI=NULL;
|
||||
|
||||
memset(keyArray, 0, sizeof(id) * count);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
keyArray[i] = [row objectForKey:
|
||||
[primaryKeyAttributeNames objectAtIndex: i]];
|
||||
{
|
||||
keyArray[i] = GDL2ObjectForKeyWithImpPtr(row,&rowOFK,
|
||||
GDL2ObjectAtIndexWithImpPtr(primaryKeyAttributeNames,
|
||||
&pkanOAI,i));
|
||||
|
||||
globalID = [EOKeyGlobalID globalIDWithEntityName: [self name]
|
||||
keys: keyArray
|
||||
keyCount: count
|
||||
zone: [self zone]];
|
||||
}
|
||||
globalID = [EOKeyGlobalID globalIDWithEntityName: [self name]
|
||||
keys: keyArray
|
||||
keyCount: count
|
||||
zone: [self zone]];
|
||||
}
|
||||
};
|
||||
|
||||
//NSEmitTODO(); //TODO
|
||||
//TODO isFinal ??
|
||||
|
@ -2905,12 +2932,15 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
- (NSArray*) writableDBSnapshotKeys
|
||||
{
|
||||
//OK
|
||||
NSMutableArray *writableDBSnapshotKeys = [NSMutableArray array];
|
||||
NSArray *writableDBSnapshotKeys=nil;
|
||||
|
||||
if (![self isReadOnly])
|
||||
{
|
||||
NSArray *attributesToFetch = [self _attributesToFetch];
|
||||
int i, count = [attributesToFetch count];
|
||||
IMP atfOAI=NULL;
|
||||
IMP sAO=NULL;
|
||||
NSMutableArray* tmpArray=GDL2MutableArrayWithCapacity(count);
|
||||
|
||||
NSAssert3(!attributesToFetch
|
||||
|| [attributesToFetch isKindOfClass: [NSArray class]],
|
||||
|
@ -2921,12 +2951,15 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOAttribute *attribute = [attributesToFetch objectAtIndex: i];
|
||||
EOAttribute *attribute = GDL2ObjectAtIndexWithImpPtr(attributesToFetch,&atfOAI,i);
|
||||
|
||||
if (![attribute isReadOnly])
|
||||
[writableDBSnapshotKeys addObject: [attribute name]];
|
||||
GDL2AddObjectWithImpPtr(tmpArray,&sAO,[attribute name]);
|
||||
}
|
||||
writableDBSnapshotKeys=tmpArray;
|
||||
}
|
||||
else
|
||||
writableDBSnapshotKeys=GDL2Array();
|
||||
|
||||
return writableDBSnapshotKeys;
|
||||
}
|
||||
|
@ -2934,16 +2967,28 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
- (NSArray*) rootAttributesUsedForLocking
|
||||
{
|
||||
//OK ?
|
||||
NSMutableArray *rootAttributesUsedForLocking = [NSMutableArray array];
|
||||
NSArray *rootAttributesUsedForLocking = nil;
|
||||
NSArray *attributesUsedForLocking = [self attributesUsedForLocking];
|
||||
int i, count = [attributesUsedForLocking count];
|
||||
int count = [attributesUsedForLocking count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
EOAttribute *attribute = [attributesUsedForLocking objectAtIndex: i];
|
||||
if (![attribute isDerived])
|
||||
[rootAttributesUsedForLocking addObject: attribute];
|
||||
int i=0;
|
||||
NSMutableArray *tmpArray = GDL2MutableArrayWithCapacity(count);
|
||||
IMP auflOAI=NULL;
|
||||
IMP tAO=NULL;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOAttribute *attribute = GDL2ObjectAtIndexWithImpPtr(attributesUsedForLocking,
|
||||
&auflOAI,i);
|
||||
if (![attribute isDerived])
|
||||
GDL2AddObjectWithImpPtr(tmpArray,&tAO,attribute);
|
||||
}
|
||||
rootAttributesUsedForLocking=tmpArray;
|
||||
}
|
||||
else
|
||||
rootAttributesUsedForLocking=GDL2Array();
|
||||
|
||||
return rootAttributesUsedForLocking;
|
||||
}
|
||||
|
@ -3206,18 +3251,30 @@ returns nil if there's no key in the instanceDictionaryInitializer
|
|||
{
|
||||
//OK
|
||||
//IMPROVE We can improve this by caching the result....
|
||||
NSMutableArray *classPropertyAttributes = [NSMutableArray array];
|
||||
|
||||
NSArray *classPropertyAttributes = nil;
|
||||
//Get classProperties (EOAttributes + EORelationships)
|
||||
NSArray *classProperties = [self classProperties];
|
||||
int i, count = [classProperties count];
|
||||
int count = [classProperties count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
id object = [classProperties objectAtIndex: i];
|
||||
int i=0;
|
||||
NSMutableArray *tmpArray = GDL2MutableArrayWithCapacity(count);
|
||||
IMP cpOAI=NULL;
|
||||
IMP tAO=NULL;
|
||||
|
||||
if ([object isKindOfClass: [EOAttribute class]])
|
||||
[classPropertyAttributes addObject: object];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
id object = GDL2ObjectAtIndexWithImpPtr(classProperties,&cpOAI,i);
|
||||
|
||||
if ([object isKindOfClass: GDL2EOAttributeClass])
|
||||
GDL2AddObjectWithImpPtr(tmpArray,&tAO,object);
|
||||
}
|
||||
classPropertyAttributes = tmpArray;
|
||||
}
|
||||
else
|
||||
classPropertyAttributes=GDL2Array();
|
||||
|
||||
return classPropertyAttributes;
|
||||
}
|
||||
|
@ -3231,9 +3288,9 @@ returns nil if there's no key in the instanceDictionaryInitializer
|
|||
|
||||
if (!_attributesToSave)
|
||||
{
|
||||
NSMutableArray *attributesToSave = [GCMutableArray array];
|
||||
NSArray *attributesToFetch = [self _attributesToFetch];
|
||||
int i, count = [attributesToFetch count];
|
||||
NSMutableArray *attributesToSave = [GCMutableArray arrayWithCapacity:count];
|
||||
|
||||
NSAssert3(!attributesToFetch
|
||||
|| [attributesToFetch isKindOfClass: [NSArray class]],
|
||||
|
@ -3315,7 +3372,7 @@ returns nil if there's no key in the instanceDictionaryInitializer
|
|||
@"propertyName=%@ - property=%@",
|
||||
propertyName, property);
|
||||
|
||||
if ([property isKindOfClass: [EOAttribute class]])
|
||||
if ([property isKindOfClass: GDL2EOAttributeClass])
|
||||
{
|
||||
EOAttribute *attribute = property;
|
||||
|
||||
|
@ -3333,7 +3390,7 @@ returns nil if there's no key in the instanceDictionaryInitializer
|
|||
[(EORelationship*)property relationshipPath]
|
||||
atts: attributesDict];
|
||||
}
|
||||
else if ([property isKindOfClass: [EOAttribute class]])
|
||||
else if ([property isKindOfClass: GDL2EOAttributeClass])
|
||||
{
|
||||
[attributesDict setObject: property
|
||||
forKey: propertyName];
|
||||
|
@ -3570,24 +3627,35 @@ returns nil if there's no key in the instanceDictionaryInitializer
|
|||
NSMutableArray *sourceAttributeNames = [NSMutableArray array];
|
||||
NSMutableArray *destinationAttributeNames = [NSMutableArray array];
|
||||
NSArray *joins;
|
||||
int i, count = 0;
|
||||
int count = 0;
|
||||
|
||||
//use path,not only one element ?
|
||||
rel = [self relationshipNamed: path];
|
||||
joins = [rel joins];
|
||||
count = [joins count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
EOJoin *join = [joins objectAtIndex: i];
|
||||
EOAttribute *sourceAttribute = [join sourceAttribute];
|
||||
EOAttribute *destinationAttribute =
|
||||
[self _mapAttribute:sourceAttribute
|
||||
toDestinationAttributeInLastComponentOfRelationshipPath: path];
|
||||
int i=0;
|
||||
IMP joinsOAI=NULL;
|
||||
IMP sanAO=NULL;
|
||||
IMP danAO=NULL;
|
||||
|
||||
[sourceAttributeNames addObject: [sourceAttribute name]];
|
||||
[destinationAttributeNames addObject: [destinationAttribute name]];
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOJoin *join = GDL2ObjectAtIndexWithImpPtr(joins,&joinsOAI,i);
|
||||
EOAttribute *sourceAttribute = [join sourceAttribute];
|
||||
EOAttribute *destinationAttribute =
|
||||
[self _mapAttribute:sourceAttribute
|
||||
toDestinationAttributeInLastComponentOfRelationshipPath: path];
|
||||
|
||||
GDL2AddObjectWithImpPtr(sourceAttributeNames,&sanAO,
|
||||
[sourceAttribute name]);
|
||||
|
||||
GDL2AddObjectWithImpPtr(destinationAttributeNames,&danAO,
|
||||
[destinationAttribute name]);
|
||||
}
|
||||
};
|
||||
|
||||
keyMap = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
sourceAttributeNames, @"sourceKeys",
|
||||
|
@ -3666,17 +3734,25 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
if (relationship)
|
||||
{
|
||||
NSArray *joins = [relationship joins];
|
||||
int i, count = [joins count];
|
||||
int count = [joins count];
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
EOJoin *join = [joins objectAtIndex: i];
|
||||
EOAttribute *sourceAttribute = [join sourceAttribute];
|
||||
EOAttribute *destinationAttribute = [join destinationAttribute];
|
||||
|
||||
[sourceKeys addObject: [sourceAttribute name]];
|
||||
[destinationKeys addObject: [destinationAttribute name]];
|
||||
}
|
||||
int i=0;
|
||||
IMP joinsOAI=NULL;
|
||||
IMP skAO=NULL;
|
||||
IMP dkAO=NULL;
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
EOJoin *join = GDL2ObjectAtIndexWithImpPtr(joins,&joinsOAI,i);
|
||||
EOAttribute *sourceAttribute = [join sourceAttribute];
|
||||
EOAttribute *destinationAttribute = [join destinationAttribute];
|
||||
|
||||
GDL2AddObjectWithImpPtr(sourceKeys,&skAO,[sourceAttribute name]);
|
||||
GDL2AddObjectWithImpPtr(destinationKeys,&dkAO,[destinationAttribute name]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
|
@ -3744,20 +3820,20 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
//Should be OK
|
||||
if (!_classPropertyAttributeNames)
|
||||
{
|
||||
int i=0;
|
||||
NSArray *classProperties = [self classProperties];
|
||||
int i, count = [classProperties count];
|
||||
Class attrClass = [EOAttribute class];
|
||||
int count = [classProperties count];
|
||||
|
||||
_classPropertyAttributeNames = [NSMutableArray new]; //or GC ?
|
||||
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOAttribute *property = [classProperties objectAtIndex: i];
|
||||
|
||||
if ([property isKindOfClass: attrClass])
|
||||
|
||||
if ([property isKindOfClass: GDL2EOAttributeClass])
|
||||
[(NSMutableArray*)_classPropertyAttributeNames
|
||||
addObject: [property name]];
|
||||
}
|
||||
addObject: [property name]];
|
||||
};
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEntity", @"_classPropertyAttributeNames=%@",
|
||||
_classPropertyAttributeNames);
|
||||
|
@ -3841,16 +3917,23 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
else
|
||||
{
|
||||
NSArray *joins = [rel joins];
|
||||
int i, count = [joins count];
|
||||
int count = [joins count];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
EOJoin *join = [joins objectAtIndex: i];
|
||||
EOAttribute *attribute = [join sourceAttribute];
|
||||
int i=0;
|
||||
IMP joinsOAI=NULL;
|
||||
IMP attributesSOFK=NULL;
|
||||
|
||||
[attributes setObject: attribute
|
||||
forKey: [attribute name]];
|
||||
}
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOJoin *join = GDL2ObjectAtIndexWithImpPtr(joins,&joinsOAI,i);
|
||||
EOAttribute *attribute = [join sourceAttribute];
|
||||
|
||||
GDL2SetObjectForKeyWithImpPtr(attributes,&attributesSOFK,
|
||||
attribute,[attribute name]);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3886,9 +3969,9 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
- (NSArray*) flattenedAttributes
|
||||
{
|
||||
//OK
|
||||
NSMutableArray *flattenedAttributes = [NSMutableArray array];
|
||||
NSArray *flattenedAttributes = nil;
|
||||
NSArray *attributesToFetch = [self _attributesToFetch];
|
||||
int i, count = [attributesToFetch count];
|
||||
int count = [attributesToFetch count];
|
||||
|
||||
NSAssert3(!attributesToFetch
|
||||
|| [attributesToFetch isKindOfClass: [NSArray class]],
|
||||
|
@ -3897,13 +3980,24 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
[attributesToFetch class],
|
||||
attributesToFetch);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
EOAttribute *attribute = [attributesToFetch objectAtIndex: i];
|
||||
int i=0;
|
||||
IMP atfOAI=NULL;
|
||||
IMP tAO=NULL;
|
||||
NSMutableArray* tmpArray=GDL2MutableArrayWithCapacity(count);
|
||||
|
||||
if ([attribute isFlattened])
|
||||
[flattenedAttributes addObject: attribute];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOAttribute *attribute = GDL2ObjectAtIndexWithImpPtr(attributesToFetch,&atfOAI,i);
|
||||
|
||||
if ([attribute isFlattened])
|
||||
GDL2AddObjectWithImpPtr(tmpArray,&tAO,attribute);
|
||||
};
|
||||
flattenedAttributes=tmpArray;
|
||||
}
|
||||
else
|
||||
flattenedAttributes=GDL2Array();
|
||||
|
||||
return flattenedAttributes;
|
||||
}
|
||||
|
@ -3932,6 +4026,7 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
|
||||
if (s)
|
||||
{
|
||||
IMP eaAO=NULL;
|
||||
pool = [NSAutoreleasePool new];
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -3956,8 +4051,8 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
&& *s != '.' && *s != '#' && *s != '$')
|
||||
break;
|
||||
|
||||
objectToken = [NSString stringWithCString:start
|
||||
length: (unsigned)(s - start)];
|
||||
objectToken = GDL2StringWithCStringAndLength(start,
|
||||
(unsigned)(s - start));
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEntity", @"objectToken: '%@'",
|
||||
objectToken);
|
||||
|
@ -3973,7 +4068,7 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
EOFLOGObjectLevelArgs(@"EOEntity", @"addObject I Token: '%@'",
|
||||
objectToken);
|
||||
|
||||
[expressionArray addObject: objectToken];
|
||||
GDL2AddObjectWithImpPtr(expressionArray,&eaAO,objectToken);
|
||||
}
|
||||
|
||||
/* Determines an O token. */
|
||||
|
@ -4002,13 +4097,13 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString*)path
|
|||
|
||||
if (s != start)
|
||||
{
|
||||
objectToken = [NSString stringWithCString: start
|
||||
length: (unsigned)(s - start)];
|
||||
objectToken = GDL2StringWithCStringAndLength(start,
|
||||
(unsigned)(s - start));
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEntity", @"addObject O Token: '%@'",
|
||||
objectToken);
|
||||
|
||||
[expressionArray addObject: objectToken];
|
||||
GDL2AddObjectWithImpPtr(expressionArray,&eaAO,objectToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4349,6 +4444,10 @@ fromInsertionInEditingContext: (EOEditingContext *)context
|
|||
NSArray *classProperties;
|
||||
EORelationship *relationship;
|
||||
int i, count;
|
||||
IMP relOAI=NULL;
|
||||
IMP objectSVFK=NULL;
|
||||
IMP objectTSVFK=NULL;
|
||||
IMP objectVFK=NULL;
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -4361,15 +4460,15 @@ fromInsertionInEditingContext: (EOEditingContext *)context
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
relationship = [relationships objectAtIndex: i];
|
||||
relationship = GDL2ObjectAtIndexWithImpPtr(relationships,&relOAI,i);
|
||||
|
||||
if ([classProperties containsObject: relationship])
|
||||
{
|
||||
if ([relationship isToMany])
|
||||
{
|
||||
NSString *name = [relationship name];
|
||||
id relationshipValue
|
||||
= [object storedValueForKey: name];
|
||||
id relationshipValue =
|
||||
GDL2StoredValueForKeyWithImpPtr(object,&objectSVFK,name);
|
||||
|
||||
/* We put a value only if there's not already one */
|
||||
if (relationshipValue == nil)
|
||||
|
@ -4377,8 +4476,9 @@ fromInsertionInEditingContext: (EOEditingContext *)context
|
|||
/* [Ref: Assigns empty arrays to to-many
|
||||
relationship properties of newly inserted
|
||||
enterprise objects] */
|
||||
[object takeStoredValue: [EOCheapCopyMutableArray array]
|
||||
forKey: name];
|
||||
GDL2TakeStoredValueForKeyWithImpPtr(object,&objectTSVFK,
|
||||
[EOCheapCopyMutableArray array],
|
||||
name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4387,7 +4487,7 @@ fromInsertionInEditingContext: (EOEditingContext *)context
|
|||
{
|
||||
NSString *name = [relationship name];
|
||||
id relationshipValue
|
||||
= [object valueForKey: name];
|
||||
= GDL2ValueForKeyWithImpPtr(object,&objectVFK,name);
|
||||
|
||||
if (relationshipValue == nil)
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ RCS_ID("$Id$")
|
|||
|
||||
#include <EOControl/EONSAddOns.h>
|
||||
#include <EOControl/EODebug.h>
|
||||
#include <EOControl/EOPriv.h>
|
||||
|
||||
#include <EOAccess/EOAccess.h>
|
||||
#include <EOAccess/EOAttribute.h>
|
||||
|
@ -243,9 +244,10 @@ static NSString *internalTypeNames[] = {
|
|||
+ (void)assignExternalInfoForEntity: (EOEntity *)entity
|
||||
{
|
||||
NSEnumerator *attributeEnumerator = [[entity attributes] objectEnumerator];
|
||||
EOAttribute *attribute;
|
||||
EOAttribute *attribute = nil;
|
||||
IMP enumNO = NULL;
|
||||
|
||||
while ((attribute = [attributeEnumerator nextObject]))
|
||||
while ((attribute = GDL2NextObjectWithImpPtr(attributeEnumerator,&enumNO)))
|
||||
[self assignExternalInfoForAttribute: attribute];
|
||||
}
|
||||
|
||||
|
|
|
@ -99,30 +99,34 @@ pgResultDictionary(PGresult *pgResult)
|
|||
NSMutableArray *fields;
|
||||
NSMutableArray *tuples;
|
||||
ExecStatusType statusType;
|
||||
IMP fieldsAO=NULL; // addObject:
|
||||
IMP tuplesAO=NULL; // addObject:
|
||||
|
||||
nfields = PQnfields(pgResult);
|
||||
ntuples = PQntuples(pgResult);
|
||||
|
||||
fields = [NSMutableArray arrayWithCapacity: nfields];
|
||||
tuples = [NSMutableArray arrayWithCapacity: ntuples];
|
||||
fields = GDL2MutableArrayWithCapacity(nfields);
|
||||
tuples = GDL2MutableArrayWithCapacity(ntuples);
|
||||
|
||||
for (i = 1; i <= nfields; i++)
|
||||
{
|
||||
char *fname;
|
||||
fname = PQfname(pgResult, i);
|
||||
[fields addObject: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSS_SWF:@"%s", fname], @"PQfname",
|
||||
[NSS_SWF:@"%d", PQfnumber(pgResult, fname)], @"PQfnumber",
|
||||
[NSS_SWF:@"%ud", PQftype(pgResult, i)], @"PQftype",
|
||||
[NSS_SWF:@"%d", PQfsize(pgResult, i)], @"PQfsize",
|
||||
[NSS_SWF:@"%d", PQfmod(pgResult, i)], @"PQfmod",
|
||||
nil]];
|
||||
GDL2AddObjectWithImpPtr(fields,&fieldsAO,
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSS_SWF:@"%s", fname], @"PQfname",
|
||||
[NSS_SWF:@"%d", PQfnumber(pgResult, fname)], @"PQfnumber",
|
||||
[NSS_SWF:@"%ud", PQftype(pgResult, i)], @"PQftype",
|
||||
[NSS_SWF:@"%d", PQfsize(pgResult, i)], @"PQfsize",
|
||||
[NSS_SWF:@"%d", PQfmod(pgResult, i)], @"PQfmod",
|
||||
nil]);
|
||||
}
|
||||
|
||||
for (i = 1; i <= ntuples; i++)
|
||||
{
|
||||
IMP tupleSOFK=NULL; // setObject:forKey:
|
||||
NSMutableDictionary *tuple;
|
||||
tuple = [NSMutableDictionary dictionaryWithCapacity: nfields];
|
||||
tuple = GDL2MutableDictionaryWithCapacity(nfields);
|
||||
for (j = 1; j <= nfields; j++)
|
||||
{
|
||||
NSString *tupleInfo;
|
||||
|
@ -138,9 +142,9 @@ pgResultDictionary(PGresult *pgResult)
|
|||
fmt = [NSS_SWF: @"%%%ds", PQgetlength(pgResult, i, j)];
|
||||
tupleInfo = [NSS_SWF: fmt, PQgetvalue(pgResult, i, j)];
|
||||
}
|
||||
[tuple setObject: tupleInfo forKey: tupleKey];
|
||||
GDL2SetObjectForKeyWithImpPtr(tuple,&tupleSOFK,tupleInfo,tupleKey);
|
||||
}
|
||||
[tuples addObject: tuple];
|
||||
GDL2AddObjectWithImpPtr(tuples,&tuplesAO,tuple);
|
||||
}
|
||||
|
||||
statusType = PQresultStatus(pgResult);
|
||||
|
@ -168,7 +172,10 @@ pgResultDictionary(PGresult *pgResult)
|
|||
static BOOL initialized=NO;
|
||||
if (!initialized)
|
||||
{
|
||||
Class aClass=Nil;
|
||||
GDL2PrivInit();
|
||||
|
||||
aClass=[Postgres95Values class]; // Force Initialize;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -334,16 +341,17 @@ pgResultDictionary(PGresult *pgResult)
|
|||
|
||||
- (NSArray*)lowLevelResultFieldNames: (PGresult*)res
|
||||
{
|
||||
NSMutableArray *names = [NSMutableArray array];
|
||||
int nb = PQnfields(res);
|
||||
NSMutableArray *names = GDL2MutableArrayWithCapacity(nb);
|
||||
int i;
|
||||
IMP namesAO=NULL; //addObject:
|
||||
|
||||
for (i = 0; i < nb; i++)
|
||||
{
|
||||
char *szName = PQfname(res,i);
|
||||
NSString *name = [NSString stringWithCString: szName];
|
||||
NSString *name = GDL2StringWithCString(szName);
|
||||
|
||||
[names addObject: name];
|
||||
GDL2AddObjectWithImpPtr(names,&namesAO,name);
|
||||
}
|
||||
|
||||
return names;
|
||||
|
@ -398,7 +406,7 @@ zone:zone
|
|||
int count = [_attributes count];
|
||||
id valueBuffer[100];
|
||||
id *values = NULL;
|
||||
EONull *nullValue = (EONull *)[EONull null];
|
||||
IMP attributesOAI=NULL; // objectAtIndex:
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"count=%d", count);
|
||||
|
||||
|
@ -422,7 +430,7 @@ zone:zone
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
EOAttribute *attr = [_attributes objectAtIndex: i];
|
||||
EOAttribute *attr = GDL2ObjectAtIndexWithImpPtr(_attributes,&attributesOAI,i);
|
||||
int length = 0;
|
||||
const char *string = NULL;
|
||||
|
||||
|
@ -430,7 +438,7 @@ zone:zone
|
|||
|
||||
if (PQgetisnull(_pgResult, _currentResultRow, i))
|
||||
{
|
||||
values[i] = RETAIN(nullValue); //to be compatible with others returned values
|
||||
values[i] = RETAIN(GDL2EONull); //to be compatible with others returned values
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -447,9 +455,7 @@ zone:zone
|
|||
string = [self _readBinaryDataRow: (Oid)atol(string)
|
||||
length:&length zone: zone];
|
||||
//For efficiency reasons, the returned value is NOT autoreleased !
|
||||
values[i] = [Postgres95Values newValueForBytes: string
|
||||
length: length
|
||||
attribute: attr];
|
||||
values[i] = Postgres95Values_newValueForBytesLengthAttribute(string,length,attr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -460,9 +466,7 @@ zone:zone
|
|||
else
|
||||
{
|
||||
//For efficiency reasons, the returned value is NOT autoreleased !
|
||||
values[i] = [Postgres95Values newValueForBytes: string
|
||||
length: length
|
||||
attribute: attr];
|
||||
values[i] = Postgres95Values_newValueForBytesLengthAttribute(string,length,attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,6 +741,10 @@ zone:zone
|
|||
NSEnumerator *enumerator = nil;
|
||||
NSString *attrName = nil;
|
||||
Postgres95Context *adaptorContext = nil;
|
||||
IMP attrEnumNO=NULL; // nextObject
|
||||
IMP rowOFK=NULL; // objectForKey:
|
||||
IMP nrowSOFK=NULL; // setObject:forKey:
|
||||
IMP nrowOFK=NULL; // objectForKey:
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -780,7 +788,7 @@ each key
|
|||
*/
|
||||
|
||||
enumerator = [row keyEnumerator];
|
||||
while ((attrName = [enumerator nextObject]))
|
||||
while ((attrName = GDL2NextObjectWithImpPtr(enumerator,&attrEnumNO)))
|
||||
{
|
||||
EOAttribute *attribute = nil;
|
||||
NSString *externalType = nil;
|
||||
|
@ -794,7 +802,7 @@ each key
|
|||
if (!attribute)
|
||||
return; //???????????
|
||||
|
||||
value = [row objectForKey: attrName];
|
||||
value = GDL2ObjectForKeyWithImpPtr(row,&rowOFK,attrName);
|
||||
NSDebugMLLog(@"gsdb", @"value=%@", value);
|
||||
|
||||
externalType = [attribute externalType];
|
||||
|
@ -803,7 +811,7 @@ each key
|
|||
/* Insert the binary value into the binaryDataRow dictionary */
|
||||
if ([externalType isEqual: @"inversion"])
|
||||
{
|
||||
id binValue = [nrow objectForKey: attrName];
|
||||
id binValue = GDL2ObjectForKeyWithImpPtr(nrow,&nrowOFK,attrName);
|
||||
Oid binOid = [self _insertBinaryData: binValue
|
||||
forAttribute: attribute];
|
||||
value = [NSNumber numberWithLong: binOid];
|
||||
|
@ -814,8 +822,7 @@ each key
|
|||
// [[adaptorContext adaptor] databaseEncoding]
|
||||
}
|
||||
|
||||
[nrow setObject: value
|
||||
forKey: attrName];
|
||||
GDL2SetObjectForKeyWithImpPtr(nrow,&nrowSOFK,value,attrName);
|
||||
}
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"nrow=%@", nrow);
|
||||
|
@ -1015,6 +1022,7 @@ each key
|
|||
EOAttribute *attr = nil;
|
||||
Postgres95Context *adaptorContext = nil;
|
||||
unsigned long rows = 0;
|
||||
IMP valuesOFK=NULL; // objectForKey:
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -1034,6 +1042,9 @@ each key
|
|||
|
||||
if ([values count] > 0)
|
||||
{
|
||||
IMP valueEnumNO=NULL; // nextObject
|
||||
IMP mrowSOFK=NULL; // setObject:forKey;
|
||||
|
||||
mrow = AUTORELEASE([values mutableCopyWithZone: [values zone]]);
|
||||
|
||||
// Get EOAttributes involved in update operation
|
||||
|
@ -1042,7 +1053,7 @@ each key
|
|||
invAttributes = AUTORELEASE([[NSMutableArray alloc] initWithCapacity: [mrow count]]);
|
||||
|
||||
enumerator = [values keyEnumerator];
|
||||
while ((attrName = [enumerator nextObject]))
|
||||
while ((attrName = GDL2NextObjectWithImpPtr(enumerator,&valueEnumNO)))
|
||||
{
|
||||
attr = [entity attributeNamed: attrName];
|
||||
externalType = [attr externalType];
|
||||
|
@ -1054,8 +1065,9 @@ each key
|
|||
[values objectForKey:attrName]]
|
||||
forKey:attrName];
|
||||
*/
|
||||
[mrow setObject:[values objectForKey: attrName]
|
||||
forKey: attrName];
|
||||
GDL2SetObjectForKeyWithImpPtr(mrow,&mrowSOFK,
|
||||
GDL2ObjectForKeyWithImpPtr(values,&valuesOFK,attrName),
|
||||
attrName);
|
||||
|
||||
if ([externalType isEqual: @"inversion"])
|
||||
[invAttributes addObject: attr];
|
||||
|
@ -1067,6 +1079,7 @@ each key
|
|||
|
||||
if ([invAttributes count])
|
||||
{
|
||||
IMP invAttributesNO=NULL; // nextObject
|
||||
// Select with update qualifier to see there is only one row
|
||||
// to be updated and to get the large objects (to be updatetd)
|
||||
// Oid from dataserver - there is a hack here based on the fact that
|
||||
|
@ -1093,8 +1106,8 @@ each key
|
|||
|
||||
// Update the large objects and modify the row to update with Oid's
|
||||
|
||||
enumerator = [invAttributes objectEnumerator];
|
||||
while ((attr = [enumerator nextObject]))
|
||||
enumerator = [invAttributes objectEnumerator];
|
||||
while ((attr = GDL2NextObjectWithImpPtr(enumerator,&invAttributesNO)))
|
||||
{
|
||||
Oid oldOid;
|
||||
Oid newOid;
|
||||
|
@ -1106,8 +1119,9 @@ each key
|
|||
oldOid = [[dbRow objectForKey:attrName] longValue];
|
||||
newOid = [self _updateBinaryDataRow: oldOid data: data];
|
||||
|
||||
[mrow setObject: [NSNumber numberWithUnsignedLong: newOid]
|
||||
forKey: attrName];
|
||||
GDL2SetObjectForKeyWithImpPtr(mrow,&mrowSOFK,
|
||||
[NSNumber numberWithUnsignedLong: newOid],
|
||||
attrName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1363,26 +1377,29 @@ each key
|
|||
|
||||
if (colsNumber == 0)
|
||||
{
|
||||
[self setAttributesToFetch: [NSArray array]];
|
||||
[self setAttributesToFetch: GDL2Array()];
|
||||
}
|
||||
else if (!_attributes) //??
|
||||
{
|
||||
int i;
|
||||
id *attributes = NULL;
|
||||
id *attributes = NULL;
|
||||
IMP attributeNewIMP=[GDL2EOAttributeClass methodForSelector:GDL2_newSEL];
|
||||
IMP origAttributesOAI=NULL;
|
||||
IMP oidToTypeNameOFK=NULL;
|
||||
|
||||
attributes = alloca(colsNumber * sizeof(id));
|
||||
|
||||
for (i = 0; i < colsNumber; i++)
|
||||
{
|
||||
EOAttribute *attribute = AUTORELEASE([EOAttribute new]);
|
||||
EOAttribute *attribute = AUTORELEASE(((*attributeNewIMP)(GDL2EOAttributeClass,GDL2_newSEL)));
|
||||
NSString *externalType;
|
||||
NSString *valueClass = @"NSString";
|
||||
NSString *valueType = nil;
|
||||
|
||||
if (_origAttributes)
|
||||
{
|
||||
EOAttribute *origAttr = (EOAttribute *)[_origAttributes
|
||||
objectAtIndex: i];
|
||||
EOAttribute *origAttr = (EOAttribute *)
|
||||
GDL2ObjectAtIndexWithImpPtr(_origAttributes,&origAttributesOAI,i);
|
||||
|
||||
[attribute setName: [origAttr name]];
|
||||
[attribute setColumnName: [origAttr columnName]];
|
||||
|
@ -1395,8 +1412,9 @@ each key
|
|||
NSNumber *externalTypeNumber;
|
||||
externalTypeNumber
|
||||
= [NSNumber numberWithLong: PQftype(_pgResult, i)];
|
||||
externalType = [_oidToTypeName objectForKey: externalTypeNumber];
|
||||
|
||||
externalType = GDL2ObjectForKeyWithImpPtr(_oidToTypeName,
|
||||
&oidToTypeNameOFK,externalTypeNumber);
|
||||
|
||||
if (!externalType)
|
||||
[NSException raise: Postgres95Exception
|
||||
format: @"cannot find type for Oid = %d",
|
||||
|
@ -1464,8 +1482,9 @@ each key
|
|||
- (NSArray *)describeTableNames
|
||||
{
|
||||
int i, count;
|
||||
NSMutableArray *results = [NSMutableArray array];
|
||||
NSMutableArray *results = nil;
|
||||
char *tableSelect;
|
||||
IMP resultsAO=NULL; // addObject:
|
||||
|
||||
if (_pgVersion < 70300)
|
||||
{
|
||||
|
@ -1492,12 +1511,13 @@ each key
|
|||
}
|
||||
|
||||
count = PQntuples(_pgResult);
|
||||
results=GDL2MutableArrayWithCapacity(count);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
char *oid = PQgetvalue(_pgResult, i, 0);
|
||||
|
||||
[results addObject: [NSString stringWithUTF8String: oid]];
|
||||
GDL2AddObjectWithImpPtr(results,&resultsAO,[NSString stringWithUTF8String: oid]);
|
||||
}
|
||||
|
||||
PQclear(_pgResult);
|
||||
|
@ -1522,7 +1542,8 @@ each key
|
|||
NSString *valueClass = @"NSString";
|
||||
NSString *valueType = nil;
|
||||
NSString *tableOid;
|
||||
unsigned int n, c, k;
|
||||
unsigned int n, k;
|
||||
int count = 0;
|
||||
|
||||
entity = AUTORELEASE([[EOEntity alloc] init]);
|
||||
[entity setName: tableName];
|
||||
|
@ -1563,54 +1584,58 @@ each key
|
|||
PQclear(_pgResult);
|
||||
|
||||
_pgResult = PQexec(_pgConn, [stmt cString]);
|
||||
count = PQntuples(_pgResult);
|
||||
|
||||
for (n = 0, c = PQntuples(_pgResult); n < c; n++)
|
||||
if (count>0)
|
||||
{
|
||||
NSString *columnName;
|
||||
NSString *externalType;
|
||||
|
||||
externalType = [NSString stringWithCString: PQgetvalue(_pgResult,n,1)];
|
||||
|
||||
//TODO optimize ?
|
||||
if ([externalType isEqual: @"bool"])
|
||||
valueClass = @"NSNumber", valueType = @"c";
|
||||
else if ([externalType isEqual: @"char"])
|
||||
valueClass = @"NSNumber", valueType = @"c";
|
||||
else if ([externalType isEqual: @"dt"])
|
||||
valueClass = @"NSCalendarDate", valueType = nil;
|
||||
else if ([externalType isEqual: @"date"])
|
||||
valueClass = @"NSCalendarDate", valueType = nil;
|
||||
else if ([externalType isEqual: @"time"])
|
||||
valueClass = @"NSCalendarDate", valueType = nil;
|
||||
else if ([externalType isEqual: @"float4"])
|
||||
valueClass = @"NSNumber", valueType = @"f";
|
||||
else if ([externalType isEqual: @"float8"])
|
||||
valueClass = @"NSNumber", valueType = @"d";
|
||||
else if ([externalType isEqual: @"int2"])
|
||||
valueClass = @"NSNumber", valueType = @"i";
|
||||
else if ([externalType isEqual: @"int4"])
|
||||
valueClass = @"NSNumber", valueType = @"i";
|
||||
else if ([externalType isEqual: @"int8"])
|
||||
valueClass = @"NSNumber", valueType = @"l";
|
||||
else if ([externalType isEqual: @"oid"])
|
||||
valueClass = @"NSNumber", valueType = @"l";
|
||||
else if ([externalType isEqual: @"varchar"])
|
||||
valueClass = @"NSString", valueType = nil;
|
||||
else if ([externalType isEqual: @"bpchar"])
|
||||
valueClass = @"NSString", valueType = nil;
|
||||
else if ([externalType isEqual: @"text"])
|
||||
valueClass = @"NSString", valueType = nil;
|
||||
|
||||
attribute = AUTORELEASE([EOAttribute new]);
|
||||
columnName
|
||||
= [NSString stringWithCString: PQgetvalue(_pgResult, n, 0)];
|
||||
[attribute setName: columnName];
|
||||
[attribute setColumnName: columnName];
|
||||
[attribute setExternalType: externalType];
|
||||
[attribute setValueType: valueType];
|
||||
[attribute setValueClassName: valueClass];
|
||||
[entity addAttribute: attribute];
|
||||
}
|
||||
IMP attributeNewIMP=NULL;[GDL2EOAttributeClass methodForSelector:GDL2_newSEL];
|
||||
for (n = 0; n < count; n++)
|
||||
{
|
||||
NSString *columnName;
|
||||
NSString *externalType;
|
||||
|
||||
externalType = GDL2StringWithCString(PQgetvalue(_pgResult,n,1));
|
||||
|
||||
//TODO optimize ?
|
||||
if ([externalType isEqual: @"bool"])
|
||||
valueClass = @"NSNumber", valueType = @"c";
|
||||
else if ([externalType isEqual: @"char"])
|
||||
valueClass = @"NSNumber", valueType = @"c";
|
||||
else if ([externalType isEqual: @"dt"])
|
||||
valueClass = @"NSCalendarDate", valueType = nil;
|
||||
else if ([externalType isEqual: @"date"])
|
||||
valueClass = @"NSCalendarDate", valueType = nil;
|
||||
else if ([externalType isEqual: @"time"])
|
||||
valueClass = @"NSCalendarDate", valueType = nil;
|
||||
else if ([externalType isEqual: @"float4"])
|
||||
valueClass = @"NSNumber", valueType = @"f";
|
||||
else if ([externalType isEqual: @"float8"])
|
||||
valueClass = @"NSNumber", valueType = @"d";
|
||||
else if ([externalType isEqual: @"int2"])
|
||||
valueClass = @"NSNumber", valueType = @"i";
|
||||
else if ([externalType isEqual: @"int4"])
|
||||
valueClass = @"NSNumber", valueType = @"i";
|
||||
else if ([externalType isEqual: @"int8"])
|
||||
valueClass = @"NSNumber", valueType = @"l";
|
||||
else if ([externalType isEqual: @"oid"])
|
||||
valueClass = @"NSNumber", valueType = @"l";
|
||||
else if ([externalType isEqual: @"varchar"])
|
||||
valueClass = @"NSString", valueType = nil;
|
||||
else if ([externalType isEqual: @"bpchar"])
|
||||
valueClass = @"NSString", valueType = nil;
|
||||
else if ([externalType isEqual: @"text"])
|
||||
valueClass = @"NSString", valueType = nil;
|
||||
|
||||
attribute = AUTORELEASE(((*attributeNewIMP)(GDL2EOAttributeClass,GDL2_newSEL)));
|
||||
columnName = GDL2StringWithCString(PQgetvalue(_pgResult, n, 0));
|
||||
[attribute setName: columnName];
|
||||
[attribute setColumnName: columnName];
|
||||
[attribute setExternalType: externalType];
|
||||
[attribute setValueType: valueType];
|
||||
[attribute setValueClassName: valueClass];
|
||||
[entity addAttribute: attribute];
|
||||
}
|
||||
};
|
||||
|
||||
PQclear(_pgResult);
|
||||
|
||||
|
@ -1623,9 +1648,10 @@ each key
|
|||
_pgResult = PQexec(_pgConn,[stmt cString]);
|
||||
if (PQntuples(_pgResult))
|
||||
{
|
||||
NSString *pkAttNum;
|
||||
pkAttNum = [NSString stringWithCString: PQgetvalue(_pgResult,0,0)];
|
||||
pkAttNum = [pkAttNum stringByReplacingString:@" " withString: @", "];
|
||||
NSString *pkAttNum = GDL2StringWithCString(PQgetvalue(_pgResult,0,0));
|
||||
pkAttNum = [pkAttNum stringByReplacingString:@" "
|
||||
withString: @", "];
|
||||
|
||||
stmt = [NSS_SWF: @"SELECT attname FROM pg_attribute "
|
||||
@"WHERE attrelid='%@' and attnum in (%@)",
|
||||
tableOid, pkAttNum];
|
||||
|
@ -1636,14 +1662,15 @@ each key
|
|||
|
||||
if (PQntuples(_pgResult))
|
||||
{
|
||||
NSArray *pkeys = AUTORELEASE([NSArray new]);
|
||||
for (k = 0, c = PQntuples(_pgResult); k < c; k++)
|
||||
NSArray *pkeys = GDL2Array();
|
||||
count = PQntuples(_pgResult);
|
||||
for (k = 0; k < count; k++)
|
||||
{
|
||||
const char *cName;
|
||||
NSString *name;
|
||||
|
||||
cName = PQgetvalue(_pgResult,k,0);
|
||||
name = [NSString stringWithCString: cName];
|
||||
name = GDL2StringWithCString(cName);
|
||||
attribute = [entity attributeNamed: name];
|
||||
NSDebugMLLog(@"adaptor", @"pk(%d) name: %@", k, name);
|
||||
|
||||
|
@ -1689,7 +1716,7 @@ each key
|
|||
NSSet *dstPKSet;
|
||||
NSMutableSet *dstAttribNames;
|
||||
|
||||
fkString = [NSString stringWithCString: PQgetvalue(_pgResult,i,0)];
|
||||
fkString = GDL2StringWithCString(PQgetvalue(_pgResult,i,0));
|
||||
NSDebugMLLog(@"adaptor", @"foreign key: %@\n",fkString);
|
||||
|
||||
fkComp = [fkString componentsSeparatedByString: @"\\000"];
|
||||
|
@ -1931,10 +1958,9 @@ each key
|
|||
string = PQgetvalue(_pgResult, _currentResultRow, 0);
|
||||
length = PQgetlength(_pgResult, _currentResultRow, 0);
|
||||
|
||||
pkValue = AUTORELEASE([Postgres95Values newValueForBytes: string
|
||||
length: length
|
||||
attribute: [_pkAttributeArray
|
||||
objectAtIndex: 0]]);
|
||||
pkValue = AUTORELEASE(Postgres95Values_newValueForBytesLengthAttribute(string,
|
||||
length,
|
||||
[_pkAttributeArray objectAtIndex: 0]));
|
||||
|
||||
NSAssert(pkValue, @"no pk value");
|
||||
key = [[entity primaryKeyAttributeNames] objectAtIndex: 0];
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
|
||||
extern NSString *Postgres95CalendarFormat;
|
||||
|
||||
extern Class Postgres95ValuesClass;
|
||||
extern SEL Postgres95Values_newValueForBytesLengthAttributeSEL;
|
||||
extern IMP Postgres95Values_newValueForBytesLengthAttributeIMP;
|
||||
|
||||
@interface Postgres95Values:NSObject
|
||||
{
|
||||
|
@ -78,4 +81,10 @@ extern NSString *Postgres95CalendarFormat;
|
|||
|
||||
@end
|
||||
|
||||
#define Postgres95Values_newValueForBytesLengthAttribute(bytes,length,attribute) \
|
||||
(*Postgres95Values_newValueForBytesLengthAttributeIMP)(Postgres95ValuesClass, \
|
||||
Postgres95Values_newValueForBytesLengthAttributeSEL, \
|
||||
(const void *)(bytes), \
|
||||
(int)(length), \
|
||||
(EOAttribute*)(attribute))
|
||||
#endif /* __Postgres95Values_h__ */
|
||||
|
|
|
@ -69,8 +69,13 @@ void __postgres95_values_linking_function (void)
|
|||
{
|
||||
}
|
||||
|
||||
Class Postgres95ValuesClass=Nil;
|
||||
|
||||
static SEL postgres95FormatSEL=NULL;
|
||||
SEL Postgres95Values_newValueForBytesLengthAttributeSEL=NULL;
|
||||
|
||||
static IMP GDL2NSCalendarDate_postgres95FormatIMP=NULL;
|
||||
IMP Postgres95Values_newValueForBytesLengthAttributeIMP=NULL;
|
||||
|
||||
@implementation Postgres95Values
|
||||
|
||||
|
@ -81,10 +86,16 @@ static IMP GDL2NSCalendarDate_postgres95FormatIMP=NULL;
|
|||
{
|
||||
GDL2PrivInit();
|
||||
|
||||
ASSIGN(Postgres95ValuesClass,([Postgres95Values class]));
|
||||
|
||||
postgres95FormatSEL=@selector(postgres95Format);
|
||||
Postgres95Values_newValueForBytesLengthAttributeSEL=@selector(newValueForBytes:length:attribute:);
|
||||
|
||||
GDL2NSCalendarDate_postgres95FormatIMP=[GDL2NSCalendarDateClass
|
||||
methodForSelector:postgres95FormatSEL];
|
||||
|
||||
Postgres95Values_newValueForBytesLengthAttributeIMP=[Postgres95ValuesClass
|
||||
methodForSelector:Postgres95Values_newValueForBytesLengthAttributeSEL];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -222,7 +233,7 @@ For efficiency reasons, the returned value is NOT autoreleased !
|
|||
{
|
||||
return [attribute newValueForBytes: bytes
|
||||
length: length
|
||||
encoding: [NSString defaultCStringEncoding]];//TODO OPTIM
|
||||
encoding: GDL2StringDefaultCStringEncoding()];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -325,11 +325,14 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
if (toManyCount > 0)
|
||||
{
|
||||
int i;
|
||||
IMP oaiIMP=NULL;
|
||||
IMP objectTSVFK=NULL; // takeStoredValue:forKey:
|
||||
IMP objectSVFK=NULL; // storedValueForKey:
|
||||
|
||||
for (i = 0; i < toManyCount; i++)
|
||||
{
|
||||
id key = [toManyRelationshipKeys objectAtIndex: i];
|
||||
id value = [object storedValueForKey: key];
|
||||
id key = GDL2ObjectAtIndexWithImpPtr(toManyRelationshipKeys,&oaiIMP,i);
|
||||
id value = GDL2StoredValueForKeyWithImpPtr(object,&objectSVFK,key);
|
||||
NSDebugMLLog(@"gsdb", @"key=%@ value=%@",key,value);
|
||||
|
||||
if (value)
|
||||
|
@ -338,9 +341,9 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
}
|
||||
else
|
||||
{
|
||||
[object takeStoredValue:[EOCheapCopyMutableArray
|
||||
arrayWithCapacity: 2]
|
||||
forKey: key];
|
||||
GDL2TakeStoredValueForKeyWithImpPtr(object,&objectTSVFK,
|
||||
[EOCheapCopyMutableArray arrayWithCapacity: 2],
|
||||
key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -387,6 +390,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSMutableString *str = [NSMutableString stringWithCapacity:[key length]];
|
||||
char c;
|
||||
BOOL init = NO;
|
||||
IMP strAS=NULL;
|
||||
|
||||
s = ckey;
|
||||
|
||||
|
@ -395,13 +399,14 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
if (init && s == ckey && islower(*s))
|
||||
{
|
||||
c = toupper(*s);
|
||||
[str appendString: [NSString stringWithCString: &c length: 1]];
|
||||
GDL2AppendStringWithImpPtr(str,&strAS,
|
||||
GDL2StringWithCStringAndLength(&c,1));
|
||||
}
|
||||
else if (isupper(*s) && s != ckey)
|
||||
{
|
||||
[str appendString: [NSString stringWithCString: ckey
|
||||
length: s - ckey]];
|
||||
[str appendString: @" "];
|
||||
GDL2AppendStringWithImpPtr(str,&strAS,
|
||||
GDL2StringWithCStringAndLength(ckey,s - ckey));
|
||||
GDL2AppendStringWithImpPtr(str,&strAS,@" ");
|
||||
ckey = s;
|
||||
}
|
||||
|
||||
|
@ -410,7 +415,8 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
}
|
||||
|
||||
if (s != ckey)
|
||||
[str appendString: [NSString stringWithCString: ckey length: s - ckey]];
|
||||
GDL2AppendStringWithImpPtr(str,&strAS,
|
||||
GDL2StringWithCStringAndLength(ckey,s - ckey));
|
||||
|
||||
return AUTORELEASE([key copy]);
|
||||
}
|
||||
|
@ -450,6 +456,10 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
}
|
||||
else
|
||||
{
|
||||
IMP objectSVFK=NULL; // storedValueForKey:
|
||||
IMP objectVFK=NULL;
|
||||
IMP toRelEnumNO=NULL;
|
||||
|
||||
classDelegate = [[self class] classDelegate];
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"classDelegate%p=%@",
|
||||
|
@ -459,7 +469,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
toRelArray = [object toOneRelationshipKeys];
|
||||
toRelEnum = [toRelArray objectEnumerator];
|
||||
|
||||
while ((key = [toRelEnum nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(toRelEnum,&toRelEnumNO)))
|
||||
{
|
||||
BOOL shouldPropagate = YES;
|
||||
|
||||
|
@ -475,7 +485,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
|
||||
if (shouldPropagate)
|
||||
{
|
||||
destination = [object storedValueForKey: key];
|
||||
destination = GDL2StoredValueForKeyWithImpPtr(object,&objectSVFK,key);
|
||||
NSDebugMLLog(@"gsdb", @"destination %p=%@",
|
||||
destination, destination);
|
||||
|
||||
|
@ -533,8 +543,9 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
|
||||
toRelArray = [self toManyRelationshipKeys];
|
||||
toRelEnum = [toRelArray objectEnumerator];
|
||||
toRelEnumNO=NULL;
|
||||
|
||||
while ((key = [toRelEnum nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(toRelEnum,&toRelEnumNO)))
|
||||
{
|
||||
BOOL shouldPropagate = YES;
|
||||
|
||||
|
@ -550,9 +561,10 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
if (shouldPropagate)
|
||||
{
|
||||
NSArray *toManyArray;
|
||||
IMP toManyArrayLO=NULL;
|
||||
EODeleteRule deleteRule;
|
||||
|
||||
toManyArray = [object valueForKey: key];
|
||||
toManyArray = GDL2ValueForKeyWithImpPtr(object,&objectVFK,key);
|
||||
NSDebugMLLog(@"gsdb", @"toManyArray %p=%@", toManyArray, toManyArray);
|
||||
|
||||
deleteRule = [object deleteRuleForRelationshipKey: key];
|
||||
|
@ -565,7 +577,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSDebugMLLog(@"gsdb", @"toManyArray %p=%@", toManyArray,
|
||||
toManyArray);
|
||||
|
||||
while ((destination = [toManyArray lastObject]))
|
||||
while ((destination = GDL2LastObjectWithImpPtr(toManyArray,&toManyArrayLO)))
|
||||
{
|
||||
NSDebugMLLog(@"gsdb", @"destination %p=%@", destination,
|
||||
destination);
|
||||
|
@ -591,7 +603,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSDebugMLLog(@"gsdb", @"toManyArray %p=%@",
|
||||
toManyArray, toManyArray);
|
||||
|
||||
while ((destination = [toManyArray lastObject]))
|
||||
while ((destination = GDL2LastObjectWithImpPtr(toManyArray,&toManyArrayLO)))
|
||||
{
|
||||
NSDebugMLLog(@"gsdb", @"destination %p=%@",
|
||||
destination, destination);
|
||||
|
@ -965,6 +977,9 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSMutableArray *expArray = nil;
|
||||
NSException* exception;
|
||||
int which;
|
||||
IMP selfVFK=NULL; // valueForKey:
|
||||
IMP selfVVFK=NULL; // validateValue:forKey:
|
||||
IMP selfTVFK=NULL; // takeValue:forKey:
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -992,16 +1007,16 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
{
|
||||
int keysCount = [keys count];
|
||||
int i;
|
||||
IMP oaiIMP=NULL;
|
||||
|
||||
for (i = 0; i < keysCount; i++)
|
||||
{
|
||||
NSString *key = [keys objectAtIndex: i];
|
||||
id value = [self valueForKey: key];
|
||||
NSString *key = GDL2ObjectAtIndexWithImpPtr(keys,&oaiIMP,i);
|
||||
id value = GDL2ValueForKeyWithImpPtr(self,&selfVFK,key);
|
||||
id newValue = value;
|
||||
BOOL isEqual=NO;
|
||||
|
||||
exception = [self validateValue: &newValue
|
||||
forKey: key];
|
||||
exception = GDL2ValidateValueForKeyWithImpPtr(self,&selfVVFK,&newValue,key);
|
||||
if (exception)
|
||||
{
|
||||
if (!expArray)
|
||||
|
@ -1019,8 +1034,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
{
|
||||
NSDebugMLLog(@"gsdb", @"key=%@ newValue='%@' (class=%@) value='%@' (class=%@)",
|
||||
key,newValue,[newValue class],value,[value class]);
|
||||
[self takeValue: newValue
|
||||
forKey: key];
|
||||
GDL2TakeValueForKeyWithImpPtr(self,&selfTVFK,newValue,key);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1102,6 +1116,9 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
}
|
||||
else
|
||||
{
|
||||
IMP selfSVFK=NULL; // storedValueForKey:
|
||||
IMP snapshotSOFK=NULL; // setObject:forKey:
|
||||
|
||||
attributeKeys = [self attributeKeys];
|
||||
NSDebugMLLog(@"gsdb", @"attributeKeys=%@", attributeKeys);
|
||||
|
||||
|
@ -1117,66 +1134,77 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
attributeKeyCount, toOneRelationshipKeyCount,
|
||||
toManyRelationshipKeyCount);
|
||||
|
||||
snapshot = [NSMutableDictionary dictionaryWithCapacity: attributeKeyCount
|
||||
+ toOneRelationshipKeyCount
|
||||
+ toManyRelationshipKeyCount];
|
||||
snapshot = GDL2MutableDictionaryWithCapacity(attributeKeyCount
|
||||
+ toOneRelationshipKeyCount
|
||||
+ toManyRelationshipKeyCount);
|
||||
NSDebugMLLog(@"gsdb", @"attributeKeys=%@", attributeKeys);
|
||||
|
||||
for (i = 0; i < attributeKeyCount; i++)
|
||||
if (attributeKeyCount>0)
|
||||
{
|
||||
id key = [attributeKeys objectAtIndex: i];
|
||||
id value = [self storedValueForKey: key];
|
||||
|
||||
if (!value)
|
||||
value = GDL2EONull;
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
[snapshot setObject: value
|
||||
forKey: key];
|
||||
}
|
||||
IMP oaiIMP=NULL;
|
||||
|
||||
for (i = 0; i < attributeKeyCount; i++)
|
||||
{
|
||||
id key = GDL2ObjectAtIndexWithImpPtr(attributeKeys,&oaiIMP,i);
|
||||
id value = GDL2StoredValueForKeyWithImpPtr(self,&selfSVFK,key);
|
||||
|
||||
if (!value)
|
||||
value = GDL2EONull;
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
GDL2SetObjectForKeyWithImpPtr(snapshot,&snapshotSOFK,value,key);
|
||||
}
|
||||
};
|
||||
NSDebugMLLog(@"gsdb", @"toOneRelationshipKeys=%@", toOneRelationshipKeys);
|
||||
|
||||
for (i = 0; i < toOneRelationshipKeyCount; i++)
|
||||
if (toOneRelationshipKeyCount>0)
|
||||
{
|
||||
id key = [toOneRelationshipKeys objectAtIndex: i];
|
||||
id value = [self storedValueForKey: key];
|
||||
IMP oaiIMP=NULL;
|
||||
|
||||
if (!value)
|
||||
value = GDL2EONull;
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"TOONE snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
[snapshot setObject: value
|
||||
forKey: key];
|
||||
}
|
||||
for (i = 0; i < toOneRelationshipKeyCount; i++)
|
||||
{
|
||||
id key = GDL2ObjectAtIndexWithImpPtr(toOneRelationshipKeys,&oaiIMP,i);
|
||||
id value = GDL2StoredValueForKeyWithImpPtr(self,&selfSVFK,key);
|
||||
|
||||
if (!value)
|
||||
value = GDL2EONull;
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"TOONE snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
GDL2SetObjectForKeyWithImpPtr(snapshot,&snapshotSOFK,value,key);
|
||||
}
|
||||
};
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"toManyRelationshipKeys=%@", toManyRelationshipKeys);
|
||||
|
||||
for (i = 0; i < toManyRelationshipKeyCount; i++)
|
||||
if (toManyRelationshipKeyCount>0)
|
||||
{
|
||||
id key = [toManyRelationshipKeys objectAtIndex: i];
|
||||
id value = [self storedValueForKey: key];
|
||||
IMP oaiIMP=NULL;
|
||||
|
||||
if (value)
|
||||
for (i = 0; i < toManyRelationshipKeyCount; i++)
|
||||
{
|
||||
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
value = AUTORELEASE([((NSArray*)value) shallowCopy]);
|
||||
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
[snapshot setObject: value
|
||||
forKey: key];
|
||||
id key = GDL2ObjectAtIndexWithImpPtr(toManyRelationshipKeys,&oaiIMP,i);
|
||||
id value = GDL2StoredValueForKeyWithImpPtr(self,&selfSVFK,key);
|
||||
|
||||
if (value)
|
||||
{
|
||||
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
value = AUTORELEASE([((NSArray*)value) shallowCopy]);
|
||||
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
|
||||
snapshot, key, value, value);
|
||||
|
||||
GDL2SetObjectForKeyWithImpPtr(snapshot,&snapshotSOFK,value,key);
|
||||
}
|
||||
/* //TODO-VERIFY or set it to eonull ?
|
||||
else
|
||||
value=GDL2EONull;
|
||||
*/
|
||||
}
|
||||
/* //TODO-VERIFY or set it to eonull ?
|
||||
else
|
||||
value=GDL2EONull;
|
||||
*/
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"self=%p snapshot=%p", self, snapshot);
|
||||
|
@ -1196,18 +1224,21 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSEnumerator *snapshotEnum = [snapshot keyEnumerator];
|
||||
NSString *key;
|
||||
id val;
|
||||
IMP selfTSVFK=NULL; // takeStoredValue:forKey:
|
||||
IMP snapshotOFK=NULL;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
while ((key = [snapshotEnum nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(snapshotEnum,&enumNO)))
|
||||
{
|
||||
val = [snapshot objectForKey: key];
|
||||
val = GDL2ObjectForKeyWithImpPtr(snapshot,&snapshotOFK,key);
|
||||
|
||||
if (val==GDL2EONull)
|
||||
val = nil;
|
||||
|
||||
if ([val isKindOfClass: [NSArray class]])
|
||||
if ([val isKindOfClass: GDL2NSArrayClass])
|
||||
val = AUTORELEASE([AUTORELEASE([((NSArray*)val) shallowCopy]) mutableCopy]);
|
||||
|
||||
[self takeStoredValue: val forKey: key];
|
||||
GDL2TakeStoredValueForKeyWithImpPtr(self,&selfTSVFK,val,key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1216,8 +1247,9 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSArray *toMany = [self toManyRelationshipKeys];
|
||||
NSEnumerator *toManyEnum = [toMany objectEnumerator];
|
||||
NSString *relationship;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
while ((relationship = [toManyEnum nextObject]))
|
||||
while ((relationship = GDL2NextObjectWithImpPtr(toManyEnum,&enumNO)))
|
||||
{
|
||||
if ([relationship isEqualToString: key])
|
||||
return YES;
|
||||
|
@ -1263,9 +1295,8 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
toOne = [self toOneRelationshipKeys];
|
||||
toMany = [self toManyRelationshipKeys];
|
||||
|
||||
ret = [NSMutableArray arrayWithCapacity:
|
||||
[attr count] +
|
||||
[toOne count] + [toMany count]];
|
||||
ret = GDL2MutableArrayWithCapacity([attr count] +
|
||||
[toOne count] + [toMany count]);
|
||||
|
||||
[ret addObjectsFromArray: attr];
|
||||
[ret addObjectsFromArray: toOne];
|
||||
|
@ -1280,17 +1311,27 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSArray *toMany = nil;
|
||||
NSEnumerator *relEnum = nil;
|
||||
NSString *key = nil;
|
||||
IMP selfTSVFK=NULL; // takeStoredValue:forKey:
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
toOne = [self toOneRelationshipKeys];
|
||||
toMany = [self toManyRelationshipKeys];
|
||||
|
||||
relEnum = [toOne objectEnumerator];
|
||||
while ((key = [relEnum nextObject]))
|
||||
[self takeStoredValue: nil forKey: key];
|
||||
enumNO=NULL;
|
||||
|
||||
while ((key = GDL2NextObjectWithImpPtr(relEnum,&enumNO)))
|
||||
GDL2TakeStoredValueForKeyWithImpPtr(self,&selfTSVFK,nil,key);
|
||||
|
||||
|
||||
relEnum = [toMany objectEnumerator];
|
||||
while ((key = [relEnum nextObject]))
|
||||
[self takeStoredValue: nil forKey: key];
|
||||
enumNO=NULL;
|
||||
|
||||
while ((key = GDL2NextObjectWithImpPtr(relEnum,&enumNO)))
|
||||
GDL2TakeStoredValueForKeyWithImpPtr(self,&selfTSVFK,nil,key);
|
||||
|
||||
EOFLOGObjectFnStop();
|
||||
}
|
||||
|
||||
|
@ -1315,19 +1356,26 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
NSArray *attrArray = [self allPropertyKeys];
|
||||
NSEnumerator *attrEnum = [attrArray objectEnumerator];
|
||||
NSString *key;
|
||||
IMP attrEnumNO=NULL; // nextObject
|
||||
IMP retAS=NULL; // appendString:
|
||||
IMP selfVFK=NULL; // valueForKey:
|
||||
|
||||
NSMutableString *ret = [NSMutableString
|
||||
stringWithCapacity: 5 * [attrArray count]];
|
||||
|
||||
[ret appendString: [NSString stringWithFormat:@"<%@ (%p)",
|
||||
NSStringFromClass([self class]), self]];
|
||||
GDL2AppendStringWithImpPtr(ret,&retAS,
|
||||
[NSString stringWithFormat:@"<%@ (%p)",
|
||||
NSStringFromClass([self class]), self]);
|
||||
|
||||
while ((key = [attrEnum nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(attrEnum,&attrEnumNO)))
|
||||
{
|
||||
[ret appendString: [NSString stringWithFormat: @" %@=%@",
|
||||
key, [self valueForKey: key]]];
|
||||
GDL2AppendStringWithImpPtr(ret,&retAS,
|
||||
[NSString stringWithFormat: @" %@=%@",
|
||||
key,
|
||||
GDL2ValueForKeyWithImpPtr(self,&selfVFK,key)]);
|
||||
}
|
||||
|
||||
[ret appendString: [NSString stringWithFormat: @">"]];
|
||||
GDL2AppendStringWithImpPtr(ret,&retAS,@">");
|
||||
|
||||
return ret; //TODO
|
||||
}
|
||||
|
@ -1340,9 +1388,8 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
|
|||
- (void)addObject: (id)object
|
||||
toPropertyWithKey: (NSString *)key
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"self=%@", self);
|
||||
NSDebugMLLog(@"gsdb", @"object=%@", object);
|
||||
NSDebugMLLog(@"gsdb", @"key=%@", key);
|
||||
|
@ -1353,32 +1400,41 @@ toPropertyWithKey: (NSString *)key
|
|||
}
|
||||
else
|
||||
{
|
||||
str = [key cString];
|
||||
int size = [key length];
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"*+* ciao3 %@", key);
|
||||
NSDebugMLLog(@"gsdb", @"*+* ciao3 %@", object);
|
||||
|
||||
if ([key length])
|
||||
if (size < 1)
|
||||
{
|
||||
NSMutableString *selString = [NSMutableString stringWithCapacity: 25];
|
||||
SEL addToSelector;
|
||||
char l = str[0];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"addObject:toPropertyWithKey: ... empty key"];
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[size+7];
|
||||
char lo;
|
||||
char hi;
|
||||
GDL2IMP_BOOL rtsIMP=NULL;
|
||||
SEL sel=NULL;
|
||||
|
||||
if (islower(l))
|
||||
l = toupper(l);
|
||||
// Test addToKey:
|
||||
|
||||
[selString appendString: @"addTo"];
|
||||
[selString appendString: [NSString stringWithCString: &l length: 1]];
|
||||
[selString appendString: [NSString stringWithCString: &str[1]]];
|
||||
[selString appendString: @":"];
|
||||
strcpy(buf, "addTo");
|
||||
[key getCString: &buf[5]];
|
||||
lo = buf[5];
|
||||
hi = islower(lo) ? toupper(lo) : lo;
|
||||
buf[5] = hi;
|
||||
buf[size+5] = ':';
|
||||
buf[size+6] = '\0';
|
||||
|
||||
addToSelector = NSSelectorFromString(selString);
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", @"A aKey=%@ Method [addToKey:] name=%s",
|
||||
key, buf);
|
||||
|
||||
if (addToSelector && [self respondsToSelector: addToSelector] == YES)
|
||||
sel = sel_get_any_uid(buf);
|
||||
|
||||
if (sel && GDL2RespondsToSelectorWithImpPtr(self,&rtsIMP,sel) == YES)
|
||||
{
|
||||
NSDebugMLLog(@"gsdb", @"selector=%@", selString);
|
||||
NSDebugMLLog(@"gsdb", @"selector=%@", NSStringFromSelector(sel));
|
||||
|
||||
[self performSelector: addToSelector
|
||||
[self performSelector: sel
|
||||
withObject: object];
|
||||
}
|
||||
else
|
||||
|
@ -1400,7 +1456,7 @@ toPropertyWithKey: (NSString *)key
|
|||
}
|
||||
else
|
||||
{
|
||||
if ([val isKindOfClass: [NSMutableArray class]])
|
||||
if ([val isKindOfClass: GDL2NSMutableArrayClass])
|
||||
{
|
||||
EOFLOGObjectLevel(@"gsdb", @"to many2");
|
||||
[self willChange];
|
||||
|
@ -1413,7 +1469,7 @@ toPropertyWithKey: (NSString *)key
|
|||
if (val)
|
||||
relArray = AUTORELEASE([val mutableCopy]);
|
||||
else
|
||||
relArray = [NSMutableArray arrayWithCapacity: 10];
|
||||
relArray = GDL2MutableArrayWithCapacity(10);
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"relArray=%@ (%@)",
|
||||
relArray, [relArray class]);
|
||||
|
@ -1448,7 +1504,6 @@ toPropertyWithKey: (NSString *)key
|
|||
fromPropertyWithKey: (NSString *)key
|
||||
{
|
||||
//self valueForKey:
|
||||
const char *str = NULL;
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
NSDebugMLLog(@"gsdb", @"self=%@", self);
|
||||
|
@ -1461,36 +1516,40 @@ toPropertyWithKey: (NSString *)key
|
|||
}
|
||||
else
|
||||
{
|
||||
str = [key cString];
|
||||
int size = [key length];
|
||||
|
||||
if ([key length])
|
||||
if (size < 1)
|
||||
{
|
||||
NSMutableString *selString = [NSMutableString stringWithCapacity: 25];
|
||||
SEL removeFromSelector;
|
||||
char l = str[0];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"removeObject:fromPropertyWithKey: ... empty key"];
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[size+12];
|
||||
char lo;
|
||||
char hi;
|
||||
GDL2IMP_BOOL rtsIMP=NULL;
|
||||
SEL sel=NULL;
|
||||
|
||||
if (islower(l))
|
||||
l = toupper(l);
|
||||
|
||||
[selString appendString: @"removeFrom"];
|
||||
NSDebugMLLog(@"gsdb", @"selString=%@", selString);
|
||||
[selString appendString: [NSString stringWithCString: &l
|
||||
length: 1]];
|
||||
NSDebugMLLog(@"gsdb", @"selString=%@", selString);
|
||||
[selString appendString: [NSString stringWithCString: &str[1]]];
|
||||
NSDebugMLLog(@"gsdb", @"selString=%@", selString);
|
||||
[selString appendString: @":"];
|
||||
NSDebugMLLog(@"gsdb", @"selString=%@", selString);
|
||||
// Test removeFromKey:
|
||||
|
||||
removeFromSelector = NSSelectorFromString(selString);
|
||||
strcpy(buf, "removeFrom");
|
||||
[key getCString: &buf[10]];
|
||||
lo = buf[10];
|
||||
hi = islower(lo) ? toupper(lo) : lo;
|
||||
buf[10] = hi;
|
||||
buf[size+10] = ':';
|
||||
buf[size+11] = '\0';
|
||||
|
||||
NSDebugMLLog(@"gsdb", @"selString=%@ removeFromSelector=%p", selString,
|
||||
(void*)removeFromSelector);
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", @"A aKey=%@ Method [removeFromKey:] name=%s",
|
||||
key, buf);
|
||||
|
||||
if (removeFromSelector && [self respondsToSelector: removeFromSelector])
|
||||
sel = sel_get_any_uid(buf);
|
||||
|
||||
if (sel && GDL2RespondsToSelectorWithImpPtr(self,&rtsIMP,sel) == YES)
|
||||
{
|
||||
EOFLOGObjectLevel(@"gsdb", @"responds=YES");
|
||||
[self performSelector: removeFromSelector
|
||||
[self performSelector: sel
|
||||
withObject: object];
|
||||
}
|
||||
else
|
||||
|
@ -1506,7 +1565,7 @@ toPropertyWithKey: (NSString *)key
|
|||
val = [self valueForKey: key];
|
||||
NSDebugMLLog(@"gsdb", @"val=%@", val);
|
||||
|
||||
if ([val isKindOfClass: [NSMutableArray class]])
|
||||
if ([val isKindOfClass: GDL2NSMutableArrayClass])
|
||||
{
|
||||
[self willChange];
|
||||
[val removeObject: object];
|
||||
|
@ -1836,9 +1895,13 @@ fromBothSidesOfRelationshipWithKey: (NSString *)key
|
|||
id propertiesList[2];
|
||||
NSArray *properties;
|
||||
int h, i, count;
|
||||
NSMutableArray *newKeys = [NSMutableArray arrayWithCapacity: 16];
|
||||
NSMutableArray *newVals = [NSMutableArray arrayWithCapacity: 16];
|
||||
NSMutableArray *newKeys = GDL2MutableArrayWithCapacity(16);
|
||||
NSMutableArray *newVals = GDL2MutableArrayWithCapacity(16);
|
||||
NSString *key;
|
||||
IMP selfSVFK=NULL; // storedValueForKey:
|
||||
IMP snapshotSVFK=NULL; // storedValueForKey:
|
||||
IMP newKeysAO=NULL;
|
||||
IMP newValsAO=NULL;
|
||||
|
||||
propertiesList[0] = [self attributeKeys];
|
||||
propertiesList[1] = [self toOneRelationshipKeys];
|
||||
|
@ -1846,76 +1909,81 @@ fromBothSidesOfRelationshipWithKey: (NSString *)key
|
|||
for (h = 0; h < 2; h++)
|
||||
{
|
||||
id val, oldVal;
|
||||
IMP oaiIMP=NULL;
|
||||
|
||||
properties = propertiesList[h];
|
||||
count = [properties count];
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
key = [properties objectAtIndex: i];
|
||||
val = [self storedValueForKey: key];
|
||||
oldVal = [snapshot storedValueForKey: key];
|
||||
|
||||
if (val == oldVal || [val isEqual: oldVal] == YES)
|
||||
continue;
|
||||
|
||||
[newKeys addObject: key];
|
||||
[newVals addObject: val];
|
||||
}
|
||||
{
|
||||
key = GDL2ObjectAtIndexWithImpPtr(properties, &oaiIMP, i);
|
||||
val = GDL2StoredValueForKeyWithImpPtr(self, &selfSVFK, key);
|
||||
oldVal = GDL2StoredValueForKeyWithImpPtr(snapshot, &snapshotSVFK, key);
|
||||
|
||||
if (val == oldVal || [val isEqual: oldVal] == YES)
|
||||
continue;
|
||||
|
||||
GDL2AddObjectWithImpPtr(newKeys,&newKeysAO,key);
|
||||
GDL2AddObjectWithImpPtr(newVals,&newValsAO,val);
|
||||
};
|
||||
}
|
||||
|
||||
properties = [self toManyRelationshipKeys];
|
||||
count = [properties count];
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
if (count>0)
|
||||
{
|
||||
NSMutableArray *array, *objects;
|
||||
NSArray *val, *oldVal;
|
||||
int valCount, oldValCount;
|
||||
IMP oaiIMP=NULL;
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
NSMutableArray *array, *objects;
|
||||
NSArray *val, *oldVal;
|
||||
int valCount, oldValCount;
|
||||
|
||||
key = [properties objectAtIndex: i];
|
||||
val = [self storedValueForKey: key];
|
||||
oldVal = [snapshot objectForKey: key];
|
||||
|
||||
if ((id)val == GDL2EONull)
|
||||
val = nil;
|
||||
|
||||
if ((id)oldVal == GDL2EONull)
|
||||
oldVal = nil;
|
||||
|
||||
if (!val && !oldVal)
|
||||
continue;
|
||||
|
||||
valCount = [val count];
|
||||
oldValCount = [oldVal count];
|
||||
|
||||
if (valCount == 0 && oldValCount == 0)
|
||||
continue;
|
||||
|
||||
array = [NSMutableArray arrayWithCapacity: 2];
|
||||
if (val && valCount>0)
|
||||
{
|
||||
objects = [NSMutableArray arrayWithArray: val];
|
||||
[objects removeObjectsInArray: oldVal];
|
||||
}
|
||||
else
|
||||
objects = [NSMutableArray arrayWithCapacity: 1];
|
||||
|
||||
[array addObject: objects];
|
||||
|
||||
if (val && valCount > 0)
|
||||
{
|
||||
objects = [NSMutableArray arrayWithArray: oldVal];
|
||||
[objects removeObjectsInArray: val];
|
||||
}
|
||||
else
|
||||
objects = [NSMutableArray arrayWithCapacity: 1];
|
||||
|
||||
[array addObject: objects];
|
||||
|
||||
[newKeys addObject: key];
|
||||
[newVals addObject: array];
|
||||
}
|
||||
key = GDL2ObjectAtIndexWithImpPtr(properties, &oaiIMP, i);
|
||||
val = GDL2StoredValueForKeyWithImpPtr(self, &selfSVFK, key);
|
||||
oldVal = GDL2StoredValueForKeyWithImpPtr(snapshot, &snapshotSVFK, key);
|
||||
|
||||
if ((id)val == GDL2EONull)
|
||||
val = nil;
|
||||
|
||||
if ((id)oldVal == GDL2EONull)
|
||||
oldVal = nil;
|
||||
|
||||
if (!val && !oldVal)
|
||||
continue;
|
||||
|
||||
valCount = [val count];
|
||||
oldValCount = [oldVal count];
|
||||
|
||||
if (valCount == 0 && oldValCount == 0)
|
||||
continue;
|
||||
|
||||
array = GDL2MutableArrayWithCapacity(2);
|
||||
if (val && valCount>0)
|
||||
{
|
||||
objects = GDL2MutableArrayWithArray(val);
|
||||
[objects removeObjectsInArray: oldVal];
|
||||
}
|
||||
else
|
||||
objects = GDL2MutableArrayWithCapacity(1);
|
||||
|
||||
[array addObject: objects];
|
||||
|
||||
if (val && valCount > 0)
|
||||
{
|
||||
objects = GDL2MutableArrayWithArray(oldVal);
|
||||
[objects removeObjectsInArray: val];
|
||||
}
|
||||
else
|
||||
objects = GDL2MutableArrayWithCapacity(1);
|
||||
|
||||
[array addObject: objects];
|
||||
|
||||
GDL2AddObjectWithImpPtr(newKeys,&newKeysAO,key);
|
||||
GDL2AddObjectWithImpPtr(newVals,&newValsAO,array);
|
||||
}
|
||||
};
|
||||
|
||||
return [NSDictionary dictionaryWithObjects: newVals forKeys: newKeys];
|
||||
}
|
||||
|
|
|
@ -831,6 +831,8 @@ _mergeValueForKey(id obj, id value,
|
|||
EOGlobalID *tempGID;
|
||||
EOGlobalID *gid = nil;
|
||||
id object = nil;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
IMP userInfoOFK=NULL; // objectForKey:
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -840,11 +842,11 @@ _mergeValueForKey(id obj, id value,
|
|||
NSAssert(_objectsByGID, @"_objectsByGID does not exist!");
|
||||
NSAssert(_globalIDsByObject, @"_globalIDsByObject does not exist!");
|
||||
|
||||
while ((tempGID = [enumerator nextObject]))
|
||||
while ((tempGID = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
EOFLOGObjectLevelArgs(@"EOEditingContext", @"tempGID=%@", tempGID);
|
||||
|
||||
gid = [userInfo objectForKey: tempGID];
|
||||
gid = GDL2ObjectForKeyWithImpPtr(userInfo,&userInfoOFK,tempGID);
|
||||
EOFLOGObjectLevelArgs(@"EOEditingContext", @"gid=%@", gid);
|
||||
|
||||
object = NSMapGet(_objectsByGID, tempGID);
|
||||
|
@ -1492,6 +1494,7 @@ _mergeValueForKey(id obj, id value,
|
|||
EOGlobalID *globalID;
|
||||
id obj;
|
||||
IMP selfGlobalIDForObjectIMP = NULL;
|
||||
IMP currEnumNO=NULL;
|
||||
|
||||
_flags.processingChanges = YES;
|
||||
|
||||
|
@ -1719,7 +1722,8 @@ _mergeValueForKey(id obj, id value,
|
|||
}
|
||||
|
||||
currEnum = [cumulativeChanges objectEnumerator];
|
||||
while ((obj = [currEnum nextObject]))
|
||||
currEnumNO=NULL;
|
||||
while ((obj = GDL2NextObjectWithImpPtr(currEnum,&currEnumNO)))
|
||||
{
|
||||
if ([consolidatedInserts containsObject: obj])
|
||||
{
|
||||
|
@ -1745,7 +1749,8 @@ _mergeValueForKey(id obj, id value,
|
|||
/* Register deleted and changed objects for undo
|
||||
that have not already been registered. */
|
||||
currEnum = [deletedAndChanged objectEnumerator];
|
||||
while ((obj = [currEnum nextObject]))
|
||||
currEnumNO=NULL;
|
||||
while ((obj = GDL2NextObjectWithImpPtr(currEnum,&currEnumNO)))
|
||||
{
|
||||
[self registerUndoForModifiedObject: obj];
|
||||
}
|
||||
|
@ -2440,6 +2445,7 @@ _mergeValueForKey(id obj, id value,
|
|||
NSEnumerator *enumerator = nil;
|
||||
id object = nil;
|
||||
int which;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -2463,7 +2469,8 @@ _mergeValueForKey(id obj, id value,
|
|||
}
|
||||
|
||||
enumerator = [NSAllHashTableObjects(_deletedObjects) objectEnumerator];
|
||||
while ((object = [enumerator nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((object = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
[self forgetObject: object];
|
||||
[object clearProperties];
|
||||
|
@ -2477,10 +2484,11 @@ _mergeValueForKey(id obj, id value,
|
|||
{
|
||||
EOGlobalID *gid=nil;
|
||||
IMP objectForGlobalIDIMP=NULL;
|
||||
IMP enumNO=NO;
|
||||
|
||||
enumerator = [[_snapshotsByGID allKeys] objectEnumerator];
|
||||
|
||||
while ((gid = [enumerator nextObject]))
|
||||
while ((gid = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
id ofgid=EOEditingContext_objectForGlobalIDWithImpPtr(self,&objectForGlobalIDIMP,gid);
|
||||
id snapshot=[ofgid snapshot];
|
||||
|
@ -2516,6 +2524,7 @@ _mergeValueForKey(id obj, id value,
|
|||
|
||||
NS_DURING
|
||||
{
|
||||
IMP enumNO=NULL; // nextObject
|
||||
EOFLOGObjectLevelArgs(@"EOEditingContext", @"Unprocessed: %@",
|
||||
[self unprocessedDescription]);
|
||||
EOFLOGObjectLevelArgs(@"EOEditingContext", @"Objects: %@",
|
||||
|
@ -2523,7 +2532,7 @@ _mergeValueForKey(id obj, id value,
|
|||
|
||||
enumerator = [_editors objectEnumerator];
|
||||
|
||||
while ((object = [enumerator nextObject]))
|
||||
while ((object = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
[object editingContextWillSaveChanges: self];
|
||||
|
||||
if (_delegateRespondsTo.willSaveChanges)
|
||||
|
@ -2608,9 +2617,10 @@ _mergeValueForKey(id obj, id value,
|
|||
NSEnumerator *enumerator;
|
||||
EOGlobalID *gid=nil;
|
||||
IMP objectForGlobalIDIMP=NULL;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
enumerator = [_eventSnapshotsByGID keyEnumerator];
|
||||
while ((gid = [enumerator nextObject]))
|
||||
while ((gid = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
id ofgid=EOEditingContext_objectForGlobalIDWithImpPtr(self,&objectForGlobalIDIMP,gid);
|
||||
[ofgid updateFromSnapshot: [_eventSnapshotsByGID objectForKey: gid]];
|
||||
|
@ -3075,6 +3085,7 @@ modified state of the object.**/
|
|||
NSEnumerator *objsEnum;
|
||||
id obj = nil;
|
||||
IMP globalIDForObjectIMP=NULL;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
[self processRecentChanges];
|
||||
|
||||
|
@ -3086,7 +3097,7 @@ modified state of the object.**/
|
|||
|
||||
objsEnum = [objs objectEnumerator];
|
||||
|
||||
while ((obj = [objsEnum nextObject]))
|
||||
while ((obj = GDL2NextObjectWithImpPtr(objsEnum,&enumNO)))
|
||||
{
|
||||
EOGlobalID* gid=EOEditingContext_globalIDForObjectWithImpPtr(self,&globalIDForObjectIMP,obj);
|
||||
[self refaultObject: obj
|
||||
|
@ -3352,11 +3363,13 @@ modified state of the object.**/
|
|||
id object, localObject;
|
||||
IMP objectForGlobalIDIMP=NULL;
|
||||
IMP globalIDForObjectIMP=NULL;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
objects = [context insertedObjects];
|
||||
|
||||
objsEnum = [objects objectEnumerator];
|
||||
while ((object = [objsEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((object = GDL2NextObjectWithImpPtr(objsEnum,&enumNO)))
|
||||
{
|
||||
gid=EOEditingContext_globalIDForObjectWithImpPtr(context,&globalIDForObjectIMP,object);
|
||||
|
||||
|
@ -3376,7 +3389,8 @@ modified state of the object.**/
|
|||
objects = [context updatedObjects];
|
||||
|
||||
objsEnum = [objects objectEnumerator];
|
||||
while ((object = [objsEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((object = GDL2NextObjectWithImpPtr(objsEnum,&enumNO)))
|
||||
{
|
||||
gid=EOEditingContext_globalIDForObjectWithImpPtr(context,&globalIDForObjectIMP,object);
|
||||
localObject = EOEditingContext_objectForGlobalIDWithImpPtr(self,&objectForGlobalIDIMP,gid);
|
||||
|
@ -3387,7 +3401,8 @@ modified state of the object.**/
|
|||
objects = [context deletedObjects];
|
||||
|
||||
objsEnum = [objects objectEnumerator];
|
||||
while ((object = [objsEnum nextObject]))
|
||||
enumNO=NULL;
|
||||
while ((object = GDL2NextObjectWithImpPtr(objsEnum,&enumNO)))
|
||||
{
|
||||
gid=EOEditingContext_globalIDForObjectWithImpPtr(context,&globalIDForObjectIMP,object);
|
||||
localObject = EOEditingContext_objectForGlobalIDWithImpPtr(self,&objectForGlobalIDIMP,gid);
|
||||
|
|
|
@ -1033,25 +1033,25 @@ infinite loop in description **/
|
|||
NSString *key = nil;
|
||||
id obj = nil;
|
||||
IMP ofkIMP=NULL;
|
||||
IMP enumNO=NULL;
|
||||
IMP dictSOFK=NULL;
|
||||
|
||||
toManyKeys = [classDescription toManyRelationshipKeys];
|
||||
toOneKeys = [classDescription toOneRelationshipKeys];
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: [dictionary count]];
|
||||
|
||||
while ((key = [enumerator nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
obj = EOMKKD_objectForKeyWithImpPtr(dictionary,&ofkIMP,key);
|
||||
if (!obj)
|
||||
[dict setObject: @"(null)"
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,@"(null)",key);
|
||||
else
|
||||
{
|
||||
// print out only simple values
|
||||
if ([toManyKeys containsObject: key] == NO
|
||||
&& [toOneKeys containsObject: key] == NO)
|
||||
{
|
||||
[dict setObject: obj
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,obj,key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1072,27 +1072,29 @@ infinite loop in description **/
|
|||
NSString *key = nil;
|
||||
id obj = nil;
|
||||
IMP ofkIMP=NULL;
|
||||
IMP enumNO=NULL;
|
||||
IMP dictSOFK=NULL;
|
||||
|
||||
toManyKeys = [classDescription toManyRelationshipKeys];
|
||||
toOneKeys = [classDescription toOneRelationshipKeys];
|
||||
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: [dictionary count]];
|
||||
|
||||
while ((key = [enumerator nextObject]))
|
||||
while ((key = GDL2NextObjectWithImpPtr(enumerator,&enumNO)))
|
||||
{
|
||||
obj = EOMKKD_objectForKeyWithImpPtr(dictionary,&ofkIMP,key);
|
||||
|
||||
if (!obj)
|
||||
[dict setObject: @"(null)"
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,@"(null)",key);
|
||||
else if (_isFault(obj) == YES)
|
||||
{
|
||||
[dict setObject: [obj description]
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,
|
||||
[obj description],key);
|
||||
}
|
||||
else if (obj==GDL2EONull)
|
||||
[dict setObject: @"(null)"
|
||||
forKey: key];
|
||||
{
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,@"(null)",key);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([toManyKeys containsObject: key] != NO)
|
||||
|
@ -1100,11 +1102,13 @@ infinite loop in description **/
|
|||
NSEnumerator *toManyEnum;
|
||||
NSMutableArray *array;
|
||||
id rel;
|
||||
IMP toManyEnumNO=NULL;
|
||||
IMP arrayAO=NULL;
|
||||
|
||||
array = [NSMutableArray arrayWithCapacity: 8];
|
||||
array = GDL2MutableArrayWithCapacity(8);
|
||||
toManyEnum = [obj objectEnumerator];
|
||||
|
||||
while ((rel = [toManyEnum nextObject]))
|
||||
while ((rel = GDL2NextObjectWithImpPtr(toManyEnum,&toManyEnumNO)))
|
||||
{
|
||||
NSString* relDescr=nil;
|
||||
// Avoid infinit loop
|
||||
|
@ -1113,30 +1117,31 @@ infinite loop in description **/
|
|||
else
|
||||
relDescr=[rel description];
|
||||
|
||||
[array addObject:
|
||||
[NSString
|
||||
stringWithFormat: @"<%@ %p>",
|
||||
relDescr, NSStringFromClass([rel class])]];
|
||||
GDL2AddObjectWithImpPtr(array,&arrayAO,
|
||||
[NSString
|
||||
stringWithFormat: @"<%@ %p>",
|
||||
relDescr, NSStringFromClass([rel class])]);
|
||||
}
|
||||
|
||||
[dict setObject: [NSString stringWithFormat:
|
||||
@"<%p %@ : %@>",
|
||||
obj, [obj class], array]
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,
|
||||
[NSString stringWithFormat:
|
||||
@"<%p %@ : %@>",
|
||||
obj, [obj class], array],
|
||||
key);
|
||||
}
|
||||
else if ([toOneKeys containsObject: key] != NO)
|
||||
{
|
||||
[dict setObject: [NSString
|
||||
stringWithFormat: @"<%p %@: classDescription=%@>",
|
||||
obj,
|
||||
NSStringFromClass([obj class]),
|
||||
[(EOGenericRecord *)obj classDescription]]
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,
|
||||
[NSString
|
||||
stringWithFormat: @"<%p %@: classDescription=%@>",
|
||||
obj,
|
||||
NSStringFromClass([obj class]),
|
||||
[(EOGenericRecord *)obj classDescription]],
|
||||
key);
|
||||
}
|
||||
else
|
||||
{
|
||||
[dict setObject: obj
|
||||
forKey: key];
|
||||
GDL2SetObjectForKeyWithImpPtr(dict,&dictSOFK,obj,key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,13 @@
|
|||
|
||||
typedef unsigned int (*GDL2IMP_UINT)(id, SEL, ...);
|
||||
typedef BOOL (*GDL2IMP_BOOL)(id, SEL, ...);
|
||||
typedef NSStringEncoding (*GDL2IMP_NSStringEncoding)(id, SEL, ...);
|
||||
|
||||
// ==== Classes ====
|
||||
GDL2CONTROL_EXPORT Class GDL2NSArrayClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2NSMutableArrayClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2NSDictionaryClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2NSMutableDictionaryClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2NSStringClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2NSNumberClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2NSDecimalNumberClass;
|
||||
|
@ -49,38 +55,72 @@ GDL2CONTROL_EXPORT Class GDL2EODatabaseContextClass;
|
|||
GDL2CONTROL_EXPORT Class GDL2EOEditingContextClass;
|
||||
GDL2CONTROL_EXPORT Class GDL2EOAttributeClass;
|
||||
|
||||
// ==== Selectors ====
|
||||
GDL2CONTROL_EXPORT SEL GDL2_newSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_allocWithZoneSEL;
|
||||
|
||||
// ---- String Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_isEqualToStringSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_appendStringSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_stringWithCString_lengthSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_stringWithCStringSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_defaultCStringEncodingSEL;
|
||||
|
||||
// ---- Data Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_dataWithBytes_lengthSEL;
|
||||
|
||||
// ---- Array Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_addObjectSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_objectAtIndexSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_indexOfObjectIdenticalToSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_lastObjectSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_arrayWithCapacitySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_arrayWithArraySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_arraySEL;
|
||||
|
||||
// ---- Enumerator Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_nextObjectSEL;
|
||||
|
||||
// ---- KVC Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_storedValueForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_takeStoredValueForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_valueForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_takeValueForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_validateValueForKeySEL;
|
||||
|
||||
// ---- GDL2 Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_snapshotForGlobalIDSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_objectForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_setObjectForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_removeObjectForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_respondsToSelectorSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_hasKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_indexForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_snapshotForGlobalIDSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_recordObjectGlobalIDSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_objectForGlobalIDSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_globalIDForObjectSEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2__globalIDForObjectSEL;
|
||||
|
||||
// ---- Dictionary Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_objectForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_setObjectForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_removeObjectForKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_dictionaryWithCapacitySEL;
|
||||
|
||||
// ---- NSObject Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_respondsToSelectorSEL;
|
||||
|
||||
// ---- KMKKD Selectors ----
|
||||
GDL2CONTROL_EXPORT SEL GDL2_hasKeySEL;
|
||||
GDL2CONTROL_EXPORT SEL GDL2_indexForKeySEL;
|
||||
|
||||
// ==== IMPs ====
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSAutoreleasePool_newIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSNumber_allocWithZoneIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSDecimalNumber_allocWithZoneIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSString_allocWithZoneIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSCalendarDate_allocWithZoneIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSData_allocWithZoneIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSData_dataWithBytes_lengthIMP;
|
||||
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSString_stringWithCString_lengthIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSString_stringWithCStringIMP;
|
||||
GDL2CONTROL_EXPORT GDL2IMP_NSStringEncoding GDL2NSString_defaultCStringEncodingIMP;
|
||||
|
||||
GDL2CONTROL_EXPORT IMP GDL2MKKD_objectForKeyIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2MKKD_setObjectForKeyIMP;
|
||||
|
@ -95,13 +135,25 @@ GDL2CONTROL_EXPORT IMP GDL2EOEditingContext_recordObjectGlobalIDIMP;
|
|||
GDL2CONTROL_EXPORT IMP GDL2EOEditingContext_objectForGlobalIDIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2EOEditingContext_globalIDForObjectIMP;
|
||||
|
||||
GDL2CONTROL_EXPORT IMP GDL2EODatabaseContext__globalIDForObjectIMP;
|
||||
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSMutableArray_arrayWithCapacityIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSMutableArray_arrayWithArrayIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSMutableArray_arrayIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSArray_arrayIMP;
|
||||
GDL2CONTROL_EXPORT IMP GDL2NSMutableDictionary_dictionaryWithCapacityIMP;
|
||||
|
||||
// ==== Constants ====
|
||||
GDL2CONTROL_EXPORT NSNumber* GDL2NSNumberBool_Yes;
|
||||
GDL2CONTROL_EXPORT NSNumber* GDL2NSNumberBool_No;
|
||||
GDL2CONTROL_EXPORT EONull* GDL2EONull;
|
||||
GDL2CONTROL_EXPORT NSCharacterSet* GDL2_shellPatternCharacterSet;
|
||||
|
||||
// ==== Init Method ====
|
||||
GDL2CONTROL_EXPORT void GDL2PrivInit();
|
||||
|
||||
// ==== IMP Helpers ====
|
||||
|
||||
#define _isNilOrEONull(v) \
|
||||
(isNilOrEONull(v))
|
||||
|
||||
|
@ -111,53 +163,264 @@ GDL2CONTROL_EXPORT void GDL2PrivInit();
|
|||
#define _isFault(v) \
|
||||
(((v)==nil) ? NO : ((((EOFault*)(v))->isa == GDL2EOFaultClass) ? YES : NO))
|
||||
|
||||
// ---- NSMutableString appendString: ----
|
||||
#define GDL2AppendStringWithImp(string,methodIMP,aString) \
|
||||
(*(methodIMP))((string),GDL2_appendStringSEL,(aString))
|
||||
|
||||
static inline void GDL2AppendStringWithImpPtr(NSMutableString* object,IMP* impPtr,NSString* string)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_appendStringSEL];
|
||||
(**impPtr)(object,GDL2_appendStringSEL,string);
|
||||
};
|
||||
};
|
||||
|
||||
// ---- NSMutableArray addObject: ----
|
||||
#define GDL2AddObjectWithImp(array,methodIMP,anObject) \
|
||||
(*(methodIMP))((array),GDL2_addObjectSEL,(anObject))
|
||||
|
||||
static inline void GDL2AddObjectWithImpPtr(id object,IMP* impPtr,id objectToAdd)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_addObjectSEL];
|
||||
(**impPtr)(object,GDL2_addObjectSEL,objectToAdd);
|
||||
};
|
||||
};
|
||||
|
||||
// ---- NSArray objectAtIndex: ----
|
||||
#define GDL2ObjectAtIndexWithImp(array,methodIMP,index) \
|
||||
(*(methodIMP))((array),GDL2_objectAtIndexSEL,(index))
|
||||
|
||||
static inline id GDL2ObjectAtIndexWithImpPtr(id object,IMP* impPtr,int index)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_objectAtIndexSEL];
|
||||
return (**impPtr)(object,GDL2_objectAtIndexSEL,index);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- NSArray indexOfObjectIdenticalTo: ----
|
||||
#define GDL2IndexOfObjectIdenticalToWithImp(array,methodIMP,anObject) \
|
||||
(*(methodIMP))((array),GDL2_indexOfObjectIdenticalToSEL,(anObject))
|
||||
|
||||
#define GDL2NextObjectWithImp(enumerator,methodIMP) \
|
||||
(*(methodIMP))((array),GDL2_nextObjectSEL)
|
||||
|
||||
// ---- NSArray lastObject ----
|
||||
#define GDL2LastObjectWithImp(array,methodIMP) \
|
||||
(*(methodIMP))((array),GDL2_lastObjectSEL)
|
||||
|
||||
static inline id GDL2LastObjectWithImpPtr(id object,IMP* impPtr)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_lastObjectSEL];
|
||||
return (**impPtr)(object,GDL2_lastObjectSEL);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- NSEnumerator nextObject ----
|
||||
#define GDL2NextObjectWithImp(enumerator,methodIMP) \
|
||||
(*(methodIMP))((enumerator),GDL2_nextObjectSEL)
|
||||
|
||||
static inline id GDL2NextObjectWithImpPtr(id object,IMP* impPtr)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_nextObjectSEL];
|
||||
return (**impPtr)(object,GDL2_nextObjectSEL);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- KVC storedValueForKey: ----
|
||||
#define GDL2StoredValueForKeyWithImp(object,methodIMP,value,key) \
|
||||
(*methodIMP)((object),GDL2_storedValueForKeySEL,value,key)
|
||||
|
||||
static inline id GDL2StoredValueForKeyWithImpPtr(id object,IMP* impPtr,id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_storedValueForKeySEL];
|
||||
return (**impPtr)(object,GDL2_storedValueForKeySEL,key);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- KVC takeStoredValue:forKey: ----
|
||||
#define GDL2TakeStoredValueForKeyWithImp(object,methodIMP,value,key) \
|
||||
(*methodIMP)((object),GDL2_takeStoredValueForKeySEL,value,key)
|
||||
|
||||
static inline void GDL2TakeStoredValueForKeyWithImpPtr(id object,IMP* impPtr,id value, id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_takeStoredValueForKeySEL];
|
||||
(**impPtr)(object,GDL2_takeStoredValueForKeySEL,value,key);
|
||||
};
|
||||
};
|
||||
|
||||
// ---- KVC valueForKey: ----
|
||||
#define GDL2ValueForKeyWithImp(object,methodIMP,value,key) \
|
||||
(*methodIMP)((object),GDL2_valueForKeySEL,value,key)
|
||||
|
||||
static inline id GDL2ValueForKeyWithImpPtr(id object,IMP* impPtr,id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_valueForKeySEL];
|
||||
return (**impPtr)(object,GDL2_valueForKeySEL,key);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- KVC takeValue:forKey: ----
|
||||
#define GDL2TakeValueForKeyWithImp(object,methodIMP,value,key) \
|
||||
(*methodIMP)((object),GDL2_takeValueForKeySEL,value,key)
|
||||
|
||||
static inline void GDL2TakeValueForKeyWithImpPtr(id object,IMP* impPtr,id value, id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_takeValueForKeySEL];
|
||||
(**impPtr)(object,GDL2_takeValueForKeySEL,value,key);
|
||||
};
|
||||
};
|
||||
|
||||
// ---- KVC validateValue:forKey: ----
|
||||
#define GDL2ValidateValueForKeyWithImp(object,methodIMP,valuePtr,key) \
|
||||
(*methodIMP)((object),GDL2_validateValueForKeySEL,valuePtr,key)
|
||||
|
||||
static inline id GDL2ValidateValueForKeyWithImpPtr(id object,IMP* impPtr,id* valuePtr,id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_validateValueForKeySEL];
|
||||
return (**impPtr)(object,GDL2_validateValueForKeySEL,valuePtr,key);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- Dictionary objectForKey: ----
|
||||
#define GDL2ObjectForKeyWithImp(object,methodIMP,value,key) \
|
||||
(*methodIMP)((object),GDL2_objectForKeySEL,value,key)
|
||||
|
||||
static inline id GDL2ObjectForKeyWithImpPtr(id object,IMP* impPtr,id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_objectForKeySEL];
|
||||
return (**impPtr)(object,GDL2_objectForKeySEL,key);
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
};
|
||||
|
||||
// ---- Dictionary setObject:forKey: ----
|
||||
#define GDL2SetObjectForKeyWithImp(object,methodIMP,value,key) \
|
||||
(*methodIMP)((object),GDL2_setObjectForKeySEL,value,key)
|
||||
|
||||
static inline void GDL2SetObjectForKeyWithImpPtr(id object,IMP* impPtr,id value, id key)
|
||||
{
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=[object methodForSelector:GDL2_setObjectForKeySEL];
|
||||
(**impPtr)(object,GDL2_setObjectForKeySEL,value,key);
|
||||
}
|
||||
};
|
||||
|
||||
// ---- NSString stringWithCString:length: ----
|
||||
#define GDL2StringWithCStringAndLength(cString,length) \
|
||||
(*GDL2NSString_stringWithCString_lengthIMP)(GDL2NSStringClass,GDL2_stringWithCString_lengthSEL,(const char*)(cString),(int)(length))
|
||||
|
||||
// ---- NSString stringWithCString: ----
|
||||
#define GDL2StringWithCString(cString) \
|
||||
(*GDL2NSString_stringWithCStringIMP)(GDL2NSStringClass,GDL2_stringWithCStringSEL,(const char*)(cString))
|
||||
|
||||
// ---- NSString +defaultCStringEncoding ----
|
||||
#define GDL2StringDefaultCStringEncoding() \
|
||||
(*GDL2NSString_defaultCStringEncodingIMP)(GDL2NSStringClass,GDL2_defaultCStringEncodingSEL)
|
||||
|
||||
// ---- NSAutoreleasePool +new ----
|
||||
#define GDL2NSAutoreleasePool_new() \
|
||||
(*GDL2NSAutoreleasePool_newIMP)(GDL2NSAutoreleasePoolClass,GDL2_newSEL)
|
||||
|
||||
// ---- NSString +alloc ----
|
||||
#define GDL2NSString_alloc() \
|
||||
(*GDL2NSString_allocWithZoneIMP)(GDL2NSStringClass,GDL2_allocWithZoneSEL,NULL)
|
||||
|
||||
// ---- NSDecimalNumber +alloc ----
|
||||
#define GDL2NSDecimalNumber_alloc() \
|
||||
(*GDL2NSDecimalNumber_allocWithZoneIMP)(GDL2NSDecimalNumberClass,GDL2_allocWithZoneSEL,NULL)
|
||||
|
||||
// ---- NSNumber +alloc ----
|
||||
#define GDL2NSNumber_alloc() \
|
||||
(*GDL2NSNumber_allocWithZoneIMP)(GDL2NSNumberClass,GDL2_allocWithZoneSEL,NULL)
|
||||
|
||||
// ---- NSCalendarDate +alloc ----
|
||||
#define GDL2NSCalendarDate_alloc() \
|
||||
(*GDL2NSCalendarDate_allocWithZoneIMP)(GDL2NSCalendarDateClass,GDL2_allocWithZoneSEL,NULL)
|
||||
|
||||
// ---- NSData +alloc ----
|
||||
#define GDL2NSData_alloc() \
|
||||
(*GDL2NSData_allocWithZoneIMP)(GDL2NSDataClass,GDL2_allocWithZoneSEL,NULL)
|
||||
|
||||
// ---- NSData dataWithBytes:length: ----
|
||||
#define GDL2DataWithBytesAndLength(bytes,length) \
|
||||
(*GDL2NSData_dataWithBytes_lengthIMP)(GDL2NSDataClass,GDL2_dataWithBytes_lengthSEL,(const void*)(bytes),(int)(length))
|
||||
|
||||
// ---- NSMutableArray +arrayWithCapacity: ----
|
||||
#define GDL2MutableArrayWithCapacity(capacity) \
|
||||
(*GDL2NSMutableArray_arrayWithCapacityIMP)(GDL2NSMutableArrayClass,GDL2_arrayWithCapacitySEL,capacity)
|
||||
|
||||
// ---- NSMutableArray +arrayWithArray: ----
|
||||
#define GDL2MutableArrayWithArray(array) \
|
||||
(*GDL2NSMutableArray_arrayWithArrayIMP)(GDL2NSMutableArrayClass,GDL2_arrayWithArraySEL,array)
|
||||
|
||||
// ---- NSMutableArray +array ----
|
||||
#define GDL2MutableArray() \
|
||||
(*GDL2NSMutableArray_arrayIMP)(GDL2NSMutableArrayClass,GDL2_arraySEL)
|
||||
|
||||
// ---- NSArray +array ----
|
||||
#define GDL2Array() \
|
||||
(*GDL2NSArray_arrayIMP)(GDL2NSArrayClass,GDL2_arraySEL)
|
||||
|
||||
// ---- NSMutableDictionary +dictionaryWithCapacity: ----
|
||||
#define GDL2MutableDictionaryWithCapacity(capacity) \
|
||||
(*GDL2NSMutableDictionary_dictionaryWithCapacityIMP)(GDL2NSMutableDictionaryClass,GDL2_dictionaryWithCapacitySEL,capacity)
|
||||
|
||||
// ---- NSObject respondsToSelector: ----
|
||||
static inline BOOL GDL2RespondsToSelectorWithImpPtr(id object,GDL2IMP_BOOL* impPtr,SEL sel)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=(GDL2IMP_BOOL)[object methodForSelector:GDL2_respondsToSelectorSEL];
|
||||
return (**impPtr)(object,GDL2_respondsToSelectorSEL,sel);
|
||||
if (object)
|
||||
{
|
||||
if (!*impPtr)
|
||||
*impPtr=(GDL2IMP_BOOL)[object methodForSelector:GDL2_respondsToSelectorSEL];
|
||||
return (**impPtr)(object,GDL2_respondsToSelectorSEL,sel);
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
};
|
||||
|
||||
#endif /* __EOPriv_h__ */
|
||||
|
|
|
@ -46,6 +46,11 @@ RCS_ID("$Id$")
|
|||
#include <EOControl/EOMutableKnownKeyDictionary.h>
|
||||
#include <EOAccess/EODatabaseContext.h>
|
||||
|
||||
// ==== Classes ====
|
||||
Class GDL2NSArrayClass=Nil;
|
||||
Class GDL2NSMutableArrayClass=Nil;
|
||||
Class GDL2NSDictionaryClass=Nil;
|
||||
Class GDL2NSMutableDictionaryClass=Nil;
|
||||
Class GDL2NSStringClass=Nil;
|
||||
Class GDL2NSNumberClass=Nil;
|
||||
Class GDL2NSDecimalNumberClass=Nil;
|
||||
|
@ -60,38 +65,71 @@ Class GDL2EODatabaseContextClass=Nil;
|
|||
Class GDL2EOEditingContextClass=Nil;
|
||||
Class GDL2EOAttributeClass=Nil;
|
||||
|
||||
// ==== Selectors ====
|
||||
SEL GDL2_newSEL=NULL;
|
||||
SEL GDL2_allocWithZoneSEL=NULL;
|
||||
|
||||
// ---- String Selectors ----
|
||||
SEL GDL2_isEqualToStringSEL=NULL;
|
||||
SEL GDL2_appendStringSEL=NULL;
|
||||
SEL GDL2_stringWithCString_lengthSEL=NULL;
|
||||
SEL GDL2_stringWithCStringSEL=NULL;
|
||||
SEL GDL2_defaultCStringEncodingSEL=NULL;
|
||||
|
||||
// ---- Data Selectors ----
|
||||
SEL GDL2_dataWithBytes_lengthSEL=NULL;
|
||||
|
||||
// ---- Array Selectors ----
|
||||
SEL GDL2_addObjectSEL=NULL;
|
||||
SEL GDL2_objectAtIndexSEL=NULL;
|
||||
SEL GDL2_indexOfObjectIdenticalToSEL=NULL;
|
||||
SEL GDL2_nextObjectSEL=NULL;
|
||||
SEL GDL2_takeStoredValueForKeySEL=NULL;
|
||||
SEL GDL2_snapshotForGlobalIDSEL=NULL;
|
||||
SEL GDL2_objectForKeySEL=NULL;
|
||||
SEL GDL2_respondsToSelectorSEL=NULL;
|
||||
SEL GDL2_setObjectForKeySEL=NULL;
|
||||
SEL GDL2_removeObjectForKeySEL=NULL;
|
||||
SEL GDL2_hasKeySEL=NULL;
|
||||
SEL GDL2_indexForKeySEL=NULL;
|
||||
SEL GDL2_lastObjectSEL=NULL;
|
||||
SEL GDL2_arrayWithCapacitySEL=NULL;
|
||||
SEL GDL2_arrayWithArraySEL=NULL;
|
||||
SEL GDL2_arraySEL=NULL;
|
||||
|
||||
// ---- Enumerator Selectors ----
|
||||
SEL GDL2_nextObjectSEL=NULL;
|
||||
|
||||
// ---- KVC Selectors ----
|
||||
SEL GDL2_storedValueForKeySEL=NULL;
|
||||
SEL GDL2_takeStoredValueForKeySEL=NULL;
|
||||
SEL GDL2_valueForKeySEL=NULL;
|
||||
SEL GDL2_takeValueForKeySEL=NULL;
|
||||
SEL GDL2_validateValueForKeySEL=NULL;
|
||||
|
||||
// ---- GDL2 Selectors ----
|
||||
SEL GDL2_snapshotForGlobalIDSEL=NULL;
|
||||
SEL GDL2_recordObjectGlobalIDSEL=NULL;
|
||||
SEL GDL2_objectForGlobalIDSEL=NULL;
|
||||
SEL GDL2_globalIDForObjectSEL=NULL;
|
||||
SEL GDL2__globalIDForObjectSEL=NULL;
|
||||
|
||||
// ---- Dictionary Selectors ----
|
||||
SEL GDL2_objectForKeySEL=NULL;
|
||||
SEL GDL2_setObjectForKeySEL=NULL;
|
||||
SEL GDL2_removeObjectForKeySEL=NULL;
|
||||
SEL GDL2_dictionaryWithCapacitySEL=NULL;
|
||||
|
||||
// ---- NSObject Selectors ----
|
||||
SEL GDL2_respondsToSelectorSEL=NULL;
|
||||
|
||||
// ---- KMKKD Selectors ----
|
||||
SEL GDL2_hasKeySEL=NULL;
|
||||
SEL GDL2_indexForKeySEL=NULL;
|
||||
|
||||
// ==== IMPs ====
|
||||
IMP GDL2NSAutoreleasePool_newIMP=NULL;
|
||||
IMP GDL2NSNumber_allocWithZoneIMP=NULL;
|
||||
IMP GDL2NSDecimalNumber_allocWithZoneIMP=NULL;
|
||||
IMP GDL2NSString_allocWithZoneIMP=NULL;
|
||||
IMP GDL2NSCalendarDate_allocWithZoneIMP=NULL;
|
||||
IMP GDL2NSData_allocWithZoneIMP=NULL;
|
||||
IMP GDL2NSData_dataWithBytes_lengthIMP=NULL;
|
||||
|
||||
IMP GDL2NSString_stringWithCString_lengthIMP=NULL;
|
||||
IMP GDL2NSString_stringWithCStringIMP=NULL;
|
||||
GDL2IMP_NSStringEncoding GDL2NSString_defaultCStringEncodingIMP=NULL;
|
||||
|
||||
IMP GDL2MKKD_objectForKeyIMP=NULL;
|
||||
IMP GDL2MKKD_setObjectForKeyIMP=NULL;
|
||||
|
@ -105,6 +143,16 @@ IMP GDL2EOEditingContext_recordObjectGlobalIDIMP=NULL;
|
|||
IMP GDL2EOEditingContext_objectForGlobalIDIMP=NULL;
|
||||
IMP GDL2EOEditingContext_globalIDForObjectIMP=NULL;
|
||||
|
||||
IMP GDL2EODatabaseContext__globalIDForObjectIMP=NULL;
|
||||
|
||||
IMP GDL2NSMutableArray_arrayWithCapacityIMP=NULL;
|
||||
IMP GDL2NSMutableArray_arrayWithArrayIMP=NULL;
|
||||
IMP GDL2NSMutableArray_arrayIMP=NULL;
|
||||
IMP GDL2NSArray_arrayIMP=NULL;
|
||||
|
||||
IMP GDL2NSMutableDictionary_dictionaryWithCapacityIMP=NULL;
|
||||
|
||||
// ==== Constants ====
|
||||
NSNumber* GDL2NSNumberBool_Yes=nil;
|
||||
NSNumber* GDL2NSNumberBool_No=nil;
|
||||
|
||||
|
@ -112,12 +160,17 @@ EONull* GDL2EONull=nil;
|
|||
|
||||
NSCharacterSet* GDL2_shellPatternCharacterSet=nil;
|
||||
|
||||
|
||||
// ==== Init Method ====
|
||||
void GDL2PrivInit()
|
||||
{
|
||||
static BOOL initialized=NO;
|
||||
if (!initialized)
|
||||
{
|
||||
// ==== Classes ====
|
||||
GDL2NSArrayClass=[NSArray class];
|
||||
GDL2NSMutableArrayClass=[NSMutableArray class];
|
||||
GDL2NSDictionaryClass=[NSDictionary class];
|
||||
GDL2NSMutableDictionaryClass=[NSMutableDictionary class];
|
||||
GDL2NSStringClass=[NSString class];
|
||||
GDL2NSNumberClass=[NSNumber class];
|
||||
GDL2NSDecimalNumberClass=[NSDecimalNumber class];
|
||||
|
@ -132,46 +185,81 @@ void GDL2PrivInit()
|
|||
GDL2EOEditingContextClass = [EOEditingContext class];
|
||||
GDL2EOAttributeClass = [EOAttribute class];
|
||||
|
||||
// ==== Selectors ====
|
||||
GDL2_newSEL=@selector(new);
|
||||
GDL2_allocWithZoneSEL=@selector(alloc);
|
||||
|
||||
// ---- String Selectors ----
|
||||
GDL2_isEqualToStringSEL=@selector(isEqualToString:);
|
||||
GDL2_appendStringSEL=@selector(appendString:);
|
||||
GDL2_stringWithCString_lengthSEL=@selector(stringWithCString:length:);
|
||||
GDL2_stringWithCStringSEL=@selector(stringWithCString:);
|
||||
GDL2_defaultCStringEncodingSEL=@selector(defaultCStringEncoding);
|
||||
|
||||
// ---- Data Selectors ----
|
||||
GDL2_dataWithBytes_lengthSEL=@selector(dataWithBytes:length:);
|
||||
|
||||
// ---- Array Selectors ----
|
||||
GDL2_addObjectSEL=@selector(addObject:);
|
||||
GDL2_objectAtIndexSEL=@selector(objectAtIndex:);
|
||||
GDL2_indexOfObjectIdenticalToSEL=@selector(indexOfObjectIdenticalTo:);
|
||||
GDL2_lastObjectSEL=@selector(lastObject);
|
||||
GDL2_arrayWithCapacitySEL=@selector(arrayWithCapacity:);
|
||||
GDL2_arrayWithArraySEL=@selector(arrayWithArray:);
|
||||
GDL2_arraySEL=@selector(array);
|
||||
|
||||
// ---- Enumerator Selectors ----
|
||||
GDL2_nextObjectSEL=@selector(nextObject);
|
||||
|
||||
// ---- KVC Selectors ----
|
||||
GDL2_storedValueForKeySEL=@selector(storedValueForKey:);
|
||||
GDL2_takeStoredValueForKeySEL=@selector(takeStoredValue:forKey:);
|
||||
GDL2_valueForKeySEL=@selector(valueForKey:);
|
||||
GDL2_takeValueForKeySEL=@selector(takeValue:forKey:);
|
||||
GDL2_validateValueForKeySEL=@selector(validateValue:forKey:);
|
||||
|
||||
// ---- GDL2 Selectors ----
|
||||
GDL2_snapshotForGlobalIDSEL=@selector(snapshotForGlobalID:);
|
||||
GDL2_objectForKeySEL=@selector(objectForKey:);
|
||||
GDL2_setObjectForKeySEL=@selector(setObject:forKey:);
|
||||
GDL2_removeObjectForKeySEL=@selector(removeObjectForKey:);
|
||||
GDL2_respondsToSelectorSEL=@selector(respondsToSelector:);
|
||||
GDL2_hasKeySEL=@selector(hasKey:);
|
||||
GDL2_indexForKeySEL=@selector(indexForKey:);
|
||||
GDL2_snapshotForGlobalIDSEL=@selector(snapshotForGlobalID:);
|
||||
GDL2_recordObjectGlobalIDSEL=@selector(recordObject:globalID:);
|
||||
GDL2_objectForGlobalIDSEL=@selector(objectForGlobalID:);
|
||||
GDL2_globalIDForObjectSEL=@selector(globalIDForObject:);
|
||||
GDL2__globalIDForObjectSEL=@selector(_globalIDForObject:);
|
||||
|
||||
GDL2NSAutoreleasePool_newIMP=[GDL2NSAutoreleasePoolClass
|
||||
methodForSelector:GDL2_newSEL];
|
||||
// ---- Dictionary Selectors ----
|
||||
GDL2_objectForKeySEL=@selector(objectForKey:);
|
||||
GDL2_setObjectForKeySEL=@selector(setObject:forKey:);
|
||||
GDL2_removeObjectForKeySEL=@selector(removeObjectForKey:);
|
||||
GDL2_dictionaryWithCapacitySEL=@selector(dictionaryWithCapacity:);
|
||||
|
||||
GDL2NSNumber_allocWithZoneIMP=[GDL2NSNumberClass
|
||||
methodForSelector:GDL2_allocWithZoneSEL];
|
||||
// ---- NSObject Selectors ----
|
||||
GDL2_respondsToSelectorSEL=@selector(respondsToSelector:);
|
||||
|
||||
GDL2NSDecimalNumber_allocWithZoneIMP=[GDL2NSDecimalNumberClass
|
||||
methodForSelector:GDL2_allocWithZoneSEL];
|
||||
// ---- KMKKD Selectors ----
|
||||
GDL2_hasKeySEL=@selector(hasKey:);
|
||||
GDL2_indexForKeySEL=@selector(indexForKey:);
|
||||
|
||||
GDL2NSString_allocWithZoneIMP=[GDL2NSStringClass
|
||||
methodForSelector:GDL2_allocWithZoneSEL];
|
||||
// ==== IMPs ====
|
||||
GDL2NSAutoreleasePool_newIMP=
|
||||
[GDL2NSAutoreleasePoolClass methodForSelector:GDL2_newSEL];
|
||||
|
||||
GDL2NSCalendarDate_allocWithZoneIMP=[GDL2NSCalendarDateClass
|
||||
methodForSelector:GDL2_allocWithZoneSEL];
|
||||
GDL2NSNumber_allocWithZoneIMP=
|
||||
[GDL2NSNumberClass methodForSelector:GDL2_allocWithZoneSEL];
|
||||
|
||||
GDL2NSData_allocWithZoneIMP=[GDL2NSDataClass
|
||||
methodForSelector:GDL2_allocWithZoneSEL];
|
||||
GDL2NSDecimalNumber_allocWithZoneIMP=
|
||||
[GDL2NSDecimalNumberClass methodForSelector:GDL2_allocWithZoneSEL];
|
||||
|
||||
GDL2NSString_allocWithZoneIMP=
|
||||
[GDL2NSStringClass methodForSelector:GDL2_allocWithZoneSEL];
|
||||
|
||||
GDL2NSCalendarDate_allocWithZoneIMP=
|
||||
[GDL2NSCalendarDateClass methodForSelector:GDL2_allocWithZoneSEL];
|
||||
|
||||
GDL2NSData_allocWithZoneIMP=
|
||||
[GDL2NSDataClass methodForSelector:GDL2_allocWithZoneSEL];
|
||||
|
||||
GDL2NSData_dataWithBytes_lengthIMP=
|
||||
[GDL2NSDataClass methodForSelector:GDL2_dataWithBytes_lengthSEL];
|
||||
|
||||
GDL2NSString_stringWithCString_lengthIMP=
|
||||
[GDL2NSStringClass methodForSelector:GDL2_stringWithCString_lengthSEL];
|
||||
|
@ -179,6 +267,9 @@ void GDL2PrivInit()
|
|||
GDL2NSString_stringWithCStringIMP=
|
||||
[GDL2NSStringClass methodForSelector:GDL2_stringWithCStringSEL];
|
||||
|
||||
GDL2NSString_defaultCStringEncodingIMP=
|
||||
(GDL2IMP_NSStringEncoding)[GDL2NSStringClass methodForSelector:GDL2_defaultCStringEncodingSEL];
|
||||
|
||||
GDL2MKKD_objectForKeyIMP=[GDL2MKKDClass instanceMethodForSelector:GDL2_objectForKeySEL];
|
||||
GDL2MKKD_setObjectForKeyIMP=[GDL2MKKDClass instanceMethodForSelector:GDL2_setObjectForKeySEL];
|
||||
GDL2MKKD_removeObjectForKeyIMP=[GDL2MKKDClass instanceMethodForSelector:GDL2_removeObjectForKeySEL];
|
||||
|
@ -192,6 +283,24 @@ void GDL2PrivInit()
|
|||
GDL2EOEditingContext_objectForGlobalIDIMP=[GDL2EOEditingContextClass instanceMethodForSelector:GDL2_objectForGlobalIDSEL];
|
||||
GDL2EOEditingContext_globalIDForObjectIMP=[GDL2EOEditingContextClass instanceMethodForSelector:GDL2_globalIDForObjectSEL];
|
||||
|
||||
GDL2EODatabaseContext__globalIDForObjectIMP=[GDL2EODatabaseContextClass instanceMethodForSelector:GDL2__globalIDForObjectSEL];
|
||||
|
||||
GDL2NSMutableArray_arrayWithCapacityIMP=[GDL2NSMutableArrayClass
|
||||
methodForSelector:GDL2_arrayWithCapacitySEL];
|
||||
|
||||
GDL2NSMutableArray_arrayWithArrayIMP=[GDL2NSMutableArrayClass
|
||||
methodForSelector:GDL2_arrayWithArraySEL];
|
||||
|
||||
GDL2NSMutableArray_arrayIMP=[GDL2NSMutableArrayClass
|
||||
methodForSelector:GDL2_arraySEL];
|
||||
|
||||
GDL2NSArray_arrayIMP=[GDL2NSArrayClass
|
||||
methodForSelector:GDL2_arraySEL];
|
||||
|
||||
GDL2NSMutableDictionary_dictionaryWithCapacityIMP=[GDL2NSMutableDictionaryClass
|
||||
methodForSelector:GDL2_dictionaryWithCapacitySEL];
|
||||
|
||||
// ==== Constants ====
|
||||
ASSIGN(GDL2NSNumberBool_Yes,[GDL2NSNumberClass numberWithBool:YES]);
|
||||
ASSIGN(GDL2NSNumberBool_No,[GDL2NSNumberClass numberWithBool:NO]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue