mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-15 16:10:46 +00:00
* 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 git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30874 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4ba46c20a5
commit
a5a47b954d
5 changed files with 103 additions and 83 deletions
|
@ -115,7 +115,7 @@
|
|||
<popUpButtonItem tag="0" title="int" />
|
||||
<popUpButtonItem tag="1" title="double" />
|
||||
<popUpButtonItem tag="2" title="float" />
|
||||
<popUpButtonItem tag="3" title="char" />
|
||||
<popUpButtonItem tag="3" title="BOOL" />
|
||||
<popUpButtonItem tag="4" title="short" />
|
||||
<popUpButtonItem tag="5" title="unsigned int" />
|
||||
<popUpButtonItem tag="6" title="unsigned char" />
|
||||
|
|
|
@ -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;
|
||||
|
|
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2010-06-27 David Wetzel <dave@turbocat.de>
|
||||
* 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 <dave@turbocat.de>
|
||||
* EOAccess/EOAccessFault.m
|
||||
-unableToFaultObject:databaseContext:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue