libs-gdl2/EOControl/EOFetchSpecification.m

533 lines
14 KiB
Mathematica
Raw Normal View History

/**
EOFetchSpecification.m <title>EOFetchSpecification</title>
Copyright (C) 2000 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
Date: February 2000
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Database Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
</license>
**/
#include "config.h"
RCS_ID("$Id$")
#import <Foundation/NSCoder.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSDebug.h>
#import <EOControl/EOFetchSpecification.h>
#import <EOControl/EOKeyValueArchiver.h>
#import <EOControl/EOObserver.h>
#import <EOControl/EODebug.h>
#import <EOControl/EONSAddOns.h>
#import <EOControl/EOQualifier.h>
@implementation EOFetchSpecification
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
2003-02-01 15:19:56 +00:00
+ (void)initialize
{
if (self == [EOFetchSpecification class])
{
Class cls = NSClassFromString(@"EODatabaseContext");
if (cls != Nil)
[cls class]; // Insure correct initialization.
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
2003-02-01 15:19:56 +00:00
}
}
+ (EOFetchSpecification *)fetchSpecification
{
return [[[self alloc] init] autorelease];
}
- (id) init
{
if ((self = [super init]))
{
_flags.isDeep = YES;
}
return self;
}
// Turbocat
- (void)dealloc
{
#ifdef DEBUG
NSString *fmt = GSDebugMethodMsg(self, _cmd, __FILE__, __LINE__, @"FNSTOP");
EOFLOGObjectFnStartOrCond(@"EOFetchSpecification");
#endif
DESTROY(_qualifier);
DESTROY(_sortOrderings);
DESTROY(_entityName);
DESTROY(_hints);
DESTROY(_prefetchingRelationshipKeys);
DESTROY(_rawAttributeKeys);
[super dealloc];
#ifdef DEBUG
EOFLOGObjectFnStopOrCondPlain(@"EOFetchSpecification", fmt);
#endif
}
- (id) initWithEntityName: (NSString *)entityName
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
usesDistinct: (BOOL)usesDistinct
isDeep: (BOOL)isDeep
hints: (NSDictionary *)hints
{
if ((self = [self init]))
{
ASSIGN(_entityName, entityName);
ASSIGN(_qualifier, qualifier);
ASSIGN(_sortOrderings, sortOrderings);
[self setUsesDistinct: usesDistinct];
[self setIsDeep: isDeep];
[self setHints: hints];
}
return self;
}
- (EOFetchSpecification *)fetchSpecificationByApplyingBindings: (id)bindings
{
[self notImplemented:_cmd];
return nil;
}
- (EOFetchSpecification *)fetchSpecificationWithQualifierBindings: (NSDictionary *)bindings
{
[self notImplemented: _cmd];
return nil;
}
+ (EOFetchSpecification *)fetchSpecificationNamed: (NSString *)name
entityNamed: (NSString *)entityName
{
return nil;
}
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
2003-02-01 15:19:56 +00:00
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
{
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
2003-02-01 15:19:56 +00:00
return [[[EOFetchSpecification alloc]
initWithEntityName: name
qualifier: qualifier
sortOrderings: sortOrderings
usesDistinct: NO
isDeep: YES
hints: nil] autorelease];
}
+ (EOFetchSpecification *)fetchSpecificationWithEntityName: (NSString *)name
qualifier: (EOQualifier *)qualifier
sortOrderings: (NSArray *)sortOrderings
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
2003-02-01 15:19:56 +00:00
usesDistinct: (BOOL)usesDistinct
isDeep: (BOOL)isDeep
hints: (NSDictionary *)hints
{
return [[[EOFetchSpecification alloc]
initWithEntityName: name
qualifier: qualifier
sortOrderings: sortOrderings
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
2003-02-01 15:19:56 +00:00
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
{
EOFetchSpecification *ret = [EOFetchSpecification allocWithZone:zone];
//order: hints, isdeep, usesDistinct,sortOrderings, qualifier,entityName
//and call nitWithEntityName:qualifier:sortOrderings:usesDistinct:isDeep:hints:
//after:
/* [fetch setLocksObjects:[_fetchSpecification locksObjects]];
[fetch setRefreshesRefetchedObjects:[_fetchSpecification refreshesRefetchedObjects]];
[fetch setPrefetchingRelationshipKeyPaths:[_fetchSpecification prefetchingRelationshipKeyPaths
[fetch setRawRowKeyPaths:[_fetchSpecification rawRowKeyPaths
setFetchLimit:fetchLimit
setPromptsAfterFetchLimit: promptsAfterFetchLimit
setRequiresAllQualifierBindingVariables:requiresAllQualifierBindingVariables
*/
//call setXX fn instead to have "willChange" ??
ret->_qualifier = [(id <NSCopying>)_qualifier copyWithZone: zone];
ret->_sortOrderings = [_sortOrderings copyWithZone: zone]; //mirko: ASSIGN(ret->_sortOrderings, _sortOrderings);
ret->_entityName = [_entityName copyWithZone: zone];
ret->_hints = [_hints copyWithZone: zone];
ret->_prefetchingRelationshipKeys = [_prefetchingRelationshipKeys copyWithZone: zone];
ret->_rawAttributeKeys = [_rawAttributeKeys copyWithZone: zone];
ret->_fetchLimit = _fetchLimit;
ret->_flags = _flags;
return ret;
}
- (void)encodeWithCoder: (NSCoder *)coder
{
[coder encodeObject: _qualifier];
[coder encodeObject: _sortOrderings];
[coder encodeObject: _entityName];
[coder encodeObject: _hints];
[coder encodeValueOfObjCType: @encode(unsigned int) at: &_fetchLimit];
[coder encodeObject: _prefetchingRelationshipKeys];
[coder encodeObject: _rawAttributeKeys];
[coder encodeValueOfObjCType: @encode(unsigned int) at: &_flags];
}
- (id)initWithCoder: (NSCoder *)coder
{
_qualifier = [[coder decodeObject] retain];
_sortOrderings = [[coder decodeObject] retain];
_entityName = [[coder decodeObject] retain];
_hints = [[coder decodeObject] retain];
[coder decodeValueOfObjCType: @encode(unsigned int) at: &_fetchLimit];
_prefetchingRelationshipKeys = [[coder decodeObject] retain];
_rawAttributeKeys = [[coder decodeObject] retain];
[coder decodeValueOfObjCType: @encode(unsigned int) at: &_flags];
return self;
}
- (id) initWithKeyValueUnarchiver: (EOKeyValueUnarchiver*)unarchiver
{
if ((self = [self init]))
{
ASSIGN(_hints, [unarchiver decodeObjectForKey: @"hints"]);
ASSIGN(_qualifier, [unarchiver decodeObjectForKey: @"qualifier"]);
ASSIGN(_sortOrderings, [unarchiver decodeObjectForKey: @"sortOrderings"]);
ASSIGN(_entityName, [unarchiver decodeObjectForKey: @"entityName"]);
ASSIGN(_prefetchingRelationshipKeys,
[unarchiver decodeObjectForKey: @"prefetchingRelationshipKeyPaths"]);
ASSIGN(_rawAttributeKeys, [unarchiver decodeObjectForKey: @"rawRowKeyPaths"]);
_fetchLimit = [unarchiver decodeIntForKey: @"fetchLimit"];
_flags.usesDistinct = [unarchiver decodeBoolForKey: @"usesDistinct"];
_flags.isDeep = [unarchiver decodeBoolForKey: @"isDeep"];
_flags.locksObjects = [unarchiver decodeBoolForKey: @"locksObjects"];
_flags.refreshesRefetchedObjects =
[unarchiver decodeBoolForKey: @"refreshesRefetchedObjects"];
_flags.promptsAfterFetchLimit =
[unarchiver decodeBoolForKey: @"promptsAfterFetchLimit"];
_flags.allVariablesRequiredFromBindings =
[unarchiver decodeBoolForKey: @"requiresAllQualifierBindingVariables"];
}
return self;
}
- (void) encodeWithKeyValueArchiver: (EOKeyValueUnarchiver*)archiver
{
[self notImplemented: _cmd];
}
- (NSString*)description
{
NSMutableString *desc = [NSMutableString string];
[desc appendString: @"{\n"];
[desc appendString: [NSString stringWithFormat: @"hints = %@;\n",
[_hints description]]];
[desc appendString: [NSString stringWithFormat: @"qualifier = %@;\n",
_qualifier]];
[desc appendString: [NSString stringWithFormat: @"sortOrderings = %@;\n",
[_sortOrderings description]]];
[desc appendString: [NSString stringWithFormat: @"entityName = %@;\n",
_entityName]];
[desc appendString: [NSString stringWithFormat: @"prefetchingRelationshipKeyPaths = %@;\n",
[_prefetchingRelationshipKeys description]]];
[desc appendString: [NSString stringWithFormat: @"rawRowKeyPaths = %@;\n",
[_rawAttributeKeys description]]];
[desc appendString: [NSString stringWithFormat: @"fetchLimit = %d;\n",
_fetchLimit]];
[desc appendString: [NSString stringWithFormat: @"usesDistinct = %s;\n",
_flags.usesDistinct ? "YES" : "NO"]];
[desc appendString: [NSString stringWithFormat: @"isDeep = %s;\n",
_flags.isDeep ? "YES" : "NO"]];
[desc appendString: [NSString stringWithFormat: @"locksObjects = %s;\n",
_flags.locksObjects ? "YES" : "NO"]];
[desc appendString: [NSString stringWithFormat: @"refreshesRefetchedObjects = %s;\n",
_flags.refreshesRefetchedObjects ? "YES" : "NO"]];
[desc appendString: [NSString stringWithFormat: @"promptsAfterFetchLimit = %s;\n",
_flags.promptsAfterFetchLimit ? "YES" : "NO"]];
[desc appendString: [NSString stringWithFormat: @"requiresAllQualifierBindingVariables = %s;\n",
_flags.allVariablesRequiredFromBindings ? "YES" : "NO"]];
[desc appendString: @"}"];
return desc;
}
- (void)setEntityName: (NSString *)entityName
{
[self willChange];
ASSIGN(_entityName, entityName);
}
- (NSString *)entityName
{
return _entityName;
}
- (void)setSortOrderings: (NSArray *)sortOrderings
{
ASSIGN(_sortOrderings, sortOrderings);
}
- (NSArray *)sortOrderings
{
return _sortOrderings;
}
- (void)setQualifier: (EOQualifier *)qualifier
{
[self willChange];
ASSIGN(_qualifier, qualifier);
}
- (EOQualifier *)qualifier
{
return _qualifier;
}
- (void)setUsesDistinct: (BOOL)usesDistinct
{
[self willChange];
_flags.usesDistinct = usesDistinct;
}
- (BOOL)usesDistinct
{
return _flags.usesDistinct;
}
- (void)setIsDeep: (BOOL)isDeep
{
[self willChange];
_flags.isDeep = isDeep;
}
- (BOOL)isDeep
{
return _flags.isDeep;
}
- (void)setLocksObjects: (BOOL)locksObjects
{
[self willChange];
_flags.locksObjects = locksObjects;
}
- (BOOL)locksObjects
{
return _flags.locksObjects;
}
- (void)setRefreshesRefetchedObjects: (BOOL)refreshesRefetchedObjects
{
[self willChange];
_flags.refreshesRefetchedObjects = refreshesRefetchedObjects;
}
- (BOOL)refreshesRefetchedObjects
{
return _flags.refreshesRefetchedObjects;
}
- (void)setFetchLimit: (unsigned)fetchLimit
{
[self willChange];
_fetchLimit = fetchLimit;
}
- (unsigned)fetchLimit
{
return _fetchLimit;
}
- (void)setPromptsAfterFetchLimit: (BOOL)promptsAfterFetchLimit
{
[self willChange];
_flags.promptsAfterFetchLimit = promptsAfterFetchLimit;
}
- (BOOL)promptsAfterFetchLimit
{
return _flags.promptsAfterFetchLimit;
}
- (void)setAllVariablesRequiredFromBindings: (BOOL)allVariablesRequired
{
_flags.allVariablesRequiredFromBindings = allVariablesRequired;
}
- (BOOL)allVariablesRequiredFromBindings
{
return _flags.allVariablesRequiredFromBindings;
}
- (void)setPrefetchingRelationshipKeyPaths: (NSArray *)prefetchingRelationshipKeys
{
[self willChange];
ASSIGN(_prefetchingRelationshipKeys, prefetchingRelationshipKeys);
}
- (NSArray *)prefetchingRelationshipKeyPaths
{
return _prefetchingRelationshipKeys;
}
- (void)setRawAttributeKeys: (NSArray *)rawAttributeKeys
{
ASSIGN(_rawAttributeKeys, rawAttributeKeys);
}
- (NSArray *)rawAttributeKeys
{
return _rawAttributeKeys;
}
- (void)setFetchesRawRows: (BOOL)fetchRawRows
{
if (fetchRawRows)
[self setRawRowKeyPaths: [NSArray array]];
else
[self setRawRowKeyPaths: nil];
}
- (BOOL)fetchesRawRows
{
if ([self rawRowKeyPaths])
return YES;
else
return NO;
}
- (void)setHints: (NSDictionary *)hints
{
//TODO: set fetchLimit,... from hints ???
[self willChange];
//even if nil: initWithDictionary:copyItems:
//thedict objectForKey:EOPrefetchingRelationshipHintKey
//EOFetchLimitHintKey
//EOPromptAfterFetchLimitHintKey
ASSIGN(_hints, hints);
}
- (NSDictionary *)_hints
{
return _hints;
}
- (NSDictionary *)hints
{
NSMutableDictionary *hints = (NSMutableDictionary *)_hints;
BOOL promptsAfterFetchLimit;
NSArray *prefetchingRelationshipKeyPaths;
unsigned fetchLimit;
fetchLimit = [self fetchLimit];
promptsAfterFetchLimit = [self promptsAfterFetchLimit];
prefetchingRelationshipKeyPaths = [self prefetchingRelationshipKeyPaths];
if (fetchLimit != 0 || promptsAfterFetchLimit
|| [prefetchingRelationshipKeyPaths count] > 0)
{
NSMutableDictionary *mutableHints = [NSMutableDictionary
dictionaryWithDictionary: hints];
hints = mutableHints;
if (fetchLimit != 0)
{
[mutableHints setObject: [NSNumber numberWithInt: fetchLimit]
forKey: @"EOFetchLimitHintKey"];
}
if (promptsAfterFetchLimit)
{
[mutableHints setObject: [NSNumber numberWithBool:
promptsAfterFetchLimit]
forKey: @"EOPromptAfterFetchLimitHintKey"];
}
if ([prefetchingRelationshipKeyPaths count] > 0)
{
[mutableHints setObject: prefetchingRelationshipKeyPaths
forKey: @"EOPrefetchingRelationshipHintKey"];
}
}
return hints;
}
- (NSArray *)rawRowKeyPaths
{
return _rawAttributeKeys;
}
- (void)setRawRowKeyPaths: (NSArray *)rawRowKeyPaths
{
[self willChange];
ASSIGN(_rawAttributeKeys, rawRowKeyPaths);
}
- (BOOL)requiresAllQualifierBindingVariables
{
NSDebugMLLog(@"gsdb", @"self=%p", self);
return _flags.allVariablesRequiredFromBindings;
}
- (void)setRequiresAllQualifierBindingVariables: (BOOL)flag
{
[self willChange];
[self notImplemented: _cmd];
}
@end