mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 12:55:44 +00:00
2002-12-01 Manuel Guesdon <mguesdon@orange-concept.com>
* EOAccess/EODatabase.m o in -entityForObject: test for EONull or nil instead of just nil * EOAccess/EODatabaseContext.m: o in -valuesForKeys:object: test for EONull or nil instead of just nil * EOControl/EOGenericRecord.m: o replaced GSObjCFindVariable by GSObjCFindInstanceVariable o replaced GSObjCGetValue by GSGetValue o replaced GSObjCSetValue by GSSetValue * EOAccess/EOSQLExpression.m: o changed assertion message in -sqlStringForAttributeNamed: * EOAccess/EOSQLQualifier.m: o finished EOAndQualifier -schemaBasedQualifierWithRootEntity implementation o done EOOrQualifier -schemaBasedQualifierWithRootEntity implementation o modified EOKeyValueQualifier -schemaBasedQualifierWithRootEntity: to use EONull for EONull value relationship attribute value so it will make sql like is null instead of = NULL which doesn't work on Postgresql. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@15189 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
97dec0819e
commit
e20acdf337
6 changed files with 102 additions and 37 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2002-12-01 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* EOAccess/EODatabase.m
|
||||
o in -entityForObject: test for EONull or nil instead of just nil
|
||||
* EOAccess/EODatabaseContext.m:
|
||||
o in -valuesForKeys:object: test for EONull or nil instead of just nil
|
||||
* EOControl/EOGenericRecord.m:
|
||||
o replaced GSObjCFindVariable by GSObjCFindInstanceVariable
|
||||
o replaced GSObjCGetValue by GSGetValue
|
||||
o replaced GSObjCSetValue by GSSetValue
|
||||
* EOAccess/EOSQLExpression.m:
|
||||
o changed assertion message in -sqlStringForAttributeNamed:
|
||||
* EOAccess/EOSQLQualifier.m:
|
||||
o finished EOAndQualifier -schemaBasedQualifierWithRootEntity implementation
|
||||
o done EOOrQualifier -schemaBasedQualifierWithRootEntity implementation
|
||||
o modified EOKeyValueQualifier -schemaBasedQualifierWithRootEntity:
|
||||
to use EONull for EONull value relationship attribute value
|
||||
so it will make sql like is null instead of = NULL which
|
||||
doesn't work on Postgresql.
|
||||
|
||||
2002-11-30 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* EOAccess/EODatabaseContext.m
|
||||
o logs
|
||||
|
|
|
@ -277,7 +277,7 @@ static NSMutableArray *databaseInstances;
|
|||
|
||||
EOFLOGObjectLevelArgs(@"EODatabaseContext", @"object=%p (of class %@)",
|
||||
object, [object class]);
|
||||
NSAssert(object, @"No object");
|
||||
NSAssert(!isNilOrEONull(object), @"No object");
|
||||
|
||||
if ([EOFault isFault: object])
|
||||
{
|
||||
|
|
|
@ -3301,7 +3301,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
|
||||
//NSAssert(object, @"No object");
|
||||
|
||||
if (object)
|
||||
if (!isNilOrEONull(object))
|
||||
{
|
||||
entity = [_database entityForObject: object];
|
||||
|
||||
|
@ -3613,7 +3613,7 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
EOFLOGObjectLevelArgs(@"EODatabaseContext",
|
||||
@"destinationValue=%@", destinationValue);
|
||||
|
||||
if (destinationValue)//?? or always
|
||||
if (!isNilOrEONull(destinationValue))//?? or always
|
||||
[relayedValues setObject: destinationValue
|
||||
forKey: sourceKey];
|
||||
}
|
||||
|
|
|
@ -1530,11 +1530,13 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey";
|
|||
//OK
|
||||
EOAttribute *attribute = nil;
|
||||
NSString *sqlString = nil;
|
||||
NSArray *keyParts;
|
||||
NSArray *keyParts = nil;
|
||||
NSString *key = nil;
|
||||
EOEntity *entity=_entity;
|
||||
NSMutableArray *attributePath = nil;
|
||||
int i, count;
|
||||
EORelationship *rel = nil;
|
||||
|
||||
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
|
@ -1549,8 +1551,6 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey";
|
|||
|
||||
for (i = 0; i < count - 1; i++)
|
||||
{
|
||||
EORelationship *rel;
|
||||
|
||||
key = [keyParts objectAtIndex: i];
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOSQLExpression", @"keyPart=%@", key);
|
||||
|
@ -1580,12 +1580,24 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey";
|
|||
attribute = [entity anyAttributeNamed: key];
|
||||
EOFLOGObjectLevelArgs(@"EOSQLExpression", @"attribute=%@", attribute);
|
||||
|
||||
NSAssert4(attribute,
|
||||
@"no attribute named %@ in entity %@\nAttributesByName=%@\nattributes=%@",
|
||||
key,
|
||||
[entity name],
|
||||
[entity attributesByName],
|
||||
[entity attributes]);
|
||||
if (!attribute)
|
||||
{
|
||||
rel = [entity anyRelationshipNamed: key];
|
||||
if (rel)
|
||||
NSAssert4(attribute,
|
||||
@"no attribute named %@ (only a relationship) in entity %@\nAttributesByName=%@\nattributes=%@",
|
||||
key,
|
||||
[entity name],
|
||||
[entity attributesByName],
|
||||
[entity attributes]);
|
||||
else
|
||||
NSAssert4(attribute,
|
||||
@"no attribute nor relationship named %@ in entity %@\nAttributesByName=%@\nattributes=%@",
|
||||
key,
|
||||
[entity name],
|
||||
[entity attributesByName],
|
||||
[entity attributes]);
|
||||
};
|
||||
|
||||
if (attributePath)
|
||||
{
|
||||
|
|
|
@ -117,7 +117,12 @@ static char rcsId[] = "$Id$";
|
|||
|
||||
- (EOQualifier *)schemaBasedQualifierWithRootEntity: (EOEntity *)entity
|
||||
{
|
||||
int qualifierCount = [_qualifiers count];
|
||||
EOQualifier *returnedQualifier = self;
|
||||
int qualifierCount = 0;
|
||||
BOOL atLeastOneDifferentQualifier = NO; // YES if we find a changed qualifier
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
qualifierCount = [_qualifiers count];
|
||||
|
||||
if (qualifierCount > 0)
|
||||
{
|
||||
|
@ -131,17 +136,19 @@ static char rcsId[] = "$Id$";
|
|||
[(<EOQualifierSQLGeneration>)qualifier
|
||||
schemaBasedQualifierWithRootEntity:
|
||||
entity];
|
||||
|
||||
if (schemaBasedQualifierTmp != qualifier)
|
||||
atLeastOneDifferentQualifier = YES;
|
||||
[qualifiers addObject: schemaBasedQualifierTmp];
|
||||
}
|
||||
|
||||
// If we've found at least a different qualifier, return a new EOAndQualifier
|
||||
if (atLeastOneDifferentQualifier)
|
||||
returnedQualifier = [[self class] qualifierWithQualifierArray:qualifiers];
|
||||
}
|
||||
//TODO
|
||||
/*
|
||||
call schemaBasedQualifierWithRootEntity:entity for each qualifier
|
||||
if none return something different self, return self
|
||||
[self notImplemented:_cmd];//TODO
|
||||
*/
|
||||
return self;
|
||||
|
||||
EOFLOGObjectFnStop();
|
||||
|
||||
return returnedQualifier;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -175,12 +182,38 @@ if none return something different self, return self
|
|||
|
||||
- (EOQualifier *)schemaBasedQualifierWithRootEntity: (EOEntity *)entity
|
||||
{
|
||||
/*
|
||||
call schemaBasedQualifierWithRootEntity:entity for each qualifier
|
||||
if none return something different self, return self
|
||||
[self notImplemented:_cmd];//TODO
|
||||
*/
|
||||
return self;
|
||||
EOQualifier *returnedQualifier = self;
|
||||
int qualifierCount = 0;
|
||||
BOOL atLeastOneDifferentQualifier = NO; // YES if we find a changed qualifier
|
||||
EOFLOGObjectFnStart();
|
||||
|
||||
qualifierCount = [_qualifiers count];
|
||||
|
||||
if (qualifierCount > 0)
|
||||
{
|
||||
NSMutableArray *qualifiers = [NSMutableArray array];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < qualifierCount; i++)
|
||||
{
|
||||
EOQualifier *qualifier = [_qualifiers objectAtIndex: i];
|
||||
EOQualifier *schemaBasedQualifierTmp =
|
||||
[(<EOQualifierSQLGeneration>)qualifier
|
||||
schemaBasedQualifierWithRootEntity:
|
||||
entity];
|
||||
if (schemaBasedQualifierTmp != qualifier)
|
||||
atLeastOneDifferentQualifier = YES;
|
||||
[qualifiers addObject: schemaBasedQualifierTmp];
|
||||
}
|
||||
|
||||
// If we've found at least a different qualifier, return a new EOOrQualifier
|
||||
if (atLeastOneDifferentQualifier)
|
||||
returnedQualifier = [[self class] qualifierWithQualifierArray:qualifiers];
|
||||
}
|
||||
|
||||
EOFLOGObjectFnStop();
|
||||
|
||||
return returnedQualifier;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -262,11 +295,11 @@ if none return something different self, return self
|
|||
rootObjectStore);
|
||||
EOFLOGObjectLevelArgs(@"EOQualifier", @"destinationAttributeNames=%@",
|
||||
destinationAttributeNames);
|
||||
|
||||
|
||||
keyValues = [(EOObjectStoreCoordinator*)rootObjectStore
|
||||
valuesForKeys:
|
||||
destinationAttributeNames
|
||||
object: value];
|
||||
valuesForKeys:
|
||||
destinationAttributeNames
|
||||
object: value];
|
||||
EOFLOGObjectLevelArgs(@"EOQualifier", @"keyValues=%@", keyValues);
|
||||
|
||||
sel = [self selector];
|
||||
|
@ -282,6 +315,8 @@ when flattened: ???
|
|||
NSString *attributeName = nil;
|
||||
NSString *destinationAttributeName;
|
||||
EOJoin *join = [joins objectAtIndex: i];
|
||||
id attributeValue = nil;
|
||||
EONull *eoNull=[EONull null];
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOQualifier",@"join=%@",join);
|
||||
|
||||
|
@ -302,11 +337,11 @@ when flattened: ???
|
|||
attributeName = [sourceAttribute name];
|
||||
}
|
||||
|
||||
attributeValue = [keyValues objectForKey:destinationAttributeName];
|
||||
tmpQualifier = [EOKeyValueQualifier
|
||||
qualifierWithKey: attributeName
|
||||
operatorSelector: sel
|
||||
value: [keyValues objectForKey:
|
||||
destinationAttributeName]];
|
||||
value: (attributeValue ? attributeValue : eoNull)];
|
||||
|
||||
if (qualifier)//Already a qualifier
|
||||
{
|
||||
|
@ -325,7 +360,6 @@ when flattened: ???
|
|||
|
||||
if (qualifiers)
|
||||
{
|
||||
//TODOVERIFY
|
||||
qualifier = [EOAndQualifier qualifierWithQualifierArray: qualifiers];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ static const char _c_id[2] = { _C_ID, NULL };
|
|||
retSize:size
|
||||
retOffset:offset];
|
||||
*/
|
||||
ok = GSObjCFindVariable(self, [name cString], type, size, offset);
|
||||
ok = GSObjCFindInstanceVariable(self, [name cString], type, size, offset);
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC",
|
||||
@"Super InstanceVar named %@:%s",
|
||||
|
@ -259,7 +259,7 @@ static const char _c_id[2] = { _C_ID, NULL };
|
|||
size:size
|
||||
offset:offset];*/
|
||||
|
||||
value = GSObjCGetValue(self, aKey, sel, type, size, offset);
|
||||
value = GSGetValue(self, aKey, sel, type, size, offset);
|
||||
EOFLOGObjectLevelArgs(@"EOGenericRecordKVC", @"value %p (class=%@)",
|
||||
value, [value class]);
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ static const char _c_id[2] = { _C_ID, NULL };
|
|||
size:size
|
||||
offset:offset];
|
||||
*/
|
||||
GSObjCSetValue(self, aKey, anObject, sel, type, size, offset);
|
||||
GSSetValue(self, aKey, anObject, sel, type, size, offset);
|
||||
|
||||
EOFLOGObjectFnStopCond(@"EOGenericRecordKVC");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue