]> err.no Git - sope/commitdiff
gcc 3.4.3 cleanups
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 12 Apr 2005 21:08:05 +0000 (21:08 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Tue, 12 Apr 2005 21:08:05 +0000 (21:08 +0000)
removed some unused EOAttribute features to simplify the code

git-svn-id: http://svn.opengroupware.org/SOPE/trunk@734 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

13 files changed:
sope-gdl1/GDLAccess/ChangeLog
sope-gdl1/GDLAccess/EOAdaptorDataSource.m
sope-gdl1/GDLAccess/EOAttribute.h
sope-gdl1/GDLAccess/EOAttribute.m
sope-gdl1/GDLAccess/EODatabase.m
sope-gdl1/GDLAccess/EOEntity.m
sope-gdl1/GDLAccess/EOExpressionArray.h
sope-gdl1/GDLAccess/EOQuotedExpression.m
sope-gdl1/GDLAccess/EORelationship.m
sope-gdl1/GDLAccess/EOSQLExpression.m
sope-gdl1/GDLAccess/EOSQLQualifier.m
sope-gdl1/GDLAccess/EOSelectSQLExpression.m
sope-gdl1/GDLAccess/Version

index ee3c2d343a9f5d6859bdb8884cb6975df6fbce92..460dc48750f97bd0fb8bd1cef7d8318b22589c93 100644 (file)
@@ -1,3 +1,12 @@
+2005-04-12  Helge Hess  <helge.hess@opengroupware.org>
+
+       * v4.5.49
+
+       * fixed various gcc 3.4.3 warnings
+
+       * removed support for unused EOAttribute features like flattened, 
+         derived, read-only, insert/update formats, definition
+
 2005-03-15  Helge Hess  <helge.hess@opengroupware.org>
 
        * FoundationExt/GNUmakefile: properly include config.make (v4.5.48)
index 63102f0db57118105cd768b52c0378f49b9c0334..ab8bc71044a246c5db9f43b29c6a990292386960 100644 (file)
@@ -782,7 +782,7 @@ static NSNotificationCenter *getNC(void ) {
                                           self->connectionDictionary];
       [newGID autorelease];
     }
-    [_obj setObject:newGID forKey:@"globalID"];
+    [(NSMutableDictionary *)_obj setObject:newGID forKey:@"globalID"];
   }
   [self postDataSourceChangedNotification];  
 }
index 86feb5c5878008f4d7921d91d84814211777c537..e08c1375b7628d1a7db675e54c8dc7b41e4dc81b 100644 (file)
     NSTimeZone   *clientTimeZone;
     NSTimeZone   *serverTimeZone;
     NSString     *columnName;
-    NSString     *definition;
     NSString     *externalType;
     NSString     *valueClassName;
     NSString     *valueType;
-    NSString     *insertFormat;
-    NSString     *selectFormat;
-    NSString     *updateFormat;
     NSDictionary *userDictionary;
-
-    /* Garbage collectable objects */
-    EOEntity       *entity;             /* non-retained */
-    NSMutableArray *definitionArray;   // These variables are meaningful only
-    EOAttribute    *realAttribute;     // if the attribute is flattened
-    unsigned       width;
+    EOEntity     *entity;             /* non-retained */
+    unsigned     width;
 
     struct {
-       BOOL    isReadOnly:1;
-       BOOL    isDerived:1;
-       BOOL    isFlattened:1;
-        BOOL    allowsNull:1;
+       int allowsNull:1;
+       int reserved:31;
     } flags;
 }
 
 /* Initializing new instances */
-- (id)initWithName:(NSString*)name;
+- (id)initWithName:(NSString *)name;
 
 /* Accessing the entity */
 - (void)setEntity:(EOEntity*)entity;
 - (BOOL)hasEntity;
 
 /* Accessing the name */
-- (BOOL)setName:(NSString*)name;
-- (NSString*)name;
-+ (BOOL)isValidName:(NSString*)name;
+- (BOOL)setName:(NSString *)name;
+- (NSString *)name;
++ (BOOL)isValidName:(NSString *)name;
 
 /* Accessing date information */
-+ (NSString*)defaultCalendarFormat;
-- (void)setCalendarFormat:(NSString*)format;
-- (NSString*)calendarFormat;
++ (NSString *)defaultCalendarFormat;
+- (void)setCalendarFormat:(NSString *)format;
+- (NSString *)calendarFormat;
 - (void)setClientTimeZone:(NSTimeZone*)tz;
 - (NSTimeZone*)clientTimeZone;
 - (void)setServerTimeZone:(NSTimeZone*)tz;
 - (NSTimeZone*)serverTimeZone;
 
 /* Accessing external definitions */
-- (void)setColumnName:(NSString*)columnName;
-- (NSString*)columnName;
-- (void)setDefinition:(NSString*)definition;
-- (NSString*)definition;
-- (NSMutableArray*)definitionArray;
-- (void)setExternalType:(NSString*)type;
-- (NSString*)externalType;
+- (void)setColumnName:(NSString *)columnName;
+- (NSString *)columnName;
+- (void)setExternalType:(NSString *)type;
+- (NSString *)externalType;
 
 /* Accessing value type information */
-- (void)setValueClassName:(NSString*)name;
-- (NSString*)valueClassName;
-- (void)setValueType:(NSString*)type;
-- (NSString*)valueType;
+- (void)setValueClassName:(NSString *)name;
+- (NSString *)valueClassName;
+- (void)setValueType:(NSString *)type;
+- (NSString *)valueType;
 
 /* Checking type information */
 - (BOOL)referencesProperty:property;
-- (BOOL)isDerived;
-- (BOOL)isFlattened;
-- (BOOL)setReadOnly:(BOOL)flag;
-- (BOOL)isReadOnly;
-
-/* Accessing SQL statement formats */
-- (void)setInsertFormat:(NSString*)string;
-- (NSString*)insertFormat;
-- (void)setSelectFormat:(NSString*)string;
-- (NSString*)selectFormat;
-- (void)setUpdateFormat:(NSString*)string;
-- (NSString*)updateFormat;
 
 /* Accessing the user dictionary */
 - (void)setUserDictionary:(NSDictionary*)dictionary;
 
 - (NSException *)validateValue:(id *)_value;
 
-- (NSString *)readFormat;
-- (NSString *)writeFormat;
-
 @end
 
 #endif /* __EOAttribute_h__ */
index 09b4945343a205a1c3dad9736d79740e7ac132b4..8e2e1ac27ca1c10611697dabeb9cef5fb7ed46ac 100644 (file)
@@ -63,31 +63,25 @@ static EONull   *null = nil;
 }
 
 - (void)dealloc {
-  RELEASE(self->name);
-  RELEASE(self->calendarFormat);
-  RELEASE(self->clientTimeZone);
-  RELEASE(self->serverTimeZone);
-  RELEASE(self->columnName);
-  RELEASE(self->definition);
-  RELEASE(self->externalType);
-  RELEASE(self->valueClassName);
-  RELEASE(self->valueType);
-  RELEASE(self->insertFormat);
-  RELEASE(self->selectFormat);
-  RELEASE(self->updateFormat);
-  RELEASE(self->userDictionary);
+  [self->name           release];
+  [self->calendarFormat release];
+  [self->clientTimeZone release];
+  [self->serverTimeZone release];
+  [self->columnName     release];
+  [self->externalType   release];
+  [self->valueClassName release];
+  [self->valueType      release];
+  [self->userDictionary release];
   self->entity = nil; /* non-retained */
-  RELEASE(self->definitionArray);
-  RELEASE(self->realAttribute);
   [super dealloc];
 }
 
 // These methods should be here to let the library work with NeXT foundation
 - (id)copy {
-  return RETAIN(self);
+  return [self retain];
 }
 - (id)copyWithZone:(NSZone *)_zone {
-  return RETAIN(self);
+  return [self retain];
 }
 
 // Is equal only if same name; used to make aliasing ordering stable
@@ -110,97 +104,8 @@ static EONull   *null = nil;
   return [EOEntity isValidName:_name];
 }
 
-- (BOOL)setReadOnly:(BOOL)flag {
-  if(!flag && ([self isDerived] || [self isFlattened]))
-    return NO;
-  flags.isReadOnly = flag;
-  return YES;
-}
-
-- (BOOL)referencesProperty:(id)property {
-  return (flags.isDerived)
-    ? [self->definitionArray indexOfObject:property] != NSNotFound
-    : NO;
-}
-
-- (void)setDefinition:(NSString *)def {
-  NSArray  *defArray;
-  int      i, count;
-  EOEntity *currentEntity;
-  id       realAttributeName;
-
-  if (def == nil) {
-    [NSException raise:NSInvalidArgumentException
-                format:@"invalid (nil) definition argument!"];
-  }
-  
-  self->flags.isDerived = YES;
-  self->flags.isFlattened = NO;
-  
-  ASSIGN(self->definition, def);
-
-  if ([definition isNameOfARelationshipPath]) {
-    self->flags.isFlattened = YES;
-    defArray        = [definition componentsSeparatedByString:@"."];
-    count           = [defArray count];
-    
-    RELEASE(self->definitionArray);
-    self->definitionArray = [[NSMutableArray alloc] initWithCapacity:count];
-    
-    NS_DURING {
-      currentEntity = self->entity;
-      
-      for (i = 0; i < count - 1; i++) {
-        id relationshipName, relationship;
-
-        relationshipName = [defArray objectAtIndex:i];
-        
-        if(![EOEntity isValidName:relationshipName]) {
-          [[[InvalidNameException alloc]
-             initWithName:relationshipName] raise];
-        }
-    
-        relationship
-          = [currentEntity relationshipNamed:relationshipName];
-        
-        if(relationship == nil) {
-          [[[InvalidPropertyException alloc]
-             initWithName:relationshipName entity:currentEntity] raise];
-        }
-        if([relationship isToMany]) {
-          [[[RelationshipMustBeToOneException alloc]
-             initWithName:relationshipName entity:currentEntity] raise];
-        }
-        [self->definitionArray addObject:relationship];
-        currentEntity = [relationship destinationEntity];
-      }
-      realAttributeName = [defArray lastObject];
-
-      RELEASE(self->realAttribute);
-      self->realAttribute =
-        RETAIN([currentEntity attributeNamed:realAttributeName]);
-      if (self->realAttribute == nil) {
-        [[[InvalidPropertyException alloc]
-           initWithName:realAttributeName entity:currentEntity] raise];
-      }
-      [self->definitionArray addObject:self->realAttribute];
-    }
-    NS_HANDLER {
-      RELEASE(self->definitionArray);
-      self->definitionArray = nil;
-      [localException raise];
-    }
-    NS_ENDHANDLER;
-  }
-  else {
-    [self->definitionArray release];
-    self->definitionArray = nil;
-    self->definitionArray
-      = [[EOExpressionArray parseExpression:definition
-                                  entity:entity
-                                  replacePropertyReferences:YES]
-         retain];
-  }
+- (BOOL)referencesProperty:(id)property { // TODO: still used?
+  return NO;
 }
 
 - (NSString *)expressionValueForContext:(id<EOExpressionContext>)context {
@@ -243,59 +148,32 @@ static EONull   *null = nil;
   return self->serverTimeZone;
 }
 
-- (void)setColumnName:(NSString*)_name {
-  ASSIGN(self->columnName, _name);
+- (void)setColumnName:(NSString *)_name {
+  ASSIGNCOPY(self->columnName, _name);
 }
 - (NSString *)columnName {
   return self->columnName;
 }
 
-- (void)setExternalType:(NSString*)type {
-  ASSIGN(self->externalType, type);
+- (void)setExternalType:(NSString *)type {
+  ASSIGNCOPY(self->externalType, type);
 }
 - (NSString *)externalType {
-  return ((self->externalType == nil) && self->flags.isFlattened)
-       ? [self->realAttribute externalType]
-       : self->externalType;
+  return self->externalType;
 }
 
 - (void)setValueClassName:(NSString *)_name {
-  ASSIGN(self->valueClassName, _name);
+  ASSIGNCOPY(self->valueClassName, _name);
 }
 - (NSString *)valueClassName {
-  return ((self->valueClassName == nil) && self->flags.isFlattened)
-    ? [self->realAttribute valueClassName]
-    : self->valueClassName;
+  return self->valueClassName;
 }
 
 - (void)setValueType:(NSString *)type {
   ASSIGN(self->valueType, type);
 }
 - (NSString *)valueType {
-  return ((self->valueType == nil) && self->flags.isFlattened)
-    ? [self->realAttribute valueType]
-    : self->valueType;
-}
-
-- (void)setInsertFormat:(NSString *)string {
-  ASSIGN(self->insertFormat, string);
-}
-- (NSString *)insertFormat {
-  return self->insertFormat;
-}
-
-- (void)setSelectFormat:(NSString *)string {
-  ASSIGN(self->selectFormat, string);
-}
-- (NSString *)selectFormat {
-  return self->selectFormat;
-}
-
-- (void)setUpdateFormat:(NSString*)string {
-  ASSIGN(self->updateFormat, string);
-}
-- (NSString *)updateFormat {
-  return self->updateFormat;
+  return self->valueType;
 }
 
 - (void)setUserDictionary:(NSDictionary *)dict {
@@ -311,22 +189,6 @@ static EONull   *null = nil;
 - (NSString *)name {
   return self->name;
 }
-- (NSString *)definition {
-  return self->definition;
-}
-- (NSMutableArray *)definitionArray {
-  return self->definitionArray;
-}
-- (BOOL)isDerived {
-  return self->flags.isDerived;
-}
-- (BOOL)isFlattened {
-  return self->flags.isFlattened;
-}
-
-- (BOOL)isReadOnly {
-  return self->flags.isDerived ? YES : self->flags.isReadOnly;
-}
 
 /* description */
 
@@ -334,54 +196,39 @@ static EONull   *null = nil;
   return [[self propertyList] description];
 }
 
-@end /* EOAttribute */
-
-
-@implementation EOAttribute (EOAttributePrivate)
+/* EOAttributePrivate */
 
 + (EOAttribute*)attributeFromPropertyList:(id)propertyList {
+  NSDictionary *plist = propertyList;
   EOAttribute *attribute = nil;
   NSString    *timeZoneName;
   id          tmp;
+  
+  attribute = [[[EOAttribute alloc] init] autorelease];
+  
+  [attribute setName:[plist objectForKey:@"name"]];
+  [attribute setCalendarFormat:[plist objectForKey:@"calendarFormat"]];
 
-  attribute = [[EOAttribute alloc] init];
-  AUTORELEASE(attribute);
-
-  [attribute setName:[propertyList objectForKey:@"name"]];
-  [attribute setCalendarFormat:[propertyList objectForKey:@"calendarFormat"]];
-
-  timeZoneName = [propertyList objectForKey:@"clientTimeZone"];
+  timeZoneName = [plist objectForKey:@"clientTimeZone"];
   if (timeZoneName)
     [attribute setClientTimeZone:[NSTimeZone timeZoneWithName:timeZoneName]];
 
-  timeZoneName = [propertyList objectForKey:@"serverTimeZone"];
+  timeZoneName = [plist objectForKey:@"serverTimeZone"];
   if (timeZoneName)
     [attribute setServerTimeZone:[NSTimeZone timeZoneWithName:timeZoneName]];
   
-  [attribute setColumnName:    [propertyList objectForKey:@"columnName"]];
-  [attribute setExternalType:  [propertyList objectForKey:@"externalType"]];
-  [attribute setValueClassName:[propertyList objectForKey:@"valueClassName"]];
-  [attribute setValueType:     [propertyList objectForKey:@"valueType"]];
-  [attribute setInsertFormat:  [propertyList objectForKey:@"insertFormat"]];
-  [attribute setSelectFormat:  [propertyList objectForKey:@"selectFormat"]];
-  [attribute setUpdateFormat:  [propertyList objectForKey:@"updateFormat"]];
-  [attribute setUserDictionary:[propertyList objectForKey:@"userDictionary"]];
+  [attribute setColumnName:    [plist objectForKey:@"columnName"]];
+  [attribute setExternalType:  [plist objectForKey:@"externalType"]];
+  [attribute setValueClassName:[plist objectForKey:@"valueClassName"]];
+  [attribute setValueType:     [plist objectForKey:@"valueType"]];
+  [attribute setUserDictionary:[plist objectForKey:@"userDictionary"]];
   
-  [attribute setReadOnly:
-                 [[propertyList objectForKey:@"isReadOnly"] isEqual:@"Y"]];
-
-  if ((tmp = [propertyList objectForKey:@"allowsNull"]))
+  if ((tmp = [plist objectForKey:@"allowsNull"]))
     [attribute setAllowsNull:[tmp isEqual:@"Y"]];
   else
     [attribute setAllowsNull:YES];
   
-  [attribute setWidth:
-               [[propertyList objectForKey:@"width"] unsignedIntValue]];
-
-  /* Don't call setDefinition: now. The attributes array in
-     entity is not yet set. */
-  attribute->definition = RETAIN([propertyList objectForKey:@"definition"]);
-
+  [attribute setWidth:[[plist objectForKey:@"width"] unsignedIntValue]];
   return attribute;
 }
 
@@ -389,16 +236,6 @@ static EONull   *null = nil;
    were constructed and after the `attributes' array contains the real
    attributes. */
 - (void)replaceStringsWithObjects {
-  if(self->definition) {
-    NS_DURING
-      [self setDefinition:self->definition];
-    NS_HANDLER {
-      //CATCH(PropertyDefinitionException)
-      NSLog([localException reason]);
-      [[self->entity model] errorInReading];
-    }
-    NS_ENDHANDLER;
-  }
 }
 
 - (id)propertyList {
@@ -413,9 +250,7 @@ static EONull   *null = nil;
   return [[(EOAttribute *)self name] compare:[_other name]];
 }
 
-@end /* EOAttribute (EOAttributePrivate) */
-
-@implementation EOAttribute(ValuesConversion)
+/* ValuesConversion */
 
 - (id)convertValue:(id)aValue toClass:(Class)aClass forType:(NSString*)_type {
   // Check nil/EONull
@@ -493,9 +328,9 @@ static EONull   *null = nil;
                toClass:aValueClass forType:[self valueType]];
 }
 
-@end
+@end /* EOAttribute */
 
-@implementation NSString (EOAttributeTypeCheck)
+@implementation NSString(EOAttributeTypeCheck)
 
 - (BOOL)isNameOfARelationshipPath {
   BOOL result = NO;
@@ -519,7 +354,7 @@ static EONull   *null = nil;
   return result;
 }
 
-@end
+@end /* NSString(EOAttributeTypeCheck) */
 
 @implementation EOAttribute(PropertyListCoding)
 
@@ -532,13 +367,9 @@ static inline void _addToPropList(NSMutableDictionary *propertyList,
   _addToPropList(_plist, self->name,           @"name");
   _addToPropList(_plist, self->calendarFormat, @"calendarFormat");
   _addToPropList(_plist, self->columnName,     @"columnName");
-  _addToPropList(_plist, self->definition,     @"definition");
   _addToPropList(_plist, self->externalType,   @"externalType");
   _addToPropList(_plist, self->valueClassName, @"valueClassName");
   _addToPropList(_plist, self->valueType,      @"valueType");
-  _addToPropList(_plist, self->insertFormat,   @"insertFormat");
-  _addToPropList(_plist, self->selectFormat,   @"selectFormat");
-  _addToPropList(_plist, self->updateFormat,   @"updateFormat");
   _addToPropList(_plist, self->userDictionary, @"userDictionary");
   
   if (self->clientTimeZone) {
@@ -564,11 +395,6 @@ static inline void _addToPropList(NSMutableDictionary *propertyList,
     [_plist setObject:[NSNumber numberWithUnsignedInt:self->width]
             forKey:@"width"];
   }
-  
-  if (self->flags.isReadOnly) {
-    [_plist setObject:[NSString stringWithCString:"Y"]
-            forKey:@"isReadOnly"];
-  }
   if (self->flags.allowsNull) {
     [_plist setObject:[NSString stringWithCString:"Y"]
             forKey:@"allowsNull"];
@@ -678,18 +504,12 @@ static inline void _addToPropList(NSMutableDictionary *propertyList,
   return nil;
 }
 
-- (NSString *)readFormat {
-  return nil;
-}
-- (NSString *)writeFormat {
-  return nil;
-}
-
 @end /* EOAttribute(EOF2Additions) */
 
 @implementation NSString(BeautifyAttributeName)
 
 - (NSString *)_beautifyAttributeName {
+  // DML Unicode
   unsigned clen = 0;
   char     *s   = NULL;
   unsigned cnt, cnt2;
index 8f5ef430c0590b90ff72c7e3720d3f57f4d585b5..d56207b1fa296185f2dc5274650c2a90a146909a 100644 (file)
@@ -225,7 +225,9 @@ static inline void _removeDatabaseInstance(EODatabase *_db) {
 }
 
 + (void)forgetObject:(id)_object {
-  [EOObjectUniquer forgetObject:_object];
+  static Class UniquerClass = Nil;
+  if (UniquerClass == Nil) UniquerClass = [EOObjectUniquer class];
+  [(EOObjectUniquer *)UniquerClass forgetObject:_object];
 
   [lock lock];
   {
index e3989dd14f64d543131e17ee6819d61e7a90c562..e85ae23de32b2e60941e7c134b219885a1cf6350 100644 (file)
@@ -486,10 +486,7 @@ static int _compareByName(id obj1, id obj2, void * context);
   if(!([anAttribute isKindOfClass:[EOAttribute class]]
        && [self->attributesByName objectForKey:[anAttribute name]]))
     return NO;
-
-  if([anAttribute isDerived])
-    return NO;
-
+  
   return YES;
 }
 
@@ -588,28 +585,26 @@ static int _compareByName(id obj1, id obj2, void * context);
   return self->attributes;
 }
 
-@end /* EOEntity */
-
-
-@implementation EOEntity (EOEntityCreation)
+/* EOEntityCreation */
 
 + (EOEntity *)entityFromPropertyList:(id)propertyList model:(EOModel *)_model {
+  NSDictionary *plist = propertyList;
   EOEntity     *entity;
   NSArray      *array;
   NSEnumerator *enumerator;
   id attributePList;
   id relationshipPList;
 
-  entity = AUTORELEASE([[EOEntity alloc] init]);
+  entity = [[[EOEntity alloc] init] autorelease];
   [entity setCreateMutableObjects:YES];
 
-  entity->name           = RETAIN([propertyList objectForKey:@"name"]);
-  entity->className      = RETAIN([propertyList objectForKey:@"className"]);
-  entity->externalName   = RETAIN([propertyList objectForKey:@"externalName"]);
-  entity->externalQuery  = RETAIN([propertyList objectForKey:@"externalQuery"]);
-  entity->userDictionary = RETAIN([propertyList objectForKey:@"userDictionary"]);
+  entity->name           = RETAIN([plist objectForKey:@"name"]);
+  entity->className      = RETAIN([plist objectForKey:@"className"]);
+  entity->externalName   = RETAIN([plist objectForKey:@"externalName"]);
+  entity->externalQuery  = RETAIN([plist objectForKey:@"externalQuery"]);
+  entity->userDictionary = RETAIN([plist objectForKey:@"userDictionary"]);
 
-  array      = [propertyList objectForKey:@"attributes"];
+  array      = [plist objectForKey:@"attributes"];
   enumerator = [array objectEnumerator];
   
   while ((attributePList = [enumerator nextObject])) {
@@ -625,21 +620,21 @@ static int _compareByName(id obj1, id obj2, void * context);
   }
 
   entity->attributesUsedForLocking
-    = RETAIN([propertyList objectForKey:@"attributesUsedForLocking"]);
+    = RETAIN([plist objectForKey:@"attributesUsedForLocking"]);
   entity->classPropertyNames
-    = RETAIN([propertyList objectForKey:@"classProperties"]);
+    = RETAIN([plist objectForKey:@"classProperties"]);
 
-  if ((attributePList = [propertyList objectForKey:@"primaryKeyAttributes"])) {
+  if ((attributePList = [plist objectForKey:@"primaryKeyAttributes"])) {
     entity->primaryKeyAttributeNames
       = RETAIN([attributePList sortedArrayUsingSelector:@selector(compare:)]);
   }
 
   else
-    if ((attributePList = [propertyList objectForKey:@"primaryKeyAttribute"]))
+    if ((attributePList = [plist objectForKey:@"primaryKeyAttribute"]))
       entity->primaryKeyAttributeNames
         = RETAIN([NSArray arrayWithObject:attributePList]);
 
-  array = [propertyList objectForKey:@"relationships"];
+  array = [plist objectForKey:@"relationships"];
   enumerator = [array objectEnumerator];
   while((relationshipPList = [enumerator nextObject])) {
     EORelationship *relationship
@@ -802,12 +797,15 @@ static inline BOOL _containsObject(NSArray *a, id obj) {
     EOAttribute *attr = [self->attributes objectAtIndex:i];
     BOOL pk, lk, cp, sa;
 
-    pk = _containsObject(self->primaryKeyAttributes, attr);
+    pk = _containsObject(self->primaryKeyAttributes,     attr);
     lk = _containsObject(self->attributesUsedForLocking, attr);
-    cp = _containsObject(self->classProperties, attr);
-    sa = (![attr isDerived] && ![attr isFlattened]);
-
-    //NSLog(@"attribute %@ pk=%i lk=%i cp=%i sa=%i", [attr name], pk, lk, cp, sa);
+    cp = _containsObject(self->classProperties,          attr);
+    sa = YES;
+    
+#if 0
+    NSLog(@"attribute %@ pk=%i lk=%i cp=%i sa=%i", 
+         [attr name], pk, lk, cp, sa);
+#endif
     
     if ((pk || lk || cp) && (!_containsObject(fetAttr, attr)))
       [fetAttr addObject:attr];
index 08f887f5b970202d0a0105b565d2be25505f8650..4452d8663ba57657ba8bf1b9f9340da05610b9f9 100644 (file)
 /* Checking contents */
 - (BOOL)referencesObject:(id)anObject;
 
-- (NSString*)expressionValueForContext:(id<EOExpressionContext>)ctx;
+- (NSString *)expressionValueForContext:(id<EOExpressionContext>)ctx;
 
-+ (EOExpressionArray*)parseExpression:(NSString*)expression
-       entity:(EOEntity*)entity
++ (EOExpressionArray *)parseExpression:(NSString *)expression
+       entity:(EOEntity *)entity
        replacePropertyReferences:(BOOL)flag;
 
-+ (EOExpressionArray*)parseExpression:(NSString*)expression
-       entity:(EOEntity*)entity
++ (EOExpressionArray *)parseExpression:(NSString *)expression
+       entity:(EOEntity *)entity
        replacePropertyReferences:(BOOL)flag
         relationshipPaths:(NSMutableArray *)relationshipPaths;
 
index 7a001282c9c2d19336e310aed19cebe26aebb365..2a11fc37c57a2b8411e2b39a370eb4cb0b89771b 100644 (file)
 @implementation EOQuotedExpression
 
 - (id)expressionValueForContext:(id<EOExpressionContext>)_context {
-    NSMutableString *result;
-    NSArray         *components;
-    id              expr;
-
-    expr       = [self->expression expressionValueForContext:_context];
-    components = [expr componentsSeparatedByString:quote];
-    result     = [[NSMutableString alloc] initWithCapacity:[expr length] + 10];
-
-    [result appendString:quote];
-    [result appendString:[components componentsJoinedByString:escape]];
-    [result appendString:quote];
-
-    return AUTORELEASE(result);
+  NSMutableString *result;
+  NSArray         *components;
+  id              expr;
+
+  expr       = [(EOExpressionArray *)self->expression 
+                                    expressionValueForContext:_context];
+  components = [expr componentsSeparatedByString:quote];
+  result     = [NSMutableString stringWithCapacity:[expr length] + 10];
+
+  [result appendString:quote];
+  [result appendString:[components componentsJoinedByString:escape]];
+  [result appendString:quote];
+  
+  return result;
 }
 
 - (id)initWithExpression:(id)_expression
index 8918554f26047f3a7ca99aec2a7aa20af8f96d5e..1e16cd14dcf7932ff169b8eceb93250e4aadef10 100644 (file)
@@ -93,6 +93,7 @@ static EONull *null = nil;
 }
 
 - (void)setDefinition:(NSString *)def {
+  // TODO: do we need this?
   if (def == nil) {
     [NSException raise:NSInvalidArgumentException
                 format:@"invalid (nil) definition argument ..."];
@@ -284,18 +285,19 @@ static EONull *null = nil;
 + (EORelationship *)relationshipFromPropertyList:(id)_plist
   model:(EOModel *)model
 {
+  NSDictionary   *plist = _plist;
   EORelationship *relationship = nil;
   NSArray        *array      = nil;
   NSEnumerator   *enumerator = nil;
   id             joinPList   = nil;
 
-  relationship = AUTORELEASE([EORelationship new]);
+  relationship = [[[EORelationship alloc] init] autorelease];
   [relationship setCreateMutableObjects:YES];
-  [relationship setName:[_plist objectForKey:@"name"]];
+  [relationship setName:[plist objectForKey:@"name"]];
   [relationship setUserDictionary:
-                [_plist objectForKey:@"userDictionary"]];
+                [plist objectForKey:@"userDictionary"]];
 
-  if ((array = [_plist objectForKey:@"joins"])) {
+  if ((array = [plist objectForKey:@"joins"])) {
     enumerator = [array objectEnumerator];
 
     joinPList = [enumerator nextObject];
@@ -308,19 +310,19 @@ static EONull *null = nil;
   }
   
   relationship->destinationEntity =
-    RETAIN([_plist objectForKey:@"destination"]);
+    RETAIN([plist objectForKey:@"destination"]);
   // retained string
 
   relationship->flags.isToMany =
-    [[_plist objectForKey:@"isToMany"] isEqual:@"Y"];
+    [[plist objectForKey:@"isToMany"] isEqual:@"Y"];
 
   relationship->flags.isMandatory =
-    [[_plist objectForKey:@"isMandatory"] isEqual:@"Y"];
+    [[plist objectForKey:@"isMandatory"] isEqual:@"Y"];
   
   /* Do not send here the -setDefinition: message because the relationships
      are not yet created from the model file. */
   relationship->definition
-    = RETAIN([_plist objectForKey:@"definition"]);
+    = RETAIN([plist objectForKey:@"definition"]);
 
   return relationship;
 }
@@ -433,26 +435,25 @@ static EONull *null = nil;
   return [[(EORelationship *)self name] compare:[_other name]];
 }
 
-@end /* EORelationship (EORelationshipPrivate) */
-
-@implementation EORelationship(EOJoin)
+/* EOJoin */
 
 - (void)loadJoinPropertyList:(id)propertyList {
+  NSDictionary *plist = propertyList;
   NSString *joinOperatorPList;
   NSString *joinSemanticPList;
   id tmp;
 
-  tmp = [propertyList objectForKey:@"sourceAttribute"];
+  tmp = [plist objectForKey:@"sourceAttribute"];
   [self setSourceAttribute:tmp];
-  tmp = [propertyList objectForKey:@"destinationAttribute"];
+  tmp = [plist objectForKey:@"destinationAttribute"];
   [self setDestinationAttribute:tmp];
   
-  if ((joinOperatorPList = [propertyList objectForKey:@"joinOperator"])) {
+  if ((joinOperatorPList = [plist objectForKey:@"joinOperator"])) {
     NSAssert([joinOperatorPList isEqual:@"EOJoinEqualTo"],
              @"only EOJoinEqualTo is supported as the join operator !");
   }
 
-  if ((joinSemanticPList = [propertyList objectForKey:@"joinSemantic"])) {
+  if ((joinSemanticPList = [plist objectForKey:@"joinSemantic"])) {
     NSAssert([joinSemanticPList isEqual:@"EOInnerJoin"],
              @"only EOInnerJoin is supported as the join semantic !");
   }
@@ -490,9 +491,7 @@ static EONull *null = nil;
   [self setDestinationAttribute:[_join destinationAttribute]];
 }
 
-@end /* EORelationship(EOJoin) */
-
-@implementation EORelationship(PropertyListCoding)
+/* PropertyListCoding */
 
 static inline void _addToPropList(NSMutableDictionary *_plist,
                                   id _value, NSString *key) {
@@ -523,9 +522,7 @@ static inline void _addToPropList(NSMutableDictionary *_plist,
     _addToPropList(_plist, flags.isMandatory ? @"Y" : @"N", @"isMandatory");
 }
 
-@end /* EORelationship(PropertyListCoding) */
-
-@implementation EORelationship(EOF2Additions)
+/* EOF2Additions */
 
 /* constraints */
 
@@ -561,7 +558,7 @@ static inline void _addToPropList(NSMutableDictionary *_plist,
   return nil;
 }
 
-@end /* EORelationship(EOF2Additions) */
+@end /* EORelationship */
 
 @implementation EOJoin
 @end /* EOJoin */
index d273de631d48d917665ecfd68feeb8bb2282bfac..f8dc18a2d9eefea376a9dffb25961eff6ba6b963 100644 (file)
@@ -563,12 +563,10 @@ NSString *EOBindVariableValueKey       = @"value";
 
   while((attributeName = [enumerator nextObject])) {
     EOAttribute *attribute;
-    NSString    *updateFormat;
     NSString    *columnName   = nil;
     id          value         = nil;
 
-    attribute    = [entity attributeNamed:attributeName];
-    updateFormat = [attribute updateFormat];
+    attribute = [entity attributeNamed:attributeName];
         
     NSAssert1(attribute, @"attribute %@ should be non nil", attributeName);
     columnName = adaptor
@@ -577,26 +575,10 @@ NSString *EOBindVariableValueKey       = @"value";
 
     value = [row objectForKey:attributeName];
         
-    if (updateFormat) {
-      [scannerHandler setValue:value
-                      attribute:attribute
-                      adaptor:adaptor];
-#if defined(__s390__)
-      value = [formatScanner performSelector:
-                             @selector(stringWithFormat:arguments:)
-                             withObject:updateFormat
-                             withObject:nil];
-#else
-      value = [formatScanner stringWithFormat:updateFormat
-                             arguments:NULL];
-#endif
-    }
-    else {
-      value = [self literalForAttribute:attribute
-                    withValue:value fromRow:row];
-    }
-
-    if(first) first = NO;
+    value = [self literalForAttribute:attribute
+                 withValue:value fromRow:row];
+    
+    if (first) first = NO;
     else [expression appendString:@", "];
 
     [expression appendString:columnName];
@@ -657,34 +639,16 @@ NSString *EOBindVariableValueKey       = @"value";
 
   while ((attributeName = [enumerator nextObject])) {
     EOAttribute *attribute;
-    NSString    *insertFormat;
     id          value;
 
     attribute    = [entity attributeNamed:attributeName];
-    insertFormat = [attribute insertFormat];
     value        = [row objectForKey:attributeName];
         
     NSAssert1(attribute, @"attribute %@ should be non nil", attributeName);
-    if (insertFormat) {
-      [scannerHandler setValue:value
-                      attribute:attribute
-                      adaptor:self->adaptor];
-#if defined(__s390__)
-      value = [formatScanner performSelector:
-                               @selector(stringWithFormat:arguments:)
-                             withObject:insertFormat
-                             withObject:nil];
-#else
-      value = [formatScanner stringWithFormat:insertFormat
-                             arguments:NULL];
-#endif
-    }
-    else {
-      value = [self literalForAttribute:attribute
-                    withValue:value fromRow:row];
-    }
-
-    if(first) first = NO;
+    value = [self literalForAttribute:attribute
+                 withValue:value fromRow:row];
+    
+    if (first) first = NO;
     else [expression appendString:@", "];
 
     [expression appendString:value];
@@ -722,18 +686,9 @@ NSString *EOBindVariableValueKey       = @"value";
                         [attribute name],
                         [entity name]] raise];
       }
-      if ([attribute isFlattened]) {
-        id definitionArray = [attribute definitionArray];
-        NSRange range = { 0, [definitionArray count] - 1 };
-        id relationshipPath = [definitionArray subarrayWithRange:range];
 
-        [relationshipPaths addObject:relationshipPath];
-        [entities addObjectsFromArray:relationshipPath];
-      }
-      else {
-        /* attribute is normal. */
-        [entities addObject:[attribute entity]];
-      }
+      /* attribute is normal. */
+      [entities addObject:[attribute entity]];
     }
     
     [relationshipPaths unionSet:[qualifier relationshipPaths]];
@@ -756,14 +711,6 @@ NSString *EOBindVariableValueKey       = @"value";
                         [attribute name],
                         [entity name]] raise];
       }
-      if ([attribute isFlattened]) {
-        id      definitionArray = [attribute definitionArray];
-        NSRange range = { 0, [definitionArray count] - 1 };
-        id      relationshipPath = [definitionArray subarrayWithRange:range];
-
-        [relationshipPaths addObject:relationshipPath];
-        [entities addObjectsFromArray:relationshipPath];
-      }
     }
 
     entitiesAndPropertiesAliases = [NSMutableDictionary new];
@@ -807,16 +754,10 @@ NSString *EOBindVariableValueKey       = @"value";
 }
 
 - (NSString *)expressionValueForAttribute:(EOAttribute *)attribute {
-    if([attribute isFlattened])
-        return [self expressionValueForAttributePath:
-                                    [attribute definitionArray]];
-    else if([attribute isDerived])
-        return [[attribute definitionArray] expressionValueForContext:self];
-
-    /* attribute is a normal attribute. Its alias is the alias
-       of its entity. */
-    return [self expressionValueForAttribute:attribute
-                 context:[attribute entity]];
+  /* attribute is a normal attribute. Its alias is the alias
+     of its entity. */
+  return [self expressionValueForAttribute:attribute
+              context:[attribute entity]];
 }
 
 - (NSString *)expressionValueForAttributePath:(NSArray *)definitionArray {
@@ -1268,7 +1209,7 @@ NSString *EOBindVariableValueKey       = @"value";
   
   sql = [self sqlStringForAttributeNamed:[_q leftKey]];
   a   = [[self entity] attributeNamed:[_q leftKey]]; /* relationships ? */
-  sql = [[self class] formatSQLString:sql format:[a readFormat]];
+  sql = [[self class] formatSQLString:sql format:nil];
   [s appendString:sql];
   
   [s appendString:@" "];
@@ -1277,7 +1218,7 @@ NSString *EOBindVariableValueKey       = @"value";
   
   sql = [self sqlStringForAttributeNamed:[_q rightKey]];
   a   = [[self entity] attributeNamed:[_q rightKey]]; /* relationships ? */
-  sql = [[self class] formatSQLString:sql format:[a readFormat]];
+  sql = [[self class] formatSQLString:sql format:nil];
   [s appendString:sql];
   
   return s;
@@ -1294,7 +1235,7 @@ NSString *EOBindVariableValueKey       = @"value";
 
   sql = [self sqlStringForAttributeNamed:[_q key]];
   a   = [[self entity] attributeNamed:[_q key]]; /* relationships ? */
-  sql = [[self class] formatSQLString:sql format:[a readFormat]];
+  sql = [[self class] formatSQLString:sql format:nil];
   [s appendString:sql];
   
   [s appendString:@" "];
@@ -1404,7 +1345,7 @@ NSString *EOBindVariableValueKey       = @"value";
   s = [[NSMutableString alloc] initWithCapacity:32];
   [s appendString:[_attr columnName]];
   [s appendString:@"="];
-  _value = [[self class] formatSQLString:_value format:[_attr writeFormat]];
+  _value = [[self class] formatSQLString:_value format:nil];
   [s appendString:_value];
   
   [self appendItem:s toListString:[self listString]];
index 2d7e5cca1d4ac23f6336247d84dbc02025358146..ccf08d9b10578d9ca5785f9e8ea89c9c5bcdbb3f 100644 (file)
@@ -88,7 +88,7 @@ static EONull *null          = nil;
   adaptor = [context adaptor];
   
   if ([source isKindOfClass:AttributeClass]) {
-    formattedLeft = [source expressionValueForContext:context];
+    formattedLeft = [(EOAttribute *)source expressionValueForContext:context];
   }
   else {
     NSAssert([destination isKindOfClass:AttributeClass],
@@ -103,7 +103,8 @@ static EONull *null          = nil;
   if ([destination isKindOfClass:AttributeClass]) {
     NSString *tmp = formattedLeft;
     
-    formattedLeft  = [destination expressionValueForContext:context];
+    formattedLeft  = 
+      [(EOAttribute *)destination expressionValueForContext:context];
     formattedRight = tmp;
   }
   else {
@@ -405,21 +406,7 @@ static EONull *null          = nil;
 static void
 handle_attribute(EOSQLQualifier *self, id object, id _relationshipPaths)
 {
-  if ([object isFlattened]) {
-    id      definitionArray = nil;
-    id      relsArray       = nil;    
-    NSRange range;
-
-    definitionArray = [object definitionArray];
-    range           = NSMakeRange(0, [definitionArray count] - 1);
-    relsArray       = [definitionArray subarrayWithRange:range];
-
-    [self->relationshipPaths addObject:relsArray];
-    [self->additionalEntities addObjectsFromArray:relsArray];
-  }
-  else {
-    [self->additionalEntities addObject:[object entity]];
-  }
+  [self->additionalEntities addObject:[object entity]];
 }
 
 - (void)_computeRelationshipPaths:(NSArray *)_relationshipPaths {
index 2c750a3d02416bde781f0b39c095fa953d35e9d1..f6340db36d7a819fe4bf1231382ca92cf273bf15 100644 (file)
 {
   NSString *alias;
   NSString *columnName;
-  NSString *selectFormat;
   
-  alias        = [entitiesAndPropertiesAliases objectForKey:context];
-  selectFormat = [attribute selectFormat];
+  alias = [entitiesAndPropertiesAliases objectForKey:context];
   
   //NSLog(@"entitiesAndPropertiesAliases: %@", entitiesAndPropertiesAliases);
   
-  if (selectFormat) {
-    PrintfFormatScanner    *formatScanner;
-    EOSelectScannerHandler *scannerHandler;
-
-    formatScanner = 
-      [[[[PrintfFormatScanner alloc] init] setAllowOnlySpecifier:YES] 
-       autorelease];
-    scannerHandler = 
-      [[[EOSelectScannerHandler alloc] init] autorelease];
-    
-    [scannerHandler setAttribute:attribute adaptor:adaptor alias:alias];
-    [formatScanner  setFormatScannerHandler:scannerHandler];
-#if defined(__s390__)
-    return [formatScanner performSelector:
-                           @selector(stringWithFormat:arguments:)
-                         withObject:selectFormat
-                         withObject:nil];
-#else
-    return [formatScanner stringWithFormat:selectFormat arguments:NULL];
-#endif
-  }
-  else {
     columnName = adaptor
       ? [adaptor formatAttribute:attribute]
       : [attribute columnName];
     }
     
     return columnName;
-  }
 }
 
 @end /* EOSelectSQLExpression */
 
 @implementation EOSelectScannerHandler
 
-- (id)init
-{
-    [super init];
-
+- (id)init {
+  if ((self = [super init]) != nil) {
     specHandler['A']
-            = [self methodForSelector:@selector(convertAttribute:scanner:)];
-    return self;
+      = [self methodForSelector:@selector(convertAttribute:scanner:)];
+  }
+  return self;
 }
 
-- (void)dealloc
-{
-    RELEASE(self->attribute);
-    RELEASE(self->adaptor);
-    RELEASE(self->alias);
-    [super dealloc];
+- (void)dealloc {
+  [self->attribute release];
+  [self->adaptor   release];
+  [self->alias     release];
+  [super dealloc];
 }
 
 - (void)setAttribute:(EOAttribute*)_attribute
index 9c2df247a496f1acd4f3a8921372e447845bb7ef..704a8fa27d1346e21ef88404845e691f6c157dca 100644 (file)
@@ -1,3 +1,3 @@
 # version file
 
-SUBMINOR_VERSION:=48
+SUBMINOR_VERSION:=49