diff --git a/ChangeLog b/ChangeLog index d954592..b1f976b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2010-06-03 David Wetzel + * EOAccess/EOAttribute.m + include EOSQLExpression.h + move methods around to fix warnings + * EOAccess/EOEntity.m + include EOFetchSpecification.h to fix warning + * EOAccess/EOAdaptor.m + fix Mime include + * EOAccess/EOStoredProcedure.m + fix warning in setExternalName: + * EOAccess/EODatabaseContext.m + include EOAttributePriv.h and EOSQLExpression.h to fix warning + entityForGlobalID: cast to EOKeyGlobalID to avoid warning. + use caching. + _fetchRawRowKeyPaths: fix warnings by using proper types. + processSnapshotForDatabaseOperation: set EONull value when needed. + avoid warnings. + 2010-06-03 David Wetzel * configure.ac replaced DBModeler with Apps/EOModeler Apps/EOModelEditor diff --git a/EOAccess/EOAdaptor.m b/EOAccess/EOAdaptor.m index cecb98f..46eeddd 100644 --- a/EOAccess/EOAdaptor.m +++ b/EOAccess/EOAdaptor.m @@ -62,7 +62,6 @@ RCS_ID("$Id$") #include #include #include -#include #else #include #endif @@ -70,12 +69,11 @@ RCS_ID("$Id$") #ifndef GNUSTEP #include #include -#include #endif +#include #include - #include #include diff --git a/EOAccess/EOAttribute.h b/EOAccess/EOAttribute.h index b6a0822..f7da6a9 100644 --- a/EOAccess/EOAttribute.h +++ b/EOAccess/EOAttribute.h @@ -168,6 +168,14 @@ typedef enum { - (BOOL)isKeyDefinedByPrototype: (NSString *)key; +/** + * Returns YES if the attribute references aProperty, NO otherwise. + */ + +- (BOOL)referencesProperty:(id)aProperty; + +- (void)setParent: (id)parent; + @end diff --git a/EOAccess/EOAttribute.m b/EOAccess/EOAttribute.m index 2eeb0af..ecda029 100644 --- a/EOAccess/EOAttribute.m +++ b/EOAccess/EOAttribute.m @@ -71,6 +71,7 @@ RCS_ID("$Id$") #include #include #include +#include #include @@ -699,6 +700,30 @@ RCS_ID("$Id$") return [_prototype valueType]; } +- (void)setParent: (id)parent +{ + //OK + [self willChange]; + _parent = parent; + + _flags.isParentAnEOEntity = [_parent isKindOfClass: [EOEntity class]];//?? +} + +/** + * Returns YES if the attribute references aProperty, NO otherwise. + */ + +- (BOOL)referencesProperty:(id)aProperty +{ + if (!_definitionArray) + { + return NO; + } else { + // _definitionArray is an EOExpressionArray + return [_definitionArray referencesObject:aProperty]; + } +} + @end @implementation EOAttribute (EOAttributeSQLExpression) @@ -1868,30 +1893,6 @@ More details: @implementation EOAttribute (EOAttributePrivate) -/** - * Returns YES if the attribute references aProperty, NO otherwise. - */ - -- (BOOL)referencesProperty:(id)aProperty -{ - if (!_definitionArray) - { - return NO; - } else { - // _definitionArray is an EOExpressionArray - return [_definitionArray referencesObject:aProperty]; - } -} - -- (void)setParent: (id)parent -{ - //OK - [self willChange]; - _parent = parent; - - _flags.isParentAnEOEntity = [_parent isKindOfClass: [EOEntity class]];//?? -} - - (EOAttribute *)realAttribute { return _realAttribute; diff --git a/EOAccess/EOAttributePriv.h b/EOAccess/EOAttributePriv.h index 19d285b..0680fda 100644 --- a/EOAccess/EOAttributePriv.h +++ b/EOAccess/EOAttributePriv.h @@ -28,9 +28,8 @@ #define __EOAttributePriv_h__ @interface EOAttribute (EOAttributePrivate) -- (NSMutableArray *)_definitionArray; +- (EOExpressionArray *)_definitionArray; -- (void)setParent: (id)parent; - (EOAttribute *)realAttribute; - (Class)_valueClass; diff --git a/EOAccess/EODatabaseContext.m b/EOAccess/EODatabaseContext.m index 468324d..7113c01 100644 --- a/EOAccess/EODatabaseContext.m +++ b/EOAccess/EODatabaseContext.m @@ -84,6 +84,7 @@ RCS_ID("$Id$") #include #include #include +#include #include #include @@ -93,6 +94,7 @@ RCS_ID("$Id$") #include #include #include +#include #include "EOPrivate.h" #include "EOEntityPriv.h" @@ -694,18 +696,18 @@ May raise an exception if transaction has began or if you want pessimistic lock /** return entity corresponding to 'globalID' **/ - (id) entityForGlobalID: (EOGlobalID *)globalID { - //OK NSString *entityName; - EOEntity *entity; - DESTROY(_lastEntity); + entityName = [(EOKeyGlobalID *)globalID entityName]; - entityName = [globalID entityName]; - entity = [_database entityNamed: entityName]; + if ((_lastEntity) && (entityName == [_lastEntity name])) + { + return _lastEntity; + } + + ASSIGN(_lastEntity, [_database entityNamed: entityName]); - ASSIGN(_lastEntity, entity); - - return entity; + return _lastEntity; } /** Make object a fault **/ @@ -1340,13 +1342,15 @@ userInfo = { NSUInteger keyCount = [rawRowKeyPaths count]; id messageHandler = nil; // used to prompt the user after the fetch limit is reached. NSString * hintKey = nil; - BOOL continueFetch = NO; + BOOL continueFetch = NO; NSUInteger k; + EOSQLExpression * expression = nil; - NSArray * attributesToFetch; + NSMutableArray * attributesToFetch; if (keyCount == 0) { - attributesToFetch = [entity attributesToFetch]; + // this is an NSMutableArray + attributesToFetch = (NSMutableArray *) [entity attributesToFetch]; } else { // Populate an array with the attributes we need attributesToFetch = [NSMutableArray arrayWithCapacity:keyCount]; @@ -1404,7 +1408,7 @@ userInfo = { { if ([hintKey isKindOfClass:[NSString class]]) { - hintKey = [[[_adaptorContext adaptor] expressionClass] expressionForString:hintKey]; + expression = [[[_adaptorContext adaptor] expressionClass] expressionForString:hintKey]; } else { NSLog(@"%s - %@ is not an NSString but a %@",__PRETTY_FUNCTION__, hintKey, NSStringFromClass([hintKey class])); } @@ -1420,9 +1424,9 @@ userInfo = { { [adaptorChannel openChannel]; } - if (hintKey) + if (expression) { - [adaptorChannel evaluateExpression:hintKey]; + [adaptorChannel evaluateExpression:expression]; [adaptorChannel setAttributesToFetch:attributesToFetch]; } else { [adaptorChannel selectAttributes:attributesToFetch @@ -2267,7 +2271,7 @@ userInfo = { [_database invalidateResultCache]; - snapshots = [_database snapshot]; + snapshots = [_database snapshots]; gids = [snapshots allKeys]; [self invalidateObjectsWithGlobalIDs: gids]; @@ -2308,7 +2312,7 @@ userInfo = { - (BOOL)ownsGlobalID: (EOGlobalID *)globalID { if ([globalID isKindOfClass: [EOKeyGlobalID class]] && - [_database entityNamed: [globalID entityName]]) + [_database entityNamed: [(EOKeyGlobalID*) globalID entityName]]) return YES; return NO; @@ -5648,51 +5652,47 @@ Raises an exception is the adaptor is unable to perform the operations. //Near OK EOAdaptor *adaptor = [_database adaptor];//OK EOEntity *entity = [dbOpe entity];//OK - NSDictionary *newRow = nil; + NSMutableDictionary *newRow = nil; NSDictionary *dbSnapshot = nil; NSEnumerator *attrNameEnum = nil; id attrName = nil; IMP enumNO=NULL; // nextObject - - - - - + newRow = [dbOpe newRow]; //OK{a3code = Q77; code = Q7; numcode = 007; } //ALLOK - - + dbSnapshot = [dbOpe dbSnapshot]; - NSDebugMLLog(@"EODatabaseContext", @"dbSnapshot %p=%@", - dbSnapshot, dbSnapshot); - + attrNameEnum = [newRow keyEnumerator]; enumNO=NULL; while ((attrName = GDL2_NextObjectWithImpPtr(attrNameEnum,&enumNO))) + { + EOAttribute *attribute = [entity attributeNamed: attrName]; + id newRowValue = nil; + id dbSnapshotValue = nil; + + newRowValue = [newRow objectForKey:attrName]; + + + dbSnapshotValue = [dbSnapshot objectForKey: attrName]; + + if (dbSnapshotValue && (![newRowValue isEqual: dbSnapshotValue])) { - EOAttribute *attribute = [entity attributeNamed: attrName]; - id newRowValue = nil; - id dbSnapshotValue = nil; - - - - newRowValue = [newRow objectForKey:attrName]; - - - dbSnapshotValue = [dbSnapshot objectForKey: attrName]; - NSDebugMLLog(@"EODatabaseContext", @"dbSnapshotValue=%@", - dbSnapshotValue); - - if (dbSnapshotValue && ![newRowValue isEqual: dbSnapshotValue]) + id adaptorValue = [adaptor fetchedValueForValue: newRowValue + attribute: attribute]; + + if ((!adaptorValue) || ((adaptorValue != dbSnapshotValue) && (![adaptorValue isEqual:dbSnapshotValue]))) + { + if (!adaptorValue) { - id adaptorValue = [adaptor fetchedValueForValue: newRowValue - attribute: attribute]; //this call is OK - - - //TODO-NOW SO WHAT ?? may be replacing newRow diff values by adaptorValue if different ???? + adaptorValue = GDL2_EONull; } + [newRow setObject:adaptorValue + forKey:attrName]; + } } - - + } + + } diff --git a/EOAccess/EOEntity.m b/EOAccess/EOEntity.m index 33aff69..55e38d7 100644 --- a/EOAccess/EOEntity.m +++ b/EOAccess/EOEntity.m @@ -75,6 +75,7 @@ RCS_ID("$Id$") #include #include #include +#include #include #include diff --git a/EOAccess/EOStoredProcedure.m b/EOAccess/EOStoredProcedure.m index c70e1a7..6a974c6 100644 --- a/EOAccess/EOStoredProcedure.m +++ b/EOAccess/EOStoredProcedure.m @@ -224,7 +224,13 @@ RCS_ID("$Id$") { if (_externalName != name) { [self willChange]; - ASSIGNCOPY(_externalName, ([name length] > 0) ? name : nil); + + if ((!name) || ([name length] < 1)) { + ASSIGN(_externalName, nil); + } else { + ASSIGNCOPY(_externalName, name); + } + } }