2003-01-31 Manuel Guesdon <mguesdon@orange-concept.com>

* EOAccess/EOAdaptorChannel.m:
		o replaced NSDebugMLLog by EOFLOGObjectLevel/EOFLOGObjectLevelArgs
	* EOAccess/EOAttribute.m:
		o replaced NSDebugMLLog by EOFLOGObjectLevel/EOFLOGObjectLevelArgs
	* EOAccess/EODatabaseChannel.m:
		o replaced NSDebugMLLog by EOFLOGObjectLevel/EOFLOGObjectLevelArgs
		o Move registration for EODatabaseChannelNeddedNotification
			from +load to +initialize. (David Ayers <d.ayers@inode.at>)
	* EOAccess/EODatabaseContext.m:
		o Move registration for EODatabaseChannelNeddedNotification
			from +load to +initialize. (David Ayers <d.ayers@inode.at>)
	* EOAccess/EOEntity.m:
		o in - (void) _setIsEdited, autorelease instead of destroy
	* EOAccess/EORelationship.m
		o -validateValue: don't raise not implemented exception
		o initialize variables in -foreignKeyInDestination
	* EOAccess/EOSQLExpression.m:
		o added NSAsserts
		o use anyRelationshipNamed: instead of relationshipNamed: to
			find hidden relationships
	* EOControl/EOClassDescription.m
		o -displayNameForKey: use -stringWithCapacity instead
			of +alloc -initWithCapacity (missing autorelease)
		o -validationExceptionWithFormat: initialize variables
		o -aggregateExceptionWithExceptions: initialize variables
		o -aggregateExceptionWithExceptions: autorelease copied value
		o -exceptionAddingEntriesToUserInfo: initialize variables
		o -exceptionAddingEntriesToUserInfo: autorelease copied userInfo
		o -snapshot autorelease copied value
		o -updateFromSnapshot: autorelease copied value
	* EOControl/EOFetchSpecification.h:
		o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:isDeep:hints:
		o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:
	* EOControl/EOFetchSpecification.m:
		o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:isDeep:hints:
		o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:
		o removed +fetchSpecificationNamed:entityNamed: (implemented in EOUtilities)
		o Insure that EODatabaseContext is initialized early. (David Ayers <d.ayers@inode.at>)
	* EOControl/EOGenericRecord.m
		o in -eoFormatSizeDictionary: handle /0
		o in +eoCalculateAllSizeWith: don't de-fault objects
		o in +eoCalculateAllSizeWith: manage a local autorelease pool
	* EOControl/EOKeyValueCoding.h:
		o added -smartTakeValue:forKey:
		o -smartTakeValue:forKeyPath:
		o -storedValuesForKeyPaths:
	* EOControl/EOGlobalID.m:
		o Insure that EODatabaseContext is initialized early. (David Ayers <d.ayers@inode.at>)
	* EOControl/EOQualifier.m:
		o +operatorSelectorForString:]): Parse 'doesContain' instead of
			'contains' (David Ayers <d.ayers@inode.at>)
	* EOControl/EODebug.m:
		o include NSDebug.h


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@15845 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2003-02-01 15:19:56 +00:00
parent 41dab71fd5
commit 16461488fd
17 changed files with 292 additions and 129 deletions

View file

@ -1,3 +1,58 @@
2003-01-31 Manuel Guesdon <mguesdon@orange-concept.com>
* EOAccess/EOAdaptorChannel.m:
o replaced NSDebugMLLog by EOFLOGObjectLevel/EOFLOGObjectLevelArgs
* EOAccess/EOAttribute.m:
o replaced NSDebugMLLog by EOFLOGObjectLevel/EOFLOGObjectLevelArgs
* EOAccess/EODatabaseChannel.m:
o replaced NSDebugMLLog by EOFLOGObjectLevel/EOFLOGObjectLevelArgs
o Move registration for EODatabaseChannelNeddedNotification
from +load to +initialize. (David Ayers <d.ayers@inode.at>)
* EOAccess/EODatabaseContext.m:
o Move registration for EODatabaseChannelNeddedNotification
from +load to +initialize. (David Ayers <d.ayers@inode.at>)
* EOAccess/EOEntity.m:
o in - (void) _setIsEdited, autorelease instead of destroy
* EOAccess/EORelationship.m
o -validateValue: don't raise not implemented exception
o initialize variables in -foreignKeyInDestination
* EOAccess/EOSQLExpression.m:
o added NSAsserts
o use anyRelationshipNamed: instead of relationshipNamed: to
find hidden relationships
* EOControl/EOClassDescription.m
o -displayNameForKey: use -stringWithCapacity instead
of +alloc -initWithCapacity (missing autorelease)
o -validationExceptionWithFormat: initialize variables
o -aggregateExceptionWithExceptions: initialize variables
o -aggregateExceptionWithExceptions: autorelease copied value
o -exceptionAddingEntriesToUserInfo: initialize variables
o -exceptionAddingEntriesToUserInfo: autorelease copied userInfo
o -snapshot autorelease copied value
o -updateFromSnapshot: autorelease copied value
* EOControl/EOFetchSpecification.h:
o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:isDeep:hints:
o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:
* EOControl/EOFetchSpecification.m:
o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:isDeep:hints:
o added +fetchSpecificationWithEntityName:qualifier:sortOrderings:usesDistinct:
o removed +fetchSpecificationNamed:entityNamed: (implemented in EOUtilities)
o Insure that EODatabaseContext is initialized early. (David Ayers <d.ayers@inode.at>)
* EOControl/EOGenericRecord.m
o in -eoFormatSizeDictionary: handle /0
o in +eoCalculateAllSizeWith: don't de-fault objects
o in +eoCalculateAllSizeWith: manage a local autorelease pool
* EOControl/EOKeyValueCoding.h:
o added -smartTakeValue:forKey:
o -smartTakeValue:forKeyPath:
o -storedValuesForKeyPaths:
* EOControl/EOGlobalID.m:
o Insure that EODatabaseContext is initialized early. (David Ayers <d.ayers@inode.at>)
* EOControl/EOQualifier.m:
o +operatorSelectorForString:]): Parse 'doesContain' instead of
'contains' (David Ayers <d.ayers@inode.at>)
* EOControl/EODebug.m:
o include NSDebug.h
2003-01-21 David Ayers <d.ayers@inode.at>
* EOControl/EOQualifier.m ([EOQualifier +allQualifierOperators]):

View file

@ -171,10 +171,10 @@ inRowsDescribedByQualifier: (EOQualifier *)qualifier
BOOL isEqual = YES;
EOFLOGObjectFnStart();
NSDebugMLLog(@"gsdb", @"attrs=%@", attrs);
NSDebugMLLog(@"gsdb", @"entity=%@", entity);
NSDebugMLLog(@"gsdb", @"qualifier=%@" ,qualifier);
NSDebugMLLog(@"gsdb", @"snapshot=%@", snapshot);
EOFLOGObjectLevelArgs(@"gsdb", @"attrs=%@", attrs);
EOFLOGObjectLevelArgs(@"gsdb", @"entity=%@", entity);
EOFLOGObjectLevelArgs(@"gsdb", @"qualifier=%@" ,qualifier);
EOFLOGObjectLevelArgs(@"gsdb", @"snapshot=%@", snapshot);
if (attrs)
attributes = [[attrs mutableCopy] autorelease];
@ -196,7 +196,7 @@ inRowsDescribedByQualifier: (EOQualifier *)qualifier
row = [self fetchRowWithZone: NULL];
NSDebugMLLog(@"gsdb", @"row=%@", row);
EOFLOGObjectLevelArgs(@"gsdb", @"row=%@", row);
if(row == nil || [self fetchRowWithZone: NULL] != nil)
{
@ -401,23 +401,23 @@ inRowsDescribedByQualifier: (EOQualifier *)qualifier
@selector(name)]];
};
NSDebugMLLog(@"gsdb",
EOFLOGObjectLevelArgs(@"gsdb",
@"\ndictionaryWithObjects:forAttributes:zone: attributes=%@ objects=%p\n",
attributes,objects);
NSAssert(initializer,@"No initializer");
NSDebugMLLog(@"gsdb", @"initializer=%@", initializer);
EOFLOGObjectLevelArgs(@"gsdb", @"initializer=%@", initializer);
dict = [[[EOMutableKnownKeyDictionary allocWithZone: zone]
initWithInitializer:initializer] autorelease];
NSDebugMLLog(@"gsdb", @"dict=%@", dict);
EOFLOGObjectLevelArgs(@"gsdb", @"dict=%@", dict);
for(i = 0; i < count; i++)
{
EOAttribute *attribute = (EOAttribute *)[attributes objectAtIndex: i];
NSDebugMLLog(@"gsdb", @"Attribute=%@ value=%@", attribute, objects[i]);
EOFLOGObjectLevelArgs(@"gsdb", @"Attribute=%@ value=%@", attribute, objects[i]);
[dict setObject: objects[i]
forKey: [attribute name]];
@ -474,14 +474,14 @@ inRowsDescribedByQualifier: (EOQualifier *)qualifier
//2fois
//...
NSDebugMLLog(@"gsdb", @"adaptorOperation=%@", adaptorOperation);
EOFLOGObjectLevelArgs(@"gsdb", @"adaptorOperation=%@", adaptorOperation);
entity = [adaptorOperation entity];
operator = [adaptorOperation adaptorOperator];
changedValues = [adaptorOperation changedValues];
NSDebugMLLog(@"gsdb", @"ad op: %d %@", operator, [entity name]);
NSDebugMLLog(@"gsdb", @"ad op: %@ %@", [adaptorOperation changedValues], [adaptorOperation qualifier]);
EOFLOGObjectLevelArgs(@"gsdb", @"ad op: %d %@", operator, [entity name]);
EOFLOGObjectLevelArgs(@"gsdb", @"ad op: %@ %@", [adaptorOperation changedValues], [adaptorOperation qualifier]);
NS_DURING
switch(operator)

View file

@ -90,11 +90,11 @@ static NSString *defaultCalendarFormat = @"%b %d %Y %H:%M";
[self setName: [propertyList objectForKey: @"name"]];
NSDebugMLLog(@"gsdb", @"Attribute parent=%p %@",
EOFLOGObjectLevelArgs(@"gsdb", @"Attribute parent=%p %@",
owner, [(EOEntity *)owner name]);
[self setParent: owner];
// NSDebugMLLog(@"gsdb", @"Attribute Entity=%@", [self entity]);
// EOFLOGObjectLevel(@"gsdb", @"Attribute Entity=%@", [self entity]);
tmpString = [propertyList objectForKey: @"prototypeName"];
if (tmpString)
@ -214,13 +214,13 @@ static NSString *defaultCalendarFormat = @"%b %d %Y %H:%M";
if (tmpString)
[self setDocComment: tmpString];
NSDebugMLLog(@"gsdb", @"Attribute name=%@", _name);
EOFLOGObjectLevelArgs(@"gsdb", @"Attribute name=%@", _name);
tmpString = [propertyList objectForKey: @"isReadOnly"];
NSDebugMLLog(@"gsdb", @"tmpString=%@", tmpString);
EOFLOGObjectLevelArgs(@"gsdb", @"tmpString=%@", tmpString);
[self setReadOnly: [tmpString isEqual: @"Y"]];
NSDebugMLLog(@"gsdb", @"tmpString=%@", tmpString);
EOFLOGObjectLevelArgs(@"gsdb", @"tmpString=%@", tmpString);
}
return self;
@ -242,7 +242,8 @@ static NSString *defaultCalendarFormat = @"%b %d %Y %H:%M";
if (columnName)
[self setColumnName: columnName];
NSDebugMLLog(@"gsdb", @"Attribute %@ awakeWithPropertyList:%@", self, propertyList);
EOFLOGObjectLevelArgs(@"gsdb", @"Attribute %@ awakeWithPropertyList:%@",
self, propertyList);
}
- (void)encodeIntoPropertyList: (NSMutableDictionary *)propertyList
@ -388,11 +389,11 @@ static NSString *defaultCalendarFormat = @"%b %d %Y %H:%M";
NSString *definition = nil;
// EOFLOGObjectFnStart();
// NSDebugMLLog(@"gsdb",@"_definitionArray:%@",_definitionArray);
// EOFLOGObjectLevel(@"gsdb",@"_definitionArray:%@",_definitionArray);
definition=[_definitionArray valueForSQLExpression: nil];
// NSDebugMLLog(@"gsdb",@"definition:%@",definition);
// EOFLOGObjectLevel(@"gsdb",@"definition:%@",definition);
// EOFLOGObjectFnStop();
return definition;
@ -538,7 +539,7 @@ A Flattened attribute is also a derived attributes.
{
NSString *value=nil;
// NSDebugMLLog(@"gsdb",@"EOAttribute %p",self);
// EOFLOGObjectLevel(@"gsdb",@"EOAttribute %p",self);
NSEmitTODO(); //TODO
if (_definitionArray)

View file

@ -1,7 +1,7 @@
/**
EODatabaseChannel.m <title>EODatabaseChannel</title>
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2003 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
Date: June 2000
@ -68,13 +68,16 @@ RCS_ID("$Id$")
@implementation EODatabaseChannel
+ (void)load
+ (void)initialize
{
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_registerDatabaseChannel:)
name: EODatabaseChannelNeededNotification
object: nil];
if (self == [EODatabaseChannel class])
{
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_registerDatabaseChannel:)
name: EODatabaseChannelNeededNotification
object: nil];
}
}
+ (void)_registerDatabaseChannel: (NSNotification *)notification
@ -137,7 +140,7 @@ RCS_ID("$Id$")
int i = 0;
int count = [relationships count];
NSDebugMLLog(@"gsdb", @"relationships=%@", relationships);
EOFLOGObjectLevelArgs(@"gsdb", @"relationships=%@", relationships);
for (i = 0; i < count; i++)
{
@ -147,15 +150,15 @@ RCS_ID("$Id$")
EOEntity *entity = [relationship entity];
EOModel *entityModel = [entity model];
NSDebugMLLog(@"gsdb", @"relationship=%@", relationship);
NSDebugMLLog(@"gsdb", @"destinationEntity=%@", [destinationEntity name]);
EOFLOGObjectLevelArgs(@"gsdb", @"relationship=%@", relationship);
EOFLOGObjectLevelArgs(@"gsdb", @"destinationEntity=%@", [destinationEntity name]);
NSAssert2(destinationEntity, @"No destinationEntity in relationship: %@ of entity %@",
relationship, [entity name]); //TODO: flattened relationship
NSDebugMLLog(@"gsdb", @"entity=%@", [entity name]);
NSDebugMLLog(@"gsdb", @"destinationEntityModel=%p", destinationEntityModel);
NSDebugMLLog(@"gsdb", @"entityModel=%p", entityModel);
EOFLOGObjectLevelArgs(@"gsdb", @"entity=%@", [entity name]);
EOFLOGObjectLevelArgs(@"gsdb", @"destinationEntityModel=%p", destinationEntityModel);
EOFLOGObjectLevelArgs(@"gsdb", @"entityModel=%p", entityModel);
//If different: try to add destinationEntityModel
if (destinationEntityModel != entityModel)
@ -214,42 +217,42 @@ RCS_ID("$Id$")
entityName = [fetch entityName];
database = [_databaseContext database];
NSDebugMLLog(@"gsdb", @"database=%@", database);
EOFLOGObjectLevelArgs(@"gsdb", @"database=%@", database);
entity = [database entityNamed: entityName];
NSDebugMLLog(@"gsdb", @"entity name=%@", [entity name]);
EOFLOGObjectLevelArgs(@"gsdb", @"entity name=%@", [entity name]);
qualifier=[fetch qualifier];
NSDebugMLLog(@"gsdb", @"qualifier=%@", qualifier);
EOFLOGObjectLevelArgs(@"gsdb", @"qualifier=%@", qualifier);
schemaBasedQualifier =
[(id<EOQualifierSQLGeneration>)qualifier
schemaBasedQualifierWithRootEntity: entity];
NSDebugMLLog(@"gsdb", @"schemaBasedQualifier=%@", schemaBasedQualifier);
NSDebugMLLog(@"gsdb", @"qualifier=%@", qualifier);
EOFLOGObjectLevelArgs(@"gsdb", @"schemaBasedQualifier=%@", schemaBasedQualifier);
EOFLOGObjectLevelArgs(@"gsdb", @"qualifier=%@", qualifier);
if (schemaBasedQualifier && schemaBasedQualifier != qualifier)
{
EOFetchSpecification *newFetch = nil;
NSDebugMLLog(@"gsdb", @"fetch=%@", fetch);
EOFLOGObjectLevelArgs(@"gsdb", @"fetch=%@", fetch);
//howto avoid copy of uncopiable qualifiers (i.e. those who contains uncopiable key or value)
NSDebugMLLog(@"gsdb", @"fetch=%@", fetch);
EOFLOGObjectLevelArgs(@"gsdb", @"fetch=%@", fetch);
newFetch = [[fetch copy] autorelease];
NSDebugMLLog(@"gsdb", @"newFetch=%@", newFetch);
EOFLOGObjectLevelArgs(@"gsdb", @"newFetch=%@", newFetch);
[newFetch setQualifier: schemaBasedQualifier];
NSDebugMLLog(@"gsdb", @"newFetch=%@", newFetch);
EOFLOGObjectLevelArgs(@"gsdb", @"newFetch=%@", newFetch);
fetch = newFetch;
}
NSDebugMLLog(@"gsdb", @"%@ -- %@ 0x%x: isFetchInProgress=%s",
EOFLOGObjectLevelArgs(@"gsdb", @"%@ -- %@ 0x%x: isFetchInProgress=%s",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
@ -296,7 +299,7 @@ RCS_ID("$Id$")
row = [_adaptorChannel fetchRowWithZone: NULL];
NSDebugMLLog(@"gsdb", @"row=%@", row);
EOFLOGObjectLevelArgs(@"gsdb", @"row=%@", row);
//NSDebugMLog(@"TEST attributesToFetch=%@", [_currentEntity attributesToFetch]);
if (!row)
@ -320,12 +323,12 @@ RCS_ID("$Id$")
gid = [_currentEntity globalIDForRow: row
isFinal: YES];//OK
NSDebugMLLog(@"gsdb", @"gid=%@", gid);
EOFLOGObjectLevelArgs(@"gsdb", @"gid=%@", gid);
//NSDebugMLog(@"TEST attributesToFetch=%@",[_currentEntity attributesToFetch]);
object = [_currentEditingContext objectForGlobalID: gid]; //OK //nil
NSDebugMLLog(@"gsdb", @"object=%@", object);
EOFLOGObjectLevelArgs(@"gsdb", @"object=%@", object);
if (object)
isObjectNew = NO;
@ -334,16 +337,16 @@ RCS_ID("$Id$")
snapshot = [_databaseContext snapshotForGlobalID: gid]; //OK
NSDebugMLLog(@"gsdb", @"snapshot=%@", snapshot);
EOFLOGObjectLevelArgs(@"gsdb", @"snapshot=%@", snapshot);
//NSDebugMLog(@"TEST attributesToFetch=%@", [_currentEntity attributesToFetch]);
if (snapshot)
{
NSDebugMLLog(@"gsdb", @"_delegateRespondsTo.shouldUpdateSnapshot=%d",
EOFLOGObjectLevelArgs(@"gsdb", @"_delegateRespondsTo.shouldUpdateSnapshot=%d",
(int)_delegateRespondsTo.shouldUpdateSnapshot);
NSDebugMLLog(@"gsdb", @"[self isLocking]=%d",
EOFLOGObjectLevelArgs(@"gsdb", @"[self isLocking]=%d",
(int)[self isLocking]);
NSDebugMLLog(@"gsdb", @"[self isRefreshingObjects]=%d",
EOFLOGObjectLevelArgs(@"gsdb", @"[self isRefreshingObjects]=%d",
(int)[self isRefreshingObjects]);
//mirko:
@ -357,8 +360,8 @@ RCS_ID("$Id$")
globalID: gid
databaseChannel: self])))
{ // TODO delegate not correct !
NSDebugMLLog(@"gsdb", @"Updating Snapshot=%@", snapshot);
NSDebugMLLog(@"gsdb", @"row=%@", row);
EOFLOGObjectLevelArgs(@"gsdb", @"Updating Snapshot=%@", snapshot);
EOFLOGObjectLevelArgs(@"gsdb", @"row=%@", row);
[_databaseContext recordSnapshot: row
forGlobalID: gid];
@ -368,7 +371,7 @@ RCS_ID("$Id$")
else
{
//NSDebugMLog(@"TEST attributesToFetch=%@", [_currentEntity attributesToFetch]);
NSDebugMLLog(@"gsdb", @"database class=%@", [database class]);
EOFLOGObjectLevelArgs(@"gsdb", @"database class=%@", [database class]);
NSAssert(database, @"No database-context database");
@ -376,7 +379,7 @@ RCS_ID("$Id$")
forGlobalID: gid];
}
NSDebugMLLog(@"gsdb", @"[self isRefreshingObjects]=%d",
EOFLOGObjectLevelArgs(@"gsdb", @"[self isRefreshingObjects]=%d",
(int)[self isRefreshingObjects]);
//From mirko
@ -399,7 +402,7 @@ RCS_ID("$Id$")
zone: NULL];
//NSDebugMLog(@"TEST attributesToFetch=%@", [_currentEntity attributesToFetch]);
NSDebugMLLog(@"gsdb", @"object=%@", object);
EOFLOGObjectLevelArgs(@"gsdb", @"object=%@", object);
NSAssert1(object, @"No Object. entityClassDescripton=%@", entityClassDescripton);
[_currentEditingContext recordObject: object
@ -430,7 +433,7 @@ RCS_ID("$Id$")
NS_DURING
{
NSDebugMLLog(@"gsdb", @"Initialize %p", object);
EOFLOGObjectLevelArgs(@"gsdb", @"Initialize %p", object);
[_currentEditingContext initializeObject: object
withGlobalID: gid
@ -629,26 +632,26 @@ RCS_ID("$Id$")
EOAdaptor *adaptor = nil;
Class expressionClass = Nil;
NSDebugMLLog(@"gsdb", @"customQueryExpressionHint=%@", customQueryExpressionHint);
EOFLOGObjectLevelArgs(@"gsdb", @"customQueryExpressionHint=%@", customQueryExpressionHint);
adaptorContext = [_databaseContext adaptorContext];
NSDebugMLLog(@"gsdb", @"adaptorContext=%p", adaptorContext);
EOFLOGObjectLevelArgs(@"gsdb", @"adaptorContext=%p", adaptorContext);
adaptor = [adaptorContext adaptor];
NSDebugMLLog(@"gsdb", @"adaptor=%p", adaptor);
NSDebugMLLog(@"gsdb", @"adaptor=%@", adaptor);
NSDebugMLLog(@"gsdb", @"adaptor class=%@", [adaptor class]);
EOFLOGObjectLevelArgs(@"gsdb", @"adaptor=%p", adaptor);
EOFLOGObjectLevelArgs(@"gsdb", @"adaptor=%@", adaptor);
EOFLOGObjectLevelArgs(@"gsdb", @"adaptor class=%@", [adaptor class]);
//TODO VERIFY
expressionClass = [adaptor expressionClass];
NSDebugMLLog(@"gsdb", @"expressionClass=%@", expressionClass);
EOFLOGObjectLevelArgs(@"gsdb", @"expressionClass=%@", expressionClass);
customQueryExpression = [expressionClass expressionForString:
customQueryExpressionHint];
NSDebugMLLog(@"gsdb", @"customQueryExpression=%@", customQueryExpression);
EOFLOGObjectLevelArgs(@"gsdb", @"customQueryExpression=%@", customQueryExpression);
}
[self setCurrentEditingContext: context]; //OK even if customQueryExpressionHintKey
@ -659,7 +662,7 @@ RCS_ID("$Id$")
if (!customQueryExpressionHint)
{
subEntities = [entity subEntities];
NSDebugMLLog(@"gsdb", @"subEntities=%@", subEntities);
EOFLOGObjectLevelArgs(@"gsdb", @"subEntities=%@", subEntities);
//Strange
{
@ -725,7 +728,7 @@ RCS_ID("$Id$")
NSAssert([propertiesToFetch count] > 0, @"No properties to fetch");
NSDebugMLLog(@"gsdb", @"%@ -- %@ 0x%x: isFetchInProgress=%s",
EOFLOGObjectLevelArgs(@"gsdb", @"%@ -- %@ 0x%x: isFetchInProgress=%s",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
@ -737,7 +740,7 @@ RCS_ID("$Id$")
entity: entity];
}
NSDebugMLLog(@"gsdb", @"%@ -- %@ 0x%x: isFetchInProgress=%s",
EOFLOGObjectLevelArgs(@"gsdb", @"%@ -- %@ 0x%x: isFetchInProgress=%s",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
@ -779,7 +782,7 @@ RCS_ID("$Id$")
attributesToFetch = [_currentEntity attributesToFetch];//done
NSDebugMLLog(@"gsdb",@"[_adaptorChannel class]: %@",[_adaptorChannel class]);
EOFLOGObjectLevelArgs(@"gsdb",@"[_adaptorChannel class]: %@",[_adaptorChannel class]);
[_adaptorChannel selectAttributes:attributesToFetch
fetchSpecification:fetch
lock:_isLocking

View file

@ -30,6 +30,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSHashTable.h>
#import <Foundation/NSMapTable.h>
#import <Foundation/NSLock.h>
#import <EOControl/EOObjectStoreCoordinator.h>
@ -48,7 +49,6 @@
@class EODatabaseChannel;
@class EODatabaseOperation;
typedef enum {
EOUpdateWithOptimisticLocking,
EOUpdateWithPessimisticLocking,

View file

@ -1,7 +1,7 @@
/**
EODatabaseContext.m <title>EODatabaseContext Class</title>
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2003 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
Date: June 2000
@ -104,19 +104,17 @@ NSString *EOFailedDatabaseOperationKey = @"EOFailedDatabaseOperationKey";
static Class _contextClass = Nil;
+ (void)load
{
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_registerDatabaseContext:)
name: EOCooperatingObjectStoreNeeded
object: nil];
}
+ (void)initialize
{
if (!_contextClass)
_contextClass = [EODatabaseContext class];
{
_contextClass = [EODatabaseContext class];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_registerDatabaseContext:)
name: EOCooperatingObjectStoreNeeded
object: nil];
}
}
+ (EODatabaseContext*)databaseContextWithDatabase: (EODatabase *)database

View file

@ -3323,6 +3323,8 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
EOFLOGObjectFnStop();
}
//DESTROY v later because it may be still in use
#define AUTORELEASE_SETNIL(v) { AUTORELEASE(v); v=nil; }
- (void) _setIsEdited
{
EOFLOGObjectLevelArgs(@"EOEntity", @"START entity name=%@", [self name]);
@ -3339,64 +3341,64 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
EOFLOGObjectLevelArgs(@"EOEntity", @"_classPropertyNames: void:%p [%p] %s",
(void*)nil, (void*)_classPropertyNames,
(_classPropertyNames ? "Not NIL" : "NIL"));
DESTROY(_classPropertyNames);
AUTORELEASE_SETNIL(_classPropertyNames);
EOFLOGObjectLevelArgs(@"EOEntity", @"_primaryKeyAttributeNames: %p %s",
(void*)_primaryKeyAttributeNames,
(_primaryKeyAttributeNames ? "Not NIL" : "NIL"));
DESTROY(_primaryKeyAttributeNames);
AUTORELEASE_SETNIL(_primaryKeyAttributeNames);
EOFLOGObjectLevelArgs(@"EOEntity", @"_classPropertyAttributeNames: %p %s",
_classPropertyAttributeNames,
(_classPropertyAttributeNames ? "Not NIL" : "NIL"));
DESTROY(_classPropertyAttributeNames);
AUTORELEASE_SETNIL(_classPropertyAttributeNames);
EOFLOGObjectLevelArgs(@"EOEntity", @"_classPropertyToOneRelationshipNames: %p %s",
_classPropertyToOneRelationshipNames,
(_classPropertyToOneRelationshipNames ? "Not NIL" : "NIL"));
DESTROY(_classPropertyToOneRelationshipNames);
AUTORELEASE_SETNIL(_classPropertyToOneRelationshipNames);
EOFLOGObjectLevelArgs(@"EOEntity", @"_classPropertyToManyRelationshipNames: %p %s",
_classPropertyToManyRelationshipNames,
(_classPropertyToManyRelationshipNames ? "Not NIL" : "NIL"));
DESTROY(_classPropertyToManyRelationshipNames);
AUTORELEASE_SETNIL(_classPropertyToManyRelationshipNames);
EOFLOGObjectLevelArgs(@"EOEntity", @"_attributesToFetch: %p %s",
_attributesToFetch,
(_attributesToFetch ? "Not NIL" : "NIL"));
DESTROY(_attributesToFetch);
AUTORELEASE_SETNIL(_attributesToFetch);
EOFLOGObjectLevelArgs(@"EOEntity", @"_dbSnapshotKeys: %p %s",
_dbSnapshotKeys, (_dbSnapshotKeys ? "Not NIL" : "NIL"));
DESTROY(_dbSnapshotKeys);
AUTORELEASE_SETNIL(_dbSnapshotKeys);
EOFLOGObjectLevelArgs(@"EOEntity", @"_attributesToSave: %p %s",
_attributesToSave, (_attributesToSave ? "Not NIL" : "NIL"));
DESTROY(_attributesToSave);
AUTORELEASE_SETNIL(_attributesToSave);
EOFLOGObjectLevelArgs(@"EOEntity", @"_propertiesToFault: %p %s",
_propertiesToFault, (_propertiesToFault ? "Not NIL" : "NIL"));
DESTROY(_propertiesToFault);
AUTORELEASE_SETNIL(_propertiesToFault);
EOFLOGObjectLevelArgs(@"EOEntity", @"_adaptorDictionaryInitializer: %p %s",
_adaptorDictionaryInitializer,
(_adaptorDictionaryInitializer ? "Not NIL" : "NIL"));
DESTROY(_adaptorDictionaryInitializer);
AUTORELEASE_SETNIL(_adaptorDictionaryInitializer);
EOFLOGObjectLevelArgs(@"EOEntity", @"_snapshotDictionaryInitializer: %p %s",
_snapshotDictionaryInitializer,
(_snapshotDictionaryInitializer ? "Not NIL" : "NIL"));
DESTROY(_snapshotDictionaryInitializer);
AUTORELEASE_SETNIL(_snapshotDictionaryInitializer);
EOFLOGObjectLevelArgs(@"EOEntity",@"_primaryKeyDictionaryInitializer: %p %s",
_primaryKeyDictionaryInitializer,
(_primaryKeyDictionaryInitializer ? "Not NIL" : "NIL"));
DESTROY(_primaryKeyDictionaryInitializer);
AUTORELEASE_SETNIL(_primaryKeyDictionaryInitializer);
EOFLOGObjectLevelArgs(@"EOEntity",@"_propertyDictionaryInitializer: %p %s",
_propertyDictionaryInitializer,
(_propertyDictionaryInitializer ? "Not NIL" : "NIL"));
DESTROY(_propertyDictionaryInitializer);
AUTORELEASE_SETNIL(_propertyDictionaryInitializer);
//TODO call _flushCache on each attr
NSAssert4(!_attributesToFetch

View file

@ -1684,7 +1684,10 @@ becomes "name", and "FIRST_NAME" becomes "firstName".*/
if (!exception)
{
NSEmitTODO(); //TODO
[self notImplemented:_cmd]; //TODO
NSDebugMLog(@"relationship=%@ valueP=%p",self,valueP);
if (valueP)
NSDebugMLog(@"*valueP=%@",*valueP);
//[self notImplemented:_cmd]; //TODO
}
EOFLOGObjectFnStop();
@ -1980,10 +1983,10 @@ becomes "name", and "FIRST_NAME" becomes "firstName".*/
- (BOOL)foreignKeyInDestination
{
NSArray *destAttributes;
NSArray *primaryKeyAttributes;
int destAttributesCount;
int primaryKeyAttributesCount;
NSArray *destAttributes = nil;
NSArray *primaryKeyAttributes = nil;
int destAttributesCount = nil;
int primaryKeyAttributesCount = nil;
BOOL foreignKeyInDestination = NO;
EOFLOGObjectFnStart();

View file

@ -347,6 +347,9 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey";
currentEntity, [currentEntity name],
externalName);
NSAssert1([externalName length]>0,@"No external name for entity %@",
[currentEntity name]);
[entitiesString appendString: externalName];
if (_useAliases)
@ -366,9 +369,19 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey";
while ((relationshipString = [defEnum nextObject]))
{
currentEntity = [[currentEntity
relationshipNamed: relationshipString]
destinationEntity];
// use anyRelationshipNamed: to find hidden relationship too
EORelationship *relationship=[currentEntity
anyRelationshipNamed: relationshipString];
NSAssert2(relationship,@"No relationship named %@ in entity %@",
relationshipString,
[currentEntity name]);
NSAssert2(currentEntity,@"No destination entity. Entity %@ relationship = %@",
[currentEntity name],
relationship);
currentEntity = [relationship destinationEntity];
}
externalName = [currentEntity externalName];
@ -378,6 +391,9 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey";
currentEntity, [currentEntity name],
externalName);
NSAssert1([externalName length]>0,@"No external name for entity %@",
[currentEntity name]);
[entitiesString appendString: externalName];
if (_useAliases)
@ -1792,13 +1808,25 @@ else if([anAttribute isDerived] == YES)
while ((relationshipString = [defEnum nextObject]))
{
// use anyRelationshipNamed: to find hidden relationship too
EORelationship *relationship=[currentEntity
anyRelationshipNamed: relationshipString];
EOFLOGObjectLevelArgs(@"EOSQLExpression",
@"relationshipString=%@",
relationshipString);
currentEntity = [[currentEntity
relationshipNamed: relationshipString]
destinationEntity];
NSAssert2(relationship,
@"No relationship named %@ in entity %@",
relationshipString,
[currentEntity name]);
NSAssert2(currentEntity,
@"No destination entity. Entity %@ relationship = %@",
[currentEntity name],
relationship);
currentEntity = [relationship destinationEntity];
} // TODO entity
}
@ -2212,6 +2240,7 @@ All relationshipPaths in _aliasesByRelationshipPath are direct paths **/
NSString *relPath = nil;
NSString *part = [pathElements objectAtIndex: i];
// use anyRelationshipNamed: to find hidden relationship too
relationship = [entity anyRelationshipNamed: part];
NSAssert2(relationship,

View file

@ -294,8 +294,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
- (NSString *)displayNameForKey: (NSString *)key
{
const char *s, *ckey = [key cString];
NSMutableString *str = [[NSMutableString alloc] initWithCapacity:
[key length]];
NSMutableString *str = [NSMutableString stringWithCapacity:[key length]];
char c;
BOOL init = NO;
@ -1012,7 +1011,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
snapshot, key, value, value);
value = [value shallowCopy];
value = [[value shallowCopy] autorelease];
NSDebugMLLog(@"gsdb", @"TOMANY snap=%p key=%@ ==> value %p=%@",
snapshot, key, value, value);
@ -1052,7 +1051,7 @@ fromInsertionInEditingContext: (EOEditingContext *)anEditingContext
val = nil;
if ([val isKindOfClass: [NSArray class]])
val = [[[val shallowCopy] autorelease] mutableCopy];
val = [[[[val shallowCopy] autorelease] mutableCopy] autorelease];
[self takeStoredValue: val forKey: key];
}
@ -1515,8 +1514,8 @@ fromBothSidesOfRelationshipWithKey: (NSString *)key
+ (NSException *)validationExceptionWithFormat: (NSString *)format, ...
{
NSException *exp;
NSString *aName;
NSException *exp = nil;
NSString *aName = nil;
va_list args;
va_start(args, format);
@ -1540,14 +1539,14 @@ fromBothSidesOfRelationshipWithKey: (NSString *)key
exp = [subexceptions objectAtIndex: 0];
else if ([subexceptions count] > 1)
{
NSString *aName, *aReason;
NSMutableDictionary *aUserInfo;
NSString *aName = nil, *aReason = nil;
NSMutableDictionary *aUserInfo = nil;
exp = [subexceptions objectAtIndex: 0];
aName = [exp name];
aReason = [exp reason];
aUserInfo = [[exp userInfo] mutableCopy];
aUserInfo = [[[exp userInfo] mutableCopy] autorelease];
[aUserInfo setObject: subexceptions
forKey: EOAdditionalExceptionsKey];
@ -1562,13 +1561,13 @@ fromBothSidesOfRelationshipWithKey: (NSString *)key
- (NSException *)exceptionAddingEntriesToUserInfo: (NSDictionary *)additions
{
NSException *exp;
NSString *aName, *aReason;
NSMutableDictionary *aUserInfo;
NSException *exp = nil;
NSString *aName = nil, *aReason = nil;
NSMutableDictionary *aUserInfo = nil;
aName = [self name];
aReason = [self reason];
aUserInfo = [[self userInfo] mutableCopy];
aUserInfo = [[[self userInfo] mutableCopy] autorelease];
[aUserInfo setObject: [additions allValues]
forKey: EOValidatedObjectUserInfoKey];

View file

@ -1,6 +1,6 @@
/* EODebug.m - <title>debug</title>
Copyright (C) 1999-2002 Free Software Foundation, Inc.
Copyright (C) 1999-2003 Free Software Foundation, Inc.
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 1999
@ -35,6 +35,7 @@ RCS_ID("$Id$")
#import <Foundation/NSThread.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDebug.h>
#include <unistd.h>

View file

@ -82,6 +82,17 @@
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings;
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
usesDistinct: (BOOL)usesDistinct
isDeep: (BOOL)isDeep
hints: (NSDictionary *)hints;
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
usesDistinct: (BOOL)usesDistinct;
- copyWithZone:(NSZone *)zone;

View file

@ -45,10 +45,20 @@ RCS_ID("$Id$")
#import <EOControl/EODebug.h>
#import <EOControl/EONSAddOns.h>
#import <EOControl/EOQualifier.h>
#import <EOAccess/EODatabaseContext.h>
@implementation EOFetchSpecification
+ (void)initialize
{
if (self == [EOFetchSpecification class])
{
[EODatabaseContext class]; // Insure correct initialization.
}
}
+ (EOFetchSpecification *)fetchSpecification
{
return [[[self alloc] init] autorelease];
@ -119,12 +129,6 @@ RCS_ID("$Id$")
return nil;
}
+ (EOFetchSpecification *)fetchSpecificationNamed: (NSString *)name
entityNamed: (NSString *)entityName
{
return nil;
}
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
@ -138,6 +142,36 @@ RCS_ID("$Id$")
hints: nil] autorelease];
}
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
usesDistinct: (BOOL)usesDistinct
isDeep: (BOOL)isDeep
hints: (NSDictionary *)hints
{
return [[[EOFetchSpecification alloc]
initWithEntityName: name
qualifier: qualifier
sortOrderings: sortOrderings
usesDistinct: usesDistinct
isDeep: isDeep
hints: hints] autorelease];
}
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
usesDistinct: (BOOL)usesDistinct
{
return [[[EOFetchSpecification alloc]
initWithEntityName: name
qualifier: qualifier
sortOrderings: sortOrderings
usesDistinct: usesDistinct
isDeep: YES
hints: nil] autorelease];
}
- (id) copyWithZone: (NSZone *)zone
{

View file

@ -933,6 +933,7 @@ infinite loop in description **/
{
EOGenericRecord *record = nil;
NSHashEnumerator hashEnum;
NSAutoreleasePool *arp=nil;
EOFLOGClassFnStart();
//NSDebugMLog(@"CALCULATE START");
@ -941,11 +942,16 @@ infinite loop in description **/
NS_DURING
{
arp = [NSAutoreleasePool new];
hashEnum = NSEnumerateHashTable(allGenericRecords);
while ((record = (EOGenericRecord*)NSNextHashEnumeratorItem(&hashEnum)))
{
[record eoCalculateSizeWith: dict];
if ([EOFault isFault:record])
[EOFault eoCalculateSizeWith: dict
forFault: record];
else
[record eoCalculateSizeWith: dict];
}
NSEndHashTableEnumeration(&hashEnum);
@ -954,6 +960,10 @@ infinite loop in description **/
{
NSDebugMLog(@"%@ (%@)", localException, [localException reason]);
RETAIN(localException);
DESTROY(arp);
AUTORELEASE(localException);
[allGenericRecordsLock unlock];
NSDebugMLog(@"CALCULATE STOPEXC");
@ -961,6 +971,8 @@ infinite loop in description **/
}
NS_ENDHANDLER;
DESTROY(arp);
[allGenericRecordsLock unlock];
//NSDebugMLog(@"CALCULATE STOP");
@ -1182,8 +1194,8 @@ infinite loop in description **/
totalSize,
totalSize / 1024,
totalNb,
(int)(totalSize / totalNb),
(int)(totalSize / totalNb / 1024)];
(int)(totalNb!=0 ? (totalSize / totalNb) : 0),
(int)(totalNb!=0 ? (totalSize / totalNb / 1024) : 0)];
EOFLOGClassFnStop();

View file

@ -1,7 +1,7 @@
/**
EOGlobalID.m <title>EOGlobalID</title>
Copyright (C) 2000-2002 Free Software Foundation, Inc.
Copyright (C) 2000-2003 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
Date: February 2000
@ -44,12 +44,22 @@ RCS_ID("$Id$")
#include <time.h>
#include <unistd.h>
#import <EOAccess/EODatabaseContext.h>
NSString *EOGlobalIDChangedNotification = @"EOGlobalIDChangedNotification";
@implementation EOGlobalID
+ (void)initialize
{
if (self == [EOGlobalID class])
{
[EODatabaseContext class]; // Insure correct initialization.
}
}
- (BOOL)isEqual: other
{
return NO;

View file

@ -36,10 +36,15 @@
@interface NSObject (EOKVCPAdditions2)
- (void)smartTakeValue: (id)anObject
forKey: (NSString *)aKey;
- (void)smartTakeValue: (id)anObject
forKeyPath: (NSString *)aKeyPath;
- (void)takeStoredValue: value
forKeyPath: (NSString *)key;
- (void)takeStoredValuesFromDictionary: (NSDictionary *)dictionary;
- (NSDictionary *)valuesForKeyPaths: (NSArray *)keyPaths;
- (NSDictionary *)storedValuesForKeyPaths: (NSArray *)keyPaths;
@end

View file

@ -695,7 +695,7 @@ static Class whichQualifier(const char **cFormat, const char **s)
return EOQualifierOperatorNotEqual;
else if ([string isEqualToString: @"!="])
return EOQualifierOperatorNotEqual;
else if ([string isEqualToString: @"contains"])
else if ([string isEqualToString: @"doesContain"])
return EOQualifierOperatorContains;
else if ([string isEqualToString: @"like"])
return EOQualifierOperatorLike;