diff --git a/Apps/EOModelEditor/Inspectors/AttributeInspector.gsmarkup b/Apps/EOModelEditor/Inspectors/AttributeInspector.gsmarkup index 34a0f72..b071d49 100644 --- a/Apps/EOModelEditor/Inspectors/AttributeInspector.gsmarkup +++ b/Apps/EOModelEditor/Inspectors/AttributeInspector.gsmarkup @@ -115,7 +115,7 @@ - + diff --git a/Apps/EOModeler/EOModelExtensions.m b/Apps/EOModeler/EOModelExtensions.m index 58c60fd..0a038ac 100644 --- a/Apps/EOModeler/EOModelExtensions.m +++ b/Apps/EOModeler/EOModelExtensions.m @@ -214,6 +214,30 @@ - (BOOL)isScalar { + NSString * vClassName = [self valueClassName]; + + if ([vClassName isEqual:@"NSNumber"] == NO) { + return NO; + } else { + NSString * vType = [self valueType]; + unichar myChar; + + if ([vType length] < 1) { + return NO; + } + myChar = [vType characterAtIndex:0]; + switch (myChar) { + case 'c': /* this is what newer WO versions do */ + return YES; + break; + case 'i': + return NO; /* we want NSNumbers */ + break; + default: + break; + } + } + return NO; } @@ -229,7 +253,7 @@ myChar = [vType characterAtIndex:0]; switch (myChar) { - case 'c': return @"char"; + case 'c': return @"BOOL"; /* this is what newer WO versions do */ break; case 'C': return @"unsigned char"; break; diff --git a/ChangeLog b/ChangeLog index e3a5be1..f2deb9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-06-27 David Wetzel + * EOAccess/EODatabaseContext.m + -isValidQualifierTypeForAttribute: + reformat, remove useless code + -qualifierForLockingAttributes:primaryKeyAttributes:entity:snapshot: + reformat + * EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m + -isValidQualifierType:model: + remove logs, format + * Apps/EOModelEditor/Inspectors/AttributeInspector.gsmarkup + * Apps/EOModeler/EOModelExtensions.m + Rename the char into BOOL + You can use BOOL to create code that has BOOL values. + Apple seems to do this in newer code + 2010-06-26 David Wetzel * EOAccess/EOAccessFault.m -unableToFaultObject:databaseContext: diff --git a/EOAccess/EODatabaseContext.m b/EOAccess/EODatabaseContext.m index 45da91e..4a59190 100644 --- a/EOAccess/EODatabaseContext.m +++ b/EOAccess/EODatabaseContext.m @@ -4793,8 +4793,6 @@ Raises an exception is the adaptor is unable to perform the operations. EOAdaptor *adaptor = nil; NSString *externalType = nil; - - entity = [attribute entity]; NSAssert1(entity, @"No entity for attribute %@", attribute); @@ -4806,16 +4804,6 @@ Raises an exception is the adaptor is unable to perform the operations. isValid = [adaptor isValidQualifierType: externalType model: model]; - //TODO REMOVE - if (!isValid) - { - - - - } - - - return isValid; } @@ -4946,78 +4934,78 @@ Raises an exception is the adaptor is unable to perform the operations. } - (EOQualifier*) qualifierForLockingAttributes: (NSArray*)attributes - primaryKeyAttributes: (NSArray*)primaryKeyAttributes - entity: (EOEntity*)entity - snapshot: (NSDictionary*)snapshot + primaryKeyAttributes: (NSArray*)primaryKeyAttributes + entity: (EOEntity*)entity + snapshot: (NSDictionary*)snapshot { //OK EOQualifier *qualifier = nil; NSMutableArray *qualifiers = nil; int which; - + //First use primaryKeyAttributes, next use attributes for (which = 0; which < 2; which++) + { + NSArray *array = (which == 0 ? primaryKeyAttributes : attributes); + NSUInteger i,count = [array count]; + + for (i = 0; i < count; i++) { - NSArray *array = (which == 0 ? primaryKeyAttributes : attributes); - NSUInteger i,count = [array count]; - - for (i = 0; i < count; i++) - { - EOAttribute *attribute = [array objectAtIndex: i]; - - if (which == 0 || ![primaryKeyAttributes containsObject: attribute])// Test if we haven't already processed it + EOAttribute *attribute = [array objectAtIndex: i]; + + if (which == 0 || ![primaryKeyAttributes containsObject: attribute])// Test if we haven't already processed it { if (![self isValidQualifierTypeForAttribute: attribute]) - { - NSLog(@"Invalid externalType for attribute '%@' of entity named '%@' - model '%@'", - [attribute name], [[attribute entity] name], - [[[attribute entity] model] name]); - NSEmitTODO(); - [self notImplemented: _cmd]; //TODO - } - else - { - NSString *attributeName = nil; - NSString *snapName = nil; - id value = nil; - EOQualifier *aQualifier = nil; - - attributeName = [attribute name]; - NSAssert1(attributeName, @"no attribute name for attribute %@", attribute); - - snapName = [entity snapshotKeyForAttributeName: attributeName]; - NSAssert2(snapName, @"no snapName for attribute %@ in entity %@", - attributeName, [entity name]); - - value = [snapshot objectForKey:snapName]; - - NSAssert4(value != nil, - @"no value for snapshotKey '%@' in snapshot (address=%p) %@ for entity %@", - snapName, snapshot, snapshot, [entity name]); - - aQualifier - = [EOKeyValueQualifier qualifierWithKey: attributeName - operatorSelector: @selector(isEqualTo:) - value: value]; - - if (!qualifiers) - qualifiers = [NSMutableArray array]; - - [qualifiers addObject: aQualifier]; - } - } + { + NSLog(@"Invalid externalType for attribute '%@' of entity named '%@' - model '%@'", + [attribute name], [[attribute entity] name], + [[[attribute entity] model] name]); + NSEmitTODO(); + [self notImplemented: _cmd]; //TODO } + else + { + NSString *attributeName = nil; + NSString *snapName = nil; + id value = nil; + EOQualifier *aQualifier = nil; + + attributeName = [attribute name]; + NSAssert1(attributeName, @"no attribute name for attribute %@", attribute); + + snapName = [entity snapshotKeyForAttributeName: attributeName]; + NSAssert2(snapName, @"no snapName for attribute %@ in entity %@", + attributeName, [entity name]); + + value = [snapshot objectForKey:snapName]; + + NSAssert4(value != nil, + @"no value for snapshotKey '%@' in snapshot (address=%p) %@ for entity %@", + snapName, snapshot, snapshot, [entity name]); + + aQualifier + = [EOKeyValueQualifier qualifierWithKey: attributeName + operatorSelector: @selector(isEqualTo:) + value: value]; + + if (!qualifiers) + qualifiers = [NSMutableArray array]; + + [qualifiers addObject: aQualifier]; + } + } } - + } + if ([qualifiers count] == 1) - { - qualifier = [qualifiers objectAtIndex: 0]; - } + { + qualifier = [qualifiers objectAtIndex: 0]; + } else - { - qualifier = [EOAndQualifier qualifierWithQualifierArray: qualifiers]; - } - + { + qualifier = [EOAndQualifier qualifierWithQualifierArray: qualifiers]; + } + return qualifier; } diff --git a/EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m b/EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m index ea42177..e8e50d8 100644 --- a/EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m +++ b/EOAdaptors/PostgreSQLAdaptor/PostgreSQLAdaptor.m @@ -285,17 +285,10 @@ static NSString *typeNames[][2] = { int i,c; for (i = 0, c = sizeof(typeNames) / sizeof(typeNames[0]); i < c; i++) - { - //TODO REMOVE - NSDebugMLog(@"externalTypeNames[i]=%@", typeNames[i][0]); - - if ([typeNames[i][0] isEqualToString: typeName]) - return YES; - } - //TODO REMOVE - - NSDebugMLog(@"typeName=%@", typeName); - + { + if ([typeNames[i][0] isEqualToString: typeName]) + return YES; + } return NO; }