libs-gdl2/EOAccess/EOExpressionArray.m

584 lines
14 KiB
Mathematica
Raw Permalink Normal View History

/**
EOExpressionArray.m <title>EOExpressionArray</title>
Copyright (C) 1996-2002,2003,2004,2005 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
Date: September 1996
Author: Mirko Viviani <mirko.viviani@gmail.com>
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 3 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,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</license>
**/
#include "config.h"
#include <ctype.h>
#ifdef GNUSTEP
2003-03-30 David Ayers <d.ayers@inode.at> * *.h/m, *.h/m): Used #include instead of depricated #import. Avoid including entire library headers. Use export macro where applicable. * EOControl/GNUmakefile: Removed EOKeyValueCodingBase.m/h and EOUndoMananger.h. Added EOArrayDataSource.m/h, EODefines.h and EODepricated.h. * EOControl/EODefines.h: Updated for GDL2 & gnustep-make. * EOControl/EODebug.h: Updated. * EOControl/EODepricated.h: Updated for current state of GDL2. ([NSObject +flushClassKeyBindings]): Added declaration. ([EOClassDescription +setDelegate:]): Added declaration. ([EOClassDescription +delegate]): Added declaration. (EOUndoManager): Moved declaration of interface here. * EOControl/EOKeyValueCoding.m ([EOClassDescription +flushClassKeyBindings]): Added empty implementation. ([NSObject takeStoredValuesFromDictionary:]): Cache EONull instance and use it instead of isKindOfClass:. * EOControl/EOEditingContext.m ([EOEditingContext +initialize]): Tidied. ([EOEditingContest -deleteObject]): Use NSUndoManager instead of EOUndoManager. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Added minor optimization tweak. * EOControl/EOClassDescription.m: Removed inactive commented code. Added private declerations of EOAccess methods to avoid compiler warnings. ([EOClassDescription +initialize]): Tidied. ([EOClassDescription -classDescriptionForClass:]): Use GSObjCName() instead of objc runtime routines. * EOControl/EOFault.m: Exchanged direct usages of ObjC runtime routines with NS/GSObjCRuntime abstraction API. ([EOFault +superclass]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -respondsToSelector:]): Ditto. ([EOFault +initialize]): Cache static class variable. ([EOFault +isKindOfClass]): Use static class variable. ([EOFault +handlerForFault:]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -dealloc]): Ditto. * EOControl/EOGenericRecord.m: ([EOGenericRecord +initialize]): Tidied. * EOControl/EOKeyComparisonQualifier.m: Tidied documentation. * EOControl/EOKeyValueQualifier.m: Ditto. * EOControl/EONSAddOns.h/m: Added declarations to surpress compiler warnings. ([NSObject -eoCompareOnName:]): Adjusted casts to surpress compiler warnings. (GSUseStrictWO451Compatibility): Added function. (GDL2GlobalLock, GDL2GlobalRecursive): Ditto. * EOControl/EONull: Remove implementations for foundation libraries without key value coding and fully rely on NSNull. Added assertions in all intance methods as instances should never be created. ([EONull +allocWithZone:]) Corrected method name so it will actually be used. * EOControl/EOSortOrdering.m ([NSArray sortedArrayUsingKeyOrderArray:]): Tidied. ([NSMutableArray sortUsingKeyOrderArray:]): Ditto. ([EONull compareAscending:]): Sync with referencs implementation. ([EONull compareDescending:]): Ditto. ([EONull compareCaseInsensitiveAscending:]): Ditto. ([EONull compareCaseInsensitiveDescending:]): Ditto. * EOAccess/EOAdaptor.h: Added comment about API compatibility. * EOAccess/EOAdaptor.m ([EOAdaptor -contexts]): Return array of adaptor contexts rather tham GC-wrapper objects containing adaptor contexts. ([EOAdaptor -databaseEncoding]): Use GSEncodingName() instead of GetEncodingName(). * EOAccess/EODatabaseContext.m ([EODatabaseContext -_turnFault:gid:editingContext:isComplete:]): Use GSObjCClass() instead of trying to access isa by dereferencing from id with incorrect member. * EOAccess/EOModel.m ([EOModel -entityNames]): Sort returned array to insure comparable output. * EOAccess/EOSQLExpression.m ([EOSQLExpression sqlStringForArrayOfQualifiers:operation:]): Added cast to surpress compiler warning. * EOAccess/EOUtilities.m ([EOObjectStoreCoordinator setModelGroup:]): Ditto. * EOAccess/EORelationship.h ([EORelationship -docComment]): Added declaration. * EOAccess/GNUmakefile: Added EODefines.h and EODepricated.h. * Tools/*.m: Use RCS_ID macro. * Tools/EOAttribute+GSDoc.h: ([EOAttribute gsdocContentWithTagName:idPtr:]): Corrected Typo. * Tools/EOModel+GSDoc.h/m: ([EOModel gsdocContentSplittedByEntities:idPtr:]): Ditto. * Tools/EORelationship+GSDoc.m: ([EORelationship gsdocContentWithTagName:idPtr:]): Change variable type to supress compiler warnings. * Tools/eoutil.m (dump): Initialize variables to supress compiler warnings. * Tools/gsdoc-model.m: Include GSCategories.h to supress compiler warnings. (main): Added cast to supress compiler warning. Fixed typo in method invocation. 2003-03-25 Stephane Corthesy <stephane@sente.ch> * EOControl/EODefines.h: Added new file for export/win32 support. * EOControl/EODepricated.h: Added new file for depricated features. * EOControl/EOControl.h: Added EOArrayDataSource.h and EODefines.h. * EOControl/EOArrayDataSource.h/m: Added new files. Some methods (<NSCoding> and qualifier bindings) are empty stubs. * EOControl/EODebug.h: Use export macro instead of explicit extern for function and symbol declarations. * EOControl/EOGlobalID.h: Ditto. * EOControl/EONull.h: Ditto. * EOControl/EOObjectStore.h: Ditto. * EOControl/EOOrQualifier.m: Replaced autorelease by AUTORELEASE and fixed typo. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Implemented. * EOControl/EONSAddOns.m: Use volatile in some exception handlers (man longjmp for more info). * EOControl/EOSortOrdering.h/m ([EOSortOrdering -copyWithZone:]): Implemented <NSCopying>. ([EOSortOrdering -encodeWithKeyValueArchiver:]): Implemented. * EOAccess/EODefines.h: Added new file for export/win32 support. * EOAccess/EODepricated.h: Added new file for depricated features. * EOAccess/EOAccess.h: Added EODefines.h. * EOAccess/EOSQLExpression.h/m: Fixed typo for EOPrimaryKeyConstraintKey. * EOAccess/EOExpressionArray.h/m: Use volatile for variables usein in exception handlers. (man longjmp for more info) * EOAccess/EODatabase.h: Use export macro instead of explicit extern for function and symbol declarations. * EOAccess/EOEntity.h: Ditto. * EOAccess/EOModel.h: Ditto. * EOAccess/EOSchemaGeneration.h: Ditto. * EOAccess/EOSQLExpression.h: Ditto. * EOAccess/EOUtilities.h: Ditto. * Tools/eoutil.m (dump): Implemented use of -postinstall option. Corrected bug when getting adaptor's expression class. Renamed symbol EOPrimaryKeyContraintsKey into EOPrimaryKeyConstraintsKey. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@16298 72102866-910b-0410-8b05-ffd578937521
2003-03-31 00:24:15 +00:00
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSDebug.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSException.h>
#include <Foundation/NSString.h>
#include <Foundation/NSValue.h>
2003-03-30 David Ayers <d.ayers@inode.at> * *.h/m, *.h/m): Used #include instead of depricated #import. Avoid including entire library headers. Use export macro where applicable. * EOControl/GNUmakefile: Removed EOKeyValueCodingBase.m/h and EOUndoMananger.h. Added EOArrayDataSource.m/h, EODefines.h and EODepricated.h. * EOControl/EODefines.h: Updated for GDL2 & gnustep-make. * EOControl/EODebug.h: Updated. * EOControl/EODepricated.h: Updated for current state of GDL2. ([NSObject +flushClassKeyBindings]): Added declaration. ([EOClassDescription +setDelegate:]): Added declaration. ([EOClassDescription +delegate]): Added declaration. (EOUndoManager): Moved declaration of interface here. * EOControl/EOKeyValueCoding.m ([EOClassDescription +flushClassKeyBindings]): Added empty implementation. ([NSObject takeStoredValuesFromDictionary:]): Cache EONull instance and use it instead of isKindOfClass:. * EOControl/EOEditingContext.m ([EOEditingContext +initialize]): Tidied. ([EOEditingContest -deleteObject]): Use NSUndoManager instead of EOUndoManager. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Added minor optimization tweak. * EOControl/EOClassDescription.m: Removed inactive commented code. Added private declerations of EOAccess methods to avoid compiler warnings. ([EOClassDescription +initialize]): Tidied. ([EOClassDescription -classDescriptionForClass:]): Use GSObjCName() instead of objc runtime routines. * EOControl/EOFault.m: Exchanged direct usages of ObjC runtime routines with NS/GSObjCRuntime abstraction API. ([EOFault +superclass]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -respondsToSelector:]): Ditto. ([EOFault +initialize]): Cache static class variable. ([EOFault +isKindOfClass]): Use static class variable. ([EOFault +handlerForFault:]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -dealloc]): Ditto. * EOControl/EOGenericRecord.m: ([EOGenericRecord +initialize]): Tidied. * EOControl/EOKeyComparisonQualifier.m: Tidied documentation. * EOControl/EOKeyValueQualifier.m: Ditto. * EOControl/EONSAddOns.h/m: Added declarations to surpress compiler warnings. ([NSObject -eoCompareOnName:]): Adjusted casts to surpress compiler warnings. (GSUseStrictWO451Compatibility): Added function. (GDL2GlobalLock, GDL2GlobalRecursive): Ditto. * EOControl/EONull: Remove implementations for foundation libraries without key value coding and fully rely on NSNull. Added assertions in all intance methods as instances should never be created. ([EONull +allocWithZone:]) Corrected method name so it will actually be used. * EOControl/EOSortOrdering.m ([NSArray sortedArrayUsingKeyOrderArray:]): Tidied. ([NSMutableArray sortUsingKeyOrderArray:]): Ditto. ([EONull compareAscending:]): Sync with referencs implementation. ([EONull compareDescending:]): Ditto. ([EONull compareCaseInsensitiveAscending:]): Ditto. ([EONull compareCaseInsensitiveDescending:]): Ditto. * EOAccess/EOAdaptor.h: Added comment about API compatibility. * EOAccess/EOAdaptor.m ([EOAdaptor -contexts]): Return array of adaptor contexts rather tham GC-wrapper objects containing adaptor contexts. ([EOAdaptor -databaseEncoding]): Use GSEncodingName() instead of GetEncodingName(). * EOAccess/EODatabaseContext.m ([EODatabaseContext -_turnFault:gid:editingContext:isComplete:]): Use GSObjCClass() instead of trying to access isa by dereferencing from id with incorrect member. * EOAccess/EOModel.m ([EOModel -entityNames]): Sort returned array to insure comparable output. * EOAccess/EOSQLExpression.m ([EOSQLExpression sqlStringForArrayOfQualifiers:operation:]): Added cast to surpress compiler warning. * EOAccess/EOUtilities.m ([EOObjectStoreCoordinator setModelGroup:]): Ditto. * EOAccess/EORelationship.h ([EORelationship -docComment]): Added declaration. * EOAccess/GNUmakefile: Added EODefines.h and EODepricated.h. * Tools/*.m: Use RCS_ID macro. * Tools/EOAttribute+GSDoc.h: ([EOAttribute gsdocContentWithTagName:idPtr:]): Corrected Typo. * Tools/EOModel+GSDoc.h/m: ([EOModel gsdocContentSplittedByEntities:idPtr:]): Ditto. * Tools/EORelationship+GSDoc.m: ([EORelationship gsdocContentWithTagName:idPtr:]): Change variable type to supress compiler warnings. * Tools/eoutil.m (dump): Initialize variables to supress compiler warnings. * Tools/gsdoc-model.m: Include GSCategories.h to supress compiler warnings. (main): Added cast to supress compiler warning. Fixed typo in method invocation. 2003-03-25 Stephane Corthesy <stephane@sente.ch> * EOControl/EODefines.h: Added new file for export/win32 support. * EOControl/EODepricated.h: Added new file for depricated features. * EOControl/EOControl.h: Added EOArrayDataSource.h and EODefines.h. * EOControl/EOArrayDataSource.h/m: Added new files. Some methods (<NSCoding> and qualifier bindings) are empty stubs. * EOControl/EODebug.h: Use export macro instead of explicit extern for function and symbol declarations. * EOControl/EOGlobalID.h: Ditto. * EOControl/EONull.h: Ditto. * EOControl/EOObjectStore.h: Ditto. * EOControl/EOOrQualifier.m: Replaced autorelease by AUTORELEASE and fixed typo. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Implemented. * EOControl/EONSAddOns.m: Use volatile in some exception handlers (man longjmp for more info). * EOControl/EOSortOrdering.h/m ([EOSortOrdering -copyWithZone:]): Implemented <NSCopying>. ([EOSortOrdering -encodeWithKeyValueArchiver:]): Implemented. * EOAccess/EODefines.h: Added new file for export/win32 support. * EOAccess/EODepricated.h: Added new file for depricated features. * EOAccess/EOAccess.h: Added EODefines.h. * EOAccess/EOSQLExpression.h/m: Fixed typo for EOPrimaryKeyConstraintKey. * EOAccess/EOExpressionArray.h/m: Use volatile for variables usein in exception handlers. (man longjmp for more info) * EOAccess/EODatabase.h: Use export macro instead of explicit extern for function and symbol declarations. * EOAccess/EOEntity.h: Ditto. * EOAccess/EOModel.h: Ditto. * EOAccess/EOSchemaGeneration.h: Ditto. * EOAccess/EOSQLExpression.h: Ditto. * EOAccess/EOUtilities.h: Ditto. * Tools/eoutil.m (dump): Implemented use of -postinstall option. Corrected bug when getting adaptor's expression class. Renamed symbol EOPrimaryKeyContraintsKey into EOPrimaryKeyConstraintsKey. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@16298 72102866-910b-0410-8b05-ffd578937521
2003-03-31 00:24:15 +00:00
#else
#include <Foundation/Foundation.h>
#endif
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#define GSI_ARRAY_TYPES GSUNION_OBJ
#include <GNUstepBase/GSIArray.h>
2003-03-30 David Ayers <d.ayers@inode.at> * *.h/m, *.h/m): Used #include instead of depricated #import. Avoid including entire library headers. Use export macro where applicable. * EOControl/GNUmakefile: Removed EOKeyValueCodingBase.m/h and EOUndoMananger.h. Added EOArrayDataSource.m/h, EODefines.h and EODepricated.h. * EOControl/EODefines.h: Updated for GDL2 & gnustep-make. * EOControl/EODebug.h: Updated. * EOControl/EODepricated.h: Updated for current state of GDL2. ([NSObject +flushClassKeyBindings]): Added declaration. ([EOClassDescription +setDelegate:]): Added declaration. ([EOClassDescription +delegate]): Added declaration. (EOUndoManager): Moved declaration of interface here. * EOControl/EOKeyValueCoding.m ([EOClassDescription +flushClassKeyBindings]): Added empty implementation. ([NSObject takeStoredValuesFromDictionary:]): Cache EONull instance and use it instead of isKindOfClass:. * EOControl/EOEditingContext.m ([EOEditingContext +initialize]): Tidied. ([EOEditingContest -deleteObject]): Use NSUndoManager instead of EOUndoManager. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Added minor optimization tweak. * EOControl/EOClassDescription.m: Removed inactive commented code. Added private declerations of EOAccess methods to avoid compiler warnings. ([EOClassDescription +initialize]): Tidied. ([EOClassDescription -classDescriptionForClass:]): Use GSObjCName() instead of objc runtime routines. * EOControl/EOFault.m: Exchanged direct usages of ObjC runtime routines with NS/GSObjCRuntime abstraction API. ([EOFault +superclass]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -respondsToSelector:]): Ditto. ([EOFault +initialize]): Cache static class variable. ([EOFault +isKindOfClass]): Use static class variable. ([EOFault +handlerForFault:]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -dealloc]): Ditto. * EOControl/EOGenericRecord.m: ([EOGenericRecord +initialize]): Tidied. * EOControl/EOKeyComparisonQualifier.m: Tidied documentation. * EOControl/EOKeyValueQualifier.m: Ditto. * EOControl/EONSAddOns.h/m: Added declarations to surpress compiler warnings. ([NSObject -eoCompareOnName:]): Adjusted casts to surpress compiler warnings. (GSUseStrictWO451Compatibility): Added function. (GDL2GlobalLock, GDL2GlobalRecursive): Ditto. * EOControl/EONull: Remove implementations for foundation libraries without key value coding and fully rely on NSNull. Added assertions in all intance methods as instances should never be created. ([EONull +allocWithZone:]) Corrected method name so it will actually be used. * EOControl/EOSortOrdering.m ([NSArray sortedArrayUsingKeyOrderArray:]): Tidied. ([NSMutableArray sortUsingKeyOrderArray:]): Ditto. ([EONull compareAscending:]): Sync with referencs implementation. ([EONull compareDescending:]): Ditto. ([EONull compareCaseInsensitiveAscending:]): Ditto. ([EONull compareCaseInsensitiveDescending:]): Ditto. * EOAccess/EOAdaptor.h: Added comment about API compatibility. * EOAccess/EOAdaptor.m ([EOAdaptor -contexts]): Return array of adaptor contexts rather tham GC-wrapper objects containing adaptor contexts. ([EOAdaptor -databaseEncoding]): Use GSEncodingName() instead of GetEncodingName(). * EOAccess/EODatabaseContext.m ([EODatabaseContext -_turnFault:gid:editingContext:isComplete:]): Use GSObjCClass() instead of trying to access isa by dereferencing from id with incorrect member. * EOAccess/EOModel.m ([EOModel -entityNames]): Sort returned array to insure comparable output. * EOAccess/EOSQLExpression.m ([EOSQLExpression sqlStringForArrayOfQualifiers:operation:]): Added cast to surpress compiler warning. * EOAccess/EOUtilities.m ([EOObjectStoreCoordinator setModelGroup:]): Ditto. * EOAccess/EORelationship.h ([EORelationship -docComment]): Added declaration. * EOAccess/GNUmakefile: Added EODefines.h and EODepricated.h. * Tools/*.m: Use RCS_ID macro. * Tools/EOAttribute+GSDoc.h: ([EOAttribute gsdocContentWithTagName:idPtr:]): Corrected Typo. * Tools/EOModel+GSDoc.h/m: ([EOModel gsdocContentSplittedByEntities:idPtr:]): Ditto. * Tools/EORelationship+GSDoc.m: ([EORelationship gsdocContentWithTagName:idPtr:]): Change variable type to supress compiler warnings. * Tools/eoutil.m (dump): Initialize variables to supress compiler warnings. * Tools/gsdoc-model.m: Include GSCategories.h to supress compiler warnings. (main): Added cast to supress compiler warning. Fixed typo in method invocation. 2003-03-25 Stephane Corthesy <stephane@sente.ch> * EOControl/EODefines.h: Added new file for export/win32 support. * EOControl/EODepricated.h: Added new file for depricated features. * EOControl/EOControl.h: Added EOArrayDataSource.h and EODefines.h. * EOControl/EOArrayDataSource.h/m: Added new files. Some methods (<NSCoding> and qualifier bindings) are empty stubs. * EOControl/EODebug.h: Use export macro instead of explicit extern for function and symbol declarations. * EOControl/EOGlobalID.h: Ditto. * EOControl/EONull.h: Ditto. * EOControl/EOObjectStore.h: Ditto. * EOControl/EOOrQualifier.m: Replaced autorelease by AUTORELEASE and fixed typo. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Implemented. * EOControl/EONSAddOns.m: Use volatile in some exception handlers (man longjmp for more info). * EOControl/EOSortOrdering.h/m ([EOSortOrdering -copyWithZone:]): Implemented <NSCopying>. ([EOSortOrdering -encodeWithKeyValueArchiver:]): Implemented. * EOAccess/EODefines.h: Added new file for export/win32 support. * EOAccess/EODepricated.h: Added new file for depricated features. * EOAccess/EOAccess.h: Added EODefines.h. * EOAccess/EOSQLExpression.h/m: Fixed typo for EOPrimaryKeyConstraintKey. * EOAccess/EOExpressionArray.h/m: Use volatile for variables usein in exception handlers. (man longjmp for more info) * EOAccess/EODatabase.h: Use export macro instead of explicit extern for function and symbol declarations. * EOAccess/EOEntity.h: Ditto. * EOAccess/EOModel.h: Ditto. * EOAccess/EOSchemaGeneration.h: Ditto. * EOAccess/EOSQLExpression.h: Ditto. * EOAccess/EOUtilities.h: Ditto. * Tools/eoutil.m (dump): Implemented use of -postinstall option. Corrected bug when getting adaptor's expression class. Renamed symbol EOPrimaryKeyContraintsKey into EOPrimaryKeyConstraintsKey. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@16298 72102866-910b-0410-8b05-ffd578937521
2003-03-31 00:24:15 +00:00
#include <EOControl/EODebug.h>
2003-03-30 David Ayers <d.ayers@inode.at> * *.h/m, *.h/m): Used #include instead of depricated #import. Avoid including entire library headers. Use export macro where applicable. * EOControl/GNUmakefile: Removed EOKeyValueCodingBase.m/h and EOUndoMananger.h. Added EOArrayDataSource.m/h, EODefines.h and EODepricated.h. * EOControl/EODefines.h: Updated for GDL2 & gnustep-make. * EOControl/EODebug.h: Updated. * EOControl/EODepricated.h: Updated for current state of GDL2. ([NSObject +flushClassKeyBindings]): Added declaration. ([EOClassDescription +setDelegate:]): Added declaration. ([EOClassDescription +delegate]): Added declaration. (EOUndoManager): Moved declaration of interface here. * EOControl/EOKeyValueCoding.m ([EOClassDescription +flushClassKeyBindings]): Added empty implementation. ([NSObject takeStoredValuesFromDictionary:]): Cache EONull instance and use it instead of isKindOfClass:. * EOControl/EOEditingContext.m ([EOEditingContext +initialize]): Tidied. ([EOEditingContest -deleteObject]): Use NSUndoManager instead of EOUndoManager. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Added minor optimization tweak. * EOControl/EOClassDescription.m: Removed inactive commented code. Added private declerations of EOAccess methods to avoid compiler warnings. ([EOClassDescription +initialize]): Tidied. ([EOClassDescription -classDescriptionForClass:]): Use GSObjCName() instead of objc runtime routines. * EOControl/EOFault.m: Exchanged direct usages of ObjC runtime routines with NS/GSObjCRuntime abstraction API. ([EOFault +superclass]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -respondsToSelector:]): Ditto. ([EOFault +initialize]): Cache static class variable. ([EOFault +isKindOfClass]): Use static class variable. ([EOFault +handlerForFault:]): Ditto. ([EOFault +targetClassForFault:]): Ditto. ([EOFault -dealloc]): Ditto. * EOControl/EOGenericRecord.m: ([EOGenericRecord +initialize]): Tidied. * EOControl/EOKeyComparisonQualifier.m: Tidied documentation. * EOControl/EOKeyValueQualifier.m: Ditto. * EOControl/EONSAddOns.h/m: Added declarations to surpress compiler warnings. ([NSObject -eoCompareOnName:]): Adjusted casts to surpress compiler warnings. (GSUseStrictWO451Compatibility): Added function. (GDL2GlobalLock, GDL2GlobalRecursive): Ditto. * EOControl/EONull: Remove implementations for foundation libraries without key value coding and fully rely on NSNull. Added assertions in all intance methods as instances should never be created. ([EONull +allocWithZone:]) Corrected method name so it will actually be used. * EOControl/EOSortOrdering.m ([NSArray sortedArrayUsingKeyOrderArray:]): Tidied. ([NSMutableArray sortUsingKeyOrderArray:]): Ditto. ([EONull compareAscending:]): Sync with referencs implementation. ([EONull compareDescending:]): Ditto. ([EONull compareCaseInsensitiveAscending:]): Ditto. ([EONull compareCaseInsensitiveDescending:]): Ditto. * EOAccess/EOAdaptor.h: Added comment about API compatibility. * EOAccess/EOAdaptor.m ([EOAdaptor -contexts]): Return array of adaptor contexts rather tham GC-wrapper objects containing adaptor contexts. ([EOAdaptor -databaseEncoding]): Use GSEncodingName() instead of GetEncodingName(). * EOAccess/EODatabaseContext.m ([EODatabaseContext -_turnFault:gid:editingContext:isComplete:]): Use GSObjCClass() instead of trying to access isa by dereferencing from id with incorrect member. * EOAccess/EOModel.m ([EOModel -entityNames]): Sort returned array to insure comparable output. * EOAccess/EOSQLExpression.m ([EOSQLExpression sqlStringForArrayOfQualifiers:operation:]): Added cast to surpress compiler warning. * EOAccess/EOUtilities.m ([EOObjectStoreCoordinator setModelGroup:]): Ditto. * EOAccess/EORelationship.h ([EORelationship -docComment]): Added declaration. * EOAccess/GNUmakefile: Added EODefines.h and EODepricated.h. * Tools/*.m: Use RCS_ID macro. * Tools/EOAttribute+GSDoc.h: ([EOAttribute gsdocContentWithTagName:idPtr:]): Corrected Typo. * Tools/EOModel+GSDoc.h/m: ([EOModel gsdocContentSplittedByEntities:idPtr:]): Ditto. * Tools/EORelationship+GSDoc.m: ([EORelationship gsdocContentWithTagName:idPtr:]): Change variable type to supress compiler warnings. * Tools/eoutil.m (dump): Initialize variables to supress compiler warnings. * Tools/gsdoc-model.m: Include GSCategories.h to supress compiler warnings. (main): Added cast to supress compiler warning. Fixed typo in method invocation. 2003-03-25 Stephane Corthesy <stephane@sente.ch> * EOControl/EODefines.h: Added new file for export/win32 support. * EOControl/EODepricated.h: Added new file for depricated features. * EOControl/EOControl.h: Added EOArrayDataSource.h and EODefines.h. * EOControl/EOArrayDataSource.h/m: Added new files. Some methods (<NSCoding> and qualifier bindings) are empty stubs. * EOControl/EODebug.h: Use export macro instead of explicit extern for function and symbol declarations. * EOControl/EOGlobalID.h: Ditto. * EOControl/EONull.h: Ditto. * EOControl/EOObjectStore.h: Ditto. * EOControl/EOOrQualifier.m: Replaced autorelease by AUTORELEASE and fixed typo. * EOControl/EOQualifier.m ([NSArray -filteredArrayUsingQualifier:]): Implemented. * EOControl/EONSAddOns.m: Use volatile in some exception handlers (man longjmp for more info). * EOControl/EOSortOrdering.h/m ([EOSortOrdering -copyWithZone:]): Implemented <NSCopying>. ([EOSortOrdering -encodeWithKeyValueArchiver:]): Implemented. * EOAccess/EODefines.h: Added new file for export/win32 support. * EOAccess/EODepricated.h: Added new file for depricated features. * EOAccess/EOAccess.h: Added EODefines.h. * EOAccess/EOSQLExpression.h/m: Fixed typo for EOPrimaryKeyConstraintKey. * EOAccess/EOExpressionArray.h/m: Use volatile for variables usein in exception handlers. (man longjmp for more info) * EOAccess/EODatabase.h: Use export macro instead of explicit extern for function and symbol declarations. * EOAccess/EOEntity.h: Ditto. * EOAccess/EOModel.h: Ditto. * EOAccess/EOSchemaGeneration.h: Ditto. * EOAccess/EOSQLExpression.h: Ditto. * EOAccess/EOUtilities.h: Ditto. * Tools/eoutil.m (dump): Implemented use of -postinstall option. Corrected bug when getting adaptor's expression class. Renamed symbol EOPrimaryKeyContraintsKey into EOPrimaryKeyConstraintsKey. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@16298 72102866-910b-0410-8b05-ffd578937521
2003-03-31 00:24:15 +00:00
#include <EOAccess/EOEntity.h>
#include <EOAccess/EOExpressionArray.h>
#include <EOAccess/EORelationship.h>
* EOAccess/EOAccessFault.m remove empty init methods fix warnings * EOAccess/EOAdaptor.[hm] add -expressionFactory * EOAccess/EOAdaptorChannel.m clean -performAdaptorOperation: * EOAccess/EOAdaptorOperation.m fix warnings * EOAccess/EODatabase.[hm] add/handle _timestamp * EOAccess/EODatabaseChannel.h remove delegate (moved to EODatabaseContext) add _currentEditingContextTimestamp add _refreshedGIDs * EOAccess/EODatabaseChannel.m fix warnings remove delegate (moved to EODatabaseContext) add _currentEditingContextTimestamp add _refreshedGIDs rewrite -setEntity: rewrite -setCurrentEditingContext: rewrite -fetchObject rewrite -cancelFetch rewrite -_selectWithFetchSpecification:editingContext: * EOAccess/EODatabaseContext.h add EODatabaseChannel delegate stuff * EOAccess/EODatabaseContextPriv.h add EODatabaseChannel delegate stuff * EOAccess/EODatabaseContext.m add EODatabaseChannel delegate stuff fix EOAdaptor..Operator / EODatabase..Operator mismatch * EOAccess/EODatabaseOperation.m fix warnings * EOAccess/EOEntity.[hm], EOAccess/EOEntityPriv.h fix warnings add singleTable... methods * EOAccess/EOExpressionArray.m fix warnings * EOAccess/EOSQLExpression.m rewrite -prepareInsertExpressionWithRow: * EOAccess/EOSQLExpressionFactory.[hm] new class * EOAccess/EOUtilities.[hm] remove duplicate methods * EOAccess/GNUmakefile add EOSQLExpressionFactory.[hm] * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.h remove duplicate _adaptorContext * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m remove duplicate _adaptorContext remove unused pgResultDictionary() * EOControl/EOEditingContext.h handle fetchTimestamp * EOControl/EOEditingContext.m handle fetchTimestamp rewrite -deleteObject: fix warnings * EOControl/EOGenericRecord.m fix warnings * EOControl/EOMutableKnownKeyDictionary.m fix warnings * EOControl/EONSAddOns.[hm] remove duplicate method * EOControl/EONull.m fix warnings git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37938 72102866-910b-0410-8b05-ffd578937521
2014-06-03 19:04:01 +00:00
#include <EOAccess/EOSQLExpression.h>
* EOAccess/EOAdaptorChannel.m call delegate -adaptorChannel:willPerformOperations: * EOAccess/EODatabaseContext.m: propagate delegate to channel fix objectsForSourceGlobalID:relationshipName:editingContext: isToManyToOne case * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: call delegate methods adding assert to catch bad dates use adaptor -primaryKeySequenceNameFormat * EOAccess/EOrelationship.m implement -isParentRelationship verify/clean -isReciprocalToRelationship: implement -qualifierWithSourceRow: small fix on -removeJoin: use batch faulting when -setNumberOfToManyFaultsToBatchFetch: improve -setIsMandatory fix exception message -validateValue: clean -_intermediateAttributes clean -isMultiHop implement -primaryKeyForTargetRowFromSourceDBSnapshot: implement -_setSourceToDestinationKeyMap: implement -qualifierForDBSnapshot: fix/implement -isToManyToOne fix -foreignKeyInDestination implement -isPropagatesPrimaryKeyPossible implement -qualifierOmittingAuxiliaryQualifierWithSourceRow implement -auxiliaryQualifier implement -setAuxiliaryQualifier: clean -_sourceRowToForeignKeyMapping add comment in -_sourceAttributeNames fix -joinForAttribute: fix -_flushCache fix -_stringFromDeleteRule: implement -_rightSideKeyMap implement -_leftSideKeyMap implement -_substitutionRelationshipForRow: fix -isFlattened remove _componentRelationships * EOAccess/EORelationship.h remove _componentRelationships * EOAccess/EOEntityPriv.[hm] fix _hiddenRelationships return type * EOAccess/Entity.m: implement -_mapAttribute:toDestinationAttributeInLastComponentOfRelationshipPath: implement -_inverseRelationshipPathForPath: implement -_relationshipPathHasIdenticalKeys: rewrite & fix -_keyMapForRelationshipPath: rewrite & fix -_keyMapForIdenticalKeyRelationshipPath: implement -valueForSQLExpression: fix -validateObjectForDelete: implement -qualifierForDBSnapshot: fix -_addAttributesToFetchForRelationshipPath:atts: fix -_parsePropertyName: implement -fetchSpecificationNamed: implement +externalNameForInternalName:separatorString:useAllCaps: implement +nameForExternalName:separatorString:initialCaps: implement -stringByMarkingUpcaseTransitionsWithDelimiter implement -snapshotKeyForAttributeName: implement -_flattenedAttNameToSnapshotKeyMapping fix -_attributesToFetch fix -_attributesToSave * EOAccess/Entity.h: fix _inverseRelationshipPathForPath: fix -_relationshipPathHasIdenticalKey: add _flgas.isSingleTableEntity * EOAccess/EntityPriv.h: fix -qualifierForDBSnapshot: * EOAccess/EOPrivate.[hm] add GDL2_EORelationshipClass add GDL2_EOEntityClass * EOAccess/EOModel.m: cache [EOEntity class] add -propertyListForEntity:name: to enable subclassing * EOAccess/EOAttribute.m fix -isFlattened implement -targetAttribute implement -relationshipPath fix -_setDefinitionWithoutFlushingCaches: fix -_normalizeDefinition:path: fix -isReadOnly implement -_setOverrideForKeyEnum: implement -_hasAnyOverrides implement -_isKeyEnumOverriden: implement -_prototypeKeys fix -initWithPropertyList:owner: fix -readFormat fix -writeFormat fix -scale fix -precision fix -width fix -allowsNull fix -isReadOnly fix -valueClassName fix -externalType fix -valueType implement -_setValuesFromTargetAttribute * EOAccess/EOAttribute.h declare -targetAttribute declare -relationshipPath * EOAccess/EOAttributePriv.h declare EOAttributeProtoOverrideBits enum fix method arguments declare _setValuesFromTargetAttribute() * EOAccess/EOExpressionArray.h declare -_isPropertyPath * EOAccess/EOExpressionArray.m implement -_isPropertyPath git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37813 72102866-910b-0410-8b05-ffd578937521
2014-04-26 18:23:22 +00:00
#include "EOPrivate.h"
static SEL eqSel;
@interface EOExpressionArray (PrivateExceptions)
- (void) _raiseRangeExceptionWithIndex:(unsigned) index from:(SEL)selector;
@end
@implementation EOExpressionArray
+ (void) initialize
{
eqSel = NSSelectorFromString(@"isEqual:");
}
+ (EOExpressionArray*)expressionArray
{
return [[self new] autorelease];
}
- (void)dealloc
{
DESTROY(_realAttribute); //TODO mettere nei metodi GC
// DESTROY(_definition);
DESTROY(_prefix);
DESTROY(_infix);
DESTROY(_suffix);
GSIArrayEmpty(_contents);
NSZoneFree([self zone], _contents);
[super dealloc];
}
- (id) init
{
self = [self initWithCapacity:0];
return self;
}
/* designated initializer */
- (id) initWithCapacity:(NSUInteger)capacity
{
self = [super init];
_contents = NSZoneMalloc([self zone], sizeof(GSIArray_t));
_contents = GSIArrayInitWithZoneAndCapacity(_contents, [self zone], capacity);
return self;
}
- (id) initWithObjects:(const id[])objects count:(NSUInteger)count
{
NSUInteger i;
self = [self initWithCapacity:count];
for (i = 0; i < count; i++)
GSIArrayAddItem(_contents, (GSIArrayItem)objects[i]);
return self;
}
+ (EOExpressionArray*)expressionArrayWithPrefix: (NSString *)prefix
infix: (NSString *)infix
suffix: (NSString *)suffix
{
return [[[self alloc]initWithPrefix: prefix
infix: infix
suffix: suffix] autorelease];
}
- (id)initWithPrefix: (NSString *)prefix
infix: (NSString *)infix
suffix: (NSString *)suffix
{
if ((self = [self init]))
{
ASSIGN(_prefix, prefix);
ASSIGN(_infix, infix);
ASSIGN(_suffix, suffix);
}
return self;
}
- (BOOL)referencesObject: (id)anObject
{
return [self indexOfObject: anObject] != NSNotFound;
}
- (NSString *)expressionValueForContext: (id<EOExpressionContext>)ctx
{
if (ctx && [self count]
* EOAccess/EOAdaptorChannel.m call delegate -adaptorChannel:willPerformOperations: * EOAccess/EODatabaseContext.m: propagate delegate to channel fix objectsForSourceGlobalID:relationshipName:editingContext: isToManyToOne case * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: call delegate methods adding assert to catch bad dates use adaptor -primaryKeySequenceNameFormat * EOAccess/EOrelationship.m implement -isParentRelationship verify/clean -isReciprocalToRelationship: implement -qualifierWithSourceRow: small fix on -removeJoin: use batch faulting when -setNumberOfToManyFaultsToBatchFetch: improve -setIsMandatory fix exception message -validateValue: clean -_intermediateAttributes clean -isMultiHop implement -primaryKeyForTargetRowFromSourceDBSnapshot: implement -_setSourceToDestinationKeyMap: implement -qualifierForDBSnapshot: fix/implement -isToManyToOne fix -foreignKeyInDestination implement -isPropagatesPrimaryKeyPossible implement -qualifierOmittingAuxiliaryQualifierWithSourceRow implement -auxiliaryQualifier implement -setAuxiliaryQualifier: clean -_sourceRowToForeignKeyMapping add comment in -_sourceAttributeNames fix -joinForAttribute: fix -_flushCache fix -_stringFromDeleteRule: implement -_rightSideKeyMap implement -_leftSideKeyMap implement -_substitutionRelationshipForRow: fix -isFlattened remove _componentRelationships * EOAccess/EORelationship.h remove _componentRelationships * EOAccess/EOEntityPriv.[hm] fix _hiddenRelationships return type * EOAccess/Entity.m: implement -_mapAttribute:toDestinationAttributeInLastComponentOfRelationshipPath: implement -_inverseRelationshipPathForPath: implement -_relationshipPathHasIdenticalKeys: rewrite & fix -_keyMapForRelationshipPath: rewrite & fix -_keyMapForIdenticalKeyRelationshipPath: implement -valueForSQLExpression: fix -validateObjectForDelete: implement -qualifierForDBSnapshot: fix -_addAttributesToFetchForRelationshipPath:atts: fix -_parsePropertyName: implement -fetchSpecificationNamed: implement +externalNameForInternalName:separatorString:useAllCaps: implement +nameForExternalName:separatorString:initialCaps: implement -stringByMarkingUpcaseTransitionsWithDelimiter implement -snapshotKeyForAttributeName: implement -_flattenedAttNameToSnapshotKeyMapping fix -_attributesToFetch fix -_attributesToSave * EOAccess/Entity.h: fix _inverseRelationshipPathForPath: fix -_relationshipPathHasIdenticalKey: add _flgas.isSingleTableEntity * EOAccess/EntityPriv.h: fix -qualifierForDBSnapshot: * EOAccess/EOPrivate.[hm] add GDL2_EORelationshipClass add GDL2_EOEntityClass * EOAccess/EOModel.m: cache [EOEntity class] add -propertyListForEntity:name: to enable subclassing * EOAccess/EOAttribute.m fix -isFlattened implement -targetAttribute implement -relationshipPath fix -_setDefinitionWithoutFlushingCaches: fix -_normalizeDefinition:path: fix -isReadOnly implement -_setOverrideForKeyEnum: implement -_hasAnyOverrides implement -_isKeyEnumOverriden: implement -_prototypeKeys fix -initWithPropertyList:owner: fix -readFormat fix -writeFormat fix -scale fix -precision fix -width fix -allowsNull fix -isReadOnly fix -valueClassName fix -externalType fix -valueType implement -_setValuesFromTargetAttribute * EOAccess/EOAttribute.h declare -targetAttribute declare -relationshipPath * EOAccess/EOAttributePriv.h declare EOAttributeProtoOverrideBits enum fix method arguments declare _setValuesFromTargetAttribute() * EOAccess/EOExpressionArray.h declare -_isPropertyPath * EOAccess/EOExpressionArray.m implement -_isPropertyPath git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37813 72102866-910b-0410-8b05-ffd578937521
2014-04-26 18:23:22 +00:00
&& [[self objectAtIndex: 0] isKindOfClass: GDL2_EORelationshipClass])
return [ctx expressionValueForAttributePath: self];
else
{
int i, count = [self count];
id result = [[NSMutableString new] autorelease];
SEL sel = @selector(appendString:);
IMP imp = [result methodForSelector: sel];
if (_prefix)
[result appendString:_prefix];
if (count)
{
(*imp)(result, sel, [[self objectAtIndex: 0]
expressionValueForContext: ctx]);
for (i = 1 ; i < count; i++)
{
if (_infix)
(*imp)(result, sel, _infix);
(*imp)(result, sel, [[self objectAtIndex: i]
expressionValueForContext: ctx]);
}
}
if(_suffix)
[result appendString: _suffix];
return result;
}
}
- (void)setPrefix: (NSString *)prefix
{
ASSIGN(_prefix, prefix);
}
- (void)setInfix: (NSString *)infix
{
ASSIGN(_infix, infix);
}
- (void)setSuffix: (NSString *)suffix
{
ASSIGN(_suffix, suffix);
}
- (NSString *)prefix
{
return _prefix;
}
- (NSString *)infix
{
return _infix;
}
- (NSString *)suffix
{
return _suffix;
}
- (NSString *)definition
{
// return _definition;
return [self valueForSQLExpression: nil];
}
- (BOOL)isFlattened
{
// return _flags.isFlattened;
return ([self count] > 1);
}
- (EOAttribute *)realAttribute
{
return _realAttribute;
}
/*
+ (EOExpressionArray *)parseExpression:(NSString *)expression
entity:(EOEntity *)entity
replacePropertyReferences:(BOOL)replacePropertyReferences
{
EOExpressionArray *array = nil;
const char *s = NULL;
const char *start=NULL;
id objectToken=nil;
array = [[EOExpressionArray new] autorelease];
s = [expression cString];
// ASSIGN(array->_definition, expression);
array->_flags.isFlattened = NO;
if([expression isNameOfARelationshipPath])
{
NSArray *defArray;
NSString *realAttributeName;
int count, i;
array->_flags.isFlattened = YES;
defArray = [expression componentsSeparatedByString:@"."];
count = [defArray count];
for(i = 0; i < count - 1; i++)
{
id relationshipName = [defArray objectAtIndex:i];
id relationship=nil;
relationship = [entity relationshipNamed:relationshipName];
if(!relationship)
[NSException raise:NSInvalidArgumentException
format:@"%@ -- %@ 0x%x: '%@' for entity '%@' is an invalid property",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
relationshipName,
entity];
// if([relationship isToMany])
// [NSException raise:NSInvalidArgumentException format:@"%@ -- %@ 0x%x: '%@' for entity '%@' must be a to one relationship",
//NSStringFromSelector(_cmd),
//NSStringFromClass([self class]),
//self,
//relationshipName,
//entity];
[array addObject:relationship];
entity = [relationship destinationEntity];
}
realAttributeName = [defArray lastObject];
ASSIGN(array->_realAttribute, [entity attributeNamed:realAttributeName]);
if(!array->_realAttribute)
ASSIGN(array->_realAttribute, [entity relationshipNamed:realAttributeName]);
if(!array->_realAttribute)
[NSException raise:NSInvalidArgumentException
format:@"%@ -- %@ 0x%x: '%@' for entity '%@' is an invalid property",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
realAttributeName,
entity];
[array addObject:array->_realAttribute];
}
else
{
//IN eoentity persedescr
}
//
return array;
}
*/
- (BOOL)_isPropertyPath
{
* EOAccess/EOAdaptorChannel.m call delegate -adaptorChannel:willPerformOperations: * EOAccess/EODatabaseContext.m: propagate delegate to channel fix objectsForSourceGlobalID:relationshipName:editingContext: isToManyToOne case * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: call delegate methods adding assert to catch bad dates use adaptor -primaryKeySequenceNameFormat * EOAccess/EOrelationship.m implement -isParentRelationship verify/clean -isReciprocalToRelationship: implement -qualifierWithSourceRow: small fix on -removeJoin: use batch faulting when -setNumberOfToManyFaultsToBatchFetch: improve -setIsMandatory fix exception message -validateValue: clean -_intermediateAttributes clean -isMultiHop implement -primaryKeyForTargetRowFromSourceDBSnapshot: implement -_setSourceToDestinationKeyMap: implement -qualifierForDBSnapshot: fix/implement -isToManyToOne fix -foreignKeyInDestination implement -isPropagatesPrimaryKeyPossible implement -qualifierOmittingAuxiliaryQualifierWithSourceRow implement -auxiliaryQualifier implement -setAuxiliaryQualifier: clean -_sourceRowToForeignKeyMapping add comment in -_sourceAttributeNames fix -joinForAttribute: fix -_flushCache fix -_stringFromDeleteRule: implement -_rightSideKeyMap implement -_leftSideKeyMap implement -_substitutionRelationshipForRow: fix -isFlattened remove _componentRelationships * EOAccess/EORelationship.h remove _componentRelationships * EOAccess/EOEntityPriv.[hm] fix _hiddenRelationships return type * EOAccess/Entity.m: implement -_mapAttribute:toDestinationAttributeInLastComponentOfRelationshipPath: implement -_inverseRelationshipPathForPath: implement -_relationshipPathHasIdenticalKeys: rewrite & fix -_keyMapForRelationshipPath: rewrite & fix -_keyMapForIdenticalKeyRelationshipPath: implement -valueForSQLExpression: fix -validateObjectForDelete: implement -qualifierForDBSnapshot: fix -_addAttributesToFetchForRelationshipPath:atts: fix -_parsePropertyName: implement -fetchSpecificationNamed: implement +externalNameForInternalName:separatorString:useAllCaps: implement +nameForExternalName:separatorString:initialCaps: implement -stringByMarkingUpcaseTransitionsWithDelimiter implement -snapshotKeyForAttributeName: implement -_flattenedAttNameToSnapshotKeyMapping fix -_attributesToFetch fix -_attributesToSave * EOAccess/Entity.h: fix _inverseRelationshipPathForPath: fix -_relationshipPathHasIdenticalKey: add _flgas.isSingleTableEntity * EOAccess/EntityPriv.h: fix -qualifierForDBSnapshot: * EOAccess/EOPrivate.[hm] add GDL2_EORelationshipClass add GDL2_EOEntityClass * EOAccess/EOModel.m: cache [EOEntity class] add -propertyListForEntity:name: to enable subclassing * EOAccess/EOAttribute.m fix -isFlattened implement -targetAttribute implement -relationshipPath fix -_setDefinitionWithoutFlushingCaches: fix -_normalizeDefinition:path: fix -isReadOnly implement -_setOverrideForKeyEnum: implement -_hasAnyOverrides implement -_isKeyEnumOverriden: implement -_prototypeKeys fix -initWithPropertyList:owner: fix -readFormat fix -writeFormat fix -scale fix -precision fix -width fix -allowsNull fix -isReadOnly fix -valueClassName fix -externalType fix -valueType implement -_setValuesFromTargetAttribute * EOAccess/EOAttribute.h declare -targetAttribute declare -relationshipPath * EOAccess/EOAttributePriv.h declare EOAttributeProtoOverrideBits enum fix method arguments declare _setValuesFromTargetAttribute() * EOAccess/EOExpressionArray.h declare -_isPropertyPath * EOAccess/EOExpressionArray.m implement -_isPropertyPath git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37813 72102866-910b-0410-8b05-ffd578937521
2014-04-26 18:23:22 +00:00
if ([self count]<=0)
return NO;
else
return [[self objectAtIndex:0] isKindOfClass:GDL2_EORelationshipClass];
}
* EOAccess/EOAccessFault.m remove empty init methods fix warnings * EOAccess/EOAdaptor.[hm] add -expressionFactory * EOAccess/EOAdaptorChannel.m clean -performAdaptorOperation: * EOAccess/EOAdaptorOperation.m fix warnings * EOAccess/EODatabase.[hm] add/handle _timestamp * EOAccess/EODatabaseChannel.h remove delegate (moved to EODatabaseContext) add _currentEditingContextTimestamp add _refreshedGIDs * EOAccess/EODatabaseChannel.m fix warnings remove delegate (moved to EODatabaseContext) add _currentEditingContextTimestamp add _refreshedGIDs rewrite -setEntity: rewrite -setCurrentEditingContext: rewrite -fetchObject rewrite -cancelFetch rewrite -_selectWithFetchSpecification:editingContext: * EOAccess/EODatabaseContext.h add EODatabaseChannel delegate stuff * EOAccess/EODatabaseContextPriv.h add EODatabaseChannel delegate stuff * EOAccess/EODatabaseContext.m add EODatabaseChannel delegate stuff fix EOAdaptor..Operator / EODatabase..Operator mismatch * EOAccess/EODatabaseOperation.m fix warnings * EOAccess/EOEntity.[hm], EOAccess/EOEntityPriv.h fix warnings add singleTable... methods * EOAccess/EOExpressionArray.m fix warnings * EOAccess/EOSQLExpression.m rewrite -prepareInsertExpressionWithRow: * EOAccess/EOSQLExpressionFactory.[hm] new class * EOAccess/EOUtilities.[hm] remove duplicate methods * EOAccess/GNUmakefile add EOSQLExpressionFactory.[hm] * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.h remove duplicate _adaptorContext * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m remove duplicate _adaptorContext remove unused pgResultDictionary() * EOControl/EOEditingContext.h handle fetchTimestamp * EOControl/EOEditingContext.m handle fetchTimestamp rewrite -deleteObject: fix warnings * EOControl/EOGenericRecord.m fix warnings * EOControl/EOMutableKnownKeyDictionary.m fix warnings * EOControl/EONSAddOns.[hm] remove duplicate method * EOControl/EONull.m fix warnings git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37938 72102866-910b-0410-8b05-ffd578937521
2014-06-03 19:04:01 +00:00
- (NSString *)valueWithSQLExpressionElement:(id)element
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: fix newValueForDateTypeLengthAttribute * EOAccess/EOEntityPriv.h declare -_isSingleTableEntity declare -_assertNoPropagateKeyCycleWithEntities:relationships: * EOAccess/EOEntity.m fix _flattenAttribute:relationshipPath:currentAttributes: use relationshipPathBy...Component make _addAttributesToFetchForRelationshipPath:atts: more understandable implement -_assertNoPropagateKeyCycleWithEntities:relationships: implement -_isSingleTableEntity fix validateValue:forKey: * EOAccess/EOExpressionArray.m implement -valueWithSQLExpressionElement:forSQLExpression: fix -valueForSQLExpression: * EOAccess/EODatabaseContext.m reformat -batchNewPrimaryKeysWithEntity:count: reformat -prepareForSaveWithCoordinator:editingContext: reformat and fix -recordChangesInEditingContext: reformat -recordUpdateForObject:changes: fix -valuesForKeys:object: fix -nullifyAttributesInRelationship:sourceObject:destinationObject: add -_mutableValuesForKeys:object: add -_recordInsertForIntermediateRowFromSourceObject:... fix -relayAttributesInRelationship:sourceObject:destinationObject: fix -relayPrimaryKey:sourceObject:destObject:relationship: fix -relayPrimaryKey:object:entity: fix -createAdaptorOperationsForDatabaseOperation: fix -_buildPrimaryKeyGeneratorListForEditingContext: * EOAccess/EODatabaseOperation.m clean code * EOAccess/EODatabaseChannel.m fix -_propertiesToFetch * EOControl/EONSAddOns.[hm] add NSString (EORelationshipPath) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37902 72102866-910b-0410-8b05-ffd578937521
2014-05-22 14:05:51 +00:00
forSQLExpression:(EOSQLExpression*)sqlExpression
{
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: fix newValueForDateTypeLengthAttribute * EOAccess/EOEntityPriv.h declare -_isSingleTableEntity declare -_assertNoPropagateKeyCycleWithEntities:relationships: * EOAccess/EOEntity.m fix _flattenAttribute:relationshipPath:currentAttributes: use relationshipPathBy...Component make _addAttributesToFetchForRelationshipPath:atts: more understandable implement -_assertNoPropagateKeyCycleWithEntities:relationships: implement -_isSingleTableEntity fix validateValue:forKey: * EOAccess/EOExpressionArray.m implement -valueWithSQLExpressionElement:forSQLExpression: fix -valueForSQLExpression: * EOAccess/EODatabaseContext.m reformat -batchNewPrimaryKeysWithEntity:count: reformat -prepareForSaveWithCoordinator:editingContext: reformat and fix -recordChangesInEditingContext: reformat -recordUpdateForObject:changes: fix -valuesForKeys:object: fix -nullifyAttributesInRelationship:sourceObject:destinationObject: add -_mutableValuesForKeys:object: add -_recordInsertForIntermediateRowFromSourceObject:... fix -relayAttributesInRelationship:sourceObject:destinationObject: fix -relayPrimaryKey:sourceObject:destObject:relationship: fix -relayPrimaryKey:object:entity: fix -createAdaptorOperationsForDatabaseOperation: fix -_buildPrimaryKeyGeneratorListForEditingContext: * EOAccess/EODatabaseOperation.m clean code * EOAccess/EODatabaseChannel.m fix -_propertiesToFetch * EOControl/EONSAddOns.[hm] add NSString (EORelationshipPath) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37902 72102866-910b-0410-8b05-ffd578937521
2014-05-22 14:05:51 +00:00
NSString* value=nil;
if ([element respondsToSelector:@selector(valueForSQLExpression:)])
value=[element valueForSQLExpression:sqlExpression];
else if ([element isKindOfClass:[NSNumber class]])
value=[element stringValue];
else if ([element isKindOfClass:[NSString class]])
value=(NSString*)element;
else if (element == GDL2_EONull)
value = @"NULL";
else
value=[element description];
return value;
}
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: fix newValueForDateTypeLengthAttribute * EOAccess/EOEntityPriv.h declare -_isSingleTableEntity declare -_assertNoPropagateKeyCycleWithEntities:relationships: * EOAccess/EOEntity.m fix _flattenAttribute:relationshipPath:currentAttributes: use relationshipPathBy...Component make _addAttributesToFetchForRelationshipPath:atts: more understandable implement -_assertNoPropagateKeyCycleWithEntities:relationships: implement -_isSingleTableEntity fix validateValue:forKey: * EOAccess/EOExpressionArray.m implement -valueWithSQLExpressionElement:forSQLExpression: fix -valueForSQLExpression: * EOAccess/EODatabaseContext.m reformat -batchNewPrimaryKeysWithEntity:count: reformat -prepareForSaveWithCoordinator:editingContext: reformat and fix -recordChangesInEditingContext: reformat -recordUpdateForObject:changes: fix -valuesForKeys:object: fix -nullifyAttributesInRelationship:sourceObject:destinationObject: add -_mutableValuesForKeys:object: add -_recordInsertForIntermediateRowFromSourceObject:... fix -relayAttributesInRelationship:sourceObject:destinationObject: fix -relayPrimaryKey:sourceObject:destObject:relationship: fix -relayPrimaryKey:object:entity: fix -createAdaptorOperationsForDatabaseOperation: fix -_buildPrimaryKeyGeneratorListForEditingContext: * EOAccess/EODatabaseOperation.m clean code * EOAccess/EODatabaseChannel.m fix -_propertiesToFetch * EOControl/EONSAddOns.[hm] add NSString (EORelationshipPath) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37902 72102866-910b-0410-8b05-ffd578937521
2014-05-22 14:05:51 +00:00
- (NSString *)valueForSQLExpression: (EOSQLExpression*)sqlExpression
{
NSString* value = nil;
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: fix newValueForDateTypeLengthAttribute * EOAccess/EOEntityPriv.h declare -_isSingleTableEntity declare -_assertNoPropagateKeyCycleWithEntities:relationships: * EOAccess/EOEntity.m fix _flattenAttribute:relationshipPath:currentAttributes: use relationshipPathBy...Component make _addAttributesToFetchForRelationshipPath:atts: more understandable implement -_assertNoPropagateKeyCycleWithEntities:relationships: implement -_isSingleTableEntity fix validateValue:forKey: * EOAccess/EOExpressionArray.m implement -valueWithSQLExpressionElement:forSQLExpression: fix -valueForSQLExpression: * EOAccess/EODatabaseContext.m reformat -batchNewPrimaryKeysWithEntity:count: reformat -prepareForSaveWithCoordinator:editingContext: reformat and fix -recordChangesInEditingContext: reformat -recordUpdateForObject:changes: fix -valuesForKeys:object: fix -nullifyAttributesInRelationship:sourceObject:destinationObject: add -_mutableValuesForKeys:object: add -_recordInsertForIntermediateRowFromSourceObject:... fix -relayAttributesInRelationship:sourceObject:destinationObject: fix -relayPrimaryKey:sourceObject:destObject:relationship: fix -relayPrimaryKey:object:entity: fix -createAdaptorOperationsForDatabaseOperation: fix -_buildPrimaryKeyGeneratorListForEditingContext: * EOAccess/EODatabaseOperation.m clean code * EOAccess/EODatabaseChannel.m fix -_propertiesToFetch * EOControl/EONSAddOns.[hm] add NSString (EORelationshipPath) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37902 72102866-910b-0410-8b05-ffd578937521
2014-05-22 14:05:51 +00:00
int count=[self count];
if (count>0)
{
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: fix newValueForDateTypeLengthAttribute * EOAccess/EOEntityPriv.h declare -_isSingleTableEntity declare -_assertNoPropagateKeyCycleWithEntities:relationships: * EOAccess/EOEntity.m fix _flattenAttribute:relationshipPath:currentAttributes: use relationshipPathBy...Component make _addAttributesToFetchForRelationshipPath:atts: more understandable implement -_assertNoPropagateKeyCycleWithEntities:relationships: implement -_isSingleTableEntity fix validateValue:forKey: * EOAccess/EOExpressionArray.m implement -valueWithSQLExpressionElement:forSQLExpression: fix -valueForSQLExpression: * EOAccess/EODatabaseContext.m reformat -batchNewPrimaryKeysWithEntity:count: reformat -prepareForSaveWithCoordinator:editingContext: reformat and fix -recordChangesInEditingContext: reformat -recordUpdateForObject:changes: fix -valuesForKeys:object: fix -nullifyAttributesInRelationship:sourceObject:destinationObject: add -_mutableValuesForKeys:object: add -_recordInsertForIntermediateRowFromSourceObject:... fix -relayAttributesInRelationship:sourceObject:destinationObject: fix -relayPrimaryKey:sourceObject:destObject:relationship: fix -relayPrimaryKey:object:entity: fix -createAdaptorOperationsForDatabaseOperation: fix -_buildPrimaryKeyGeneratorListForEditingContext: * EOAccess/EODatabaseOperation.m clean code * EOAccess/EODatabaseChannel.m fix -_propertiesToFetch * EOControl/EONSAddOns.[hm] add NSString (EORelationshipPath) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37902 72102866-910b-0410-8b05-ffd578937521
2014-05-22 14:05:51 +00:00
if (sqlExpression != nil
* EOAccess/EOAccessFault.m remove empty init methods fix warnings * EOAccess/EOAdaptor.[hm] add -expressionFactory * EOAccess/EOAdaptorChannel.m clean -performAdaptorOperation: * EOAccess/EOAdaptorOperation.m fix warnings * EOAccess/EODatabase.[hm] add/handle _timestamp * EOAccess/EODatabaseChannel.h remove delegate (moved to EODatabaseContext) add _currentEditingContextTimestamp add _refreshedGIDs * EOAccess/EODatabaseChannel.m fix warnings remove delegate (moved to EODatabaseContext) add _currentEditingContextTimestamp add _refreshedGIDs rewrite -setEntity: rewrite -setCurrentEditingContext: rewrite -fetchObject rewrite -cancelFetch rewrite -_selectWithFetchSpecification:editingContext: * EOAccess/EODatabaseContext.h add EODatabaseChannel delegate stuff * EOAccess/EODatabaseContextPriv.h add EODatabaseChannel delegate stuff * EOAccess/EODatabaseContext.m add EODatabaseChannel delegate stuff fix EOAdaptor..Operator / EODatabase..Operator mismatch * EOAccess/EODatabaseOperation.m fix warnings * EOAccess/EOEntity.[hm], EOAccess/EOEntityPriv.h fix warnings add singleTable... methods * EOAccess/EOExpressionArray.m fix warnings * EOAccess/EOSQLExpression.m rewrite -prepareInsertExpressionWithRow: * EOAccess/EOSQLExpressionFactory.[hm] new class * EOAccess/EOUtilities.[hm] remove duplicate methods * EOAccess/GNUmakefile add EOSQLExpressionFactory.[hm] * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.h remove duplicate _adaptorContext * EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m remove duplicate _adaptorContext remove unused pgResultDictionary() * EOControl/EOEditingContext.h handle fetchTimestamp * EOControl/EOEditingContext.m handle fetchTimestamp rewrite -deleteObject: fix warnings * EOControl/EOGenericRecord.m fix warnings * EOControl/EOMutableKnownKeyDictionary.m fix warnings * EOControl/EONSAddOns.[hm] remove duplicate method * EOControl/EONull.m fix warnings git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37938 72102866-910b-0410-8b05-ffd578937521
2014-06-03 19:04:01 +00:00
&& [[self objectAtIndex:0] isKindOfClass:GDL2_EORelationshipClass])
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m: fix newValueForDateTypeLengthAttribute * EOAccess/EOEntityPriv.h declare -_isSingleTableEntity declare -_assertNoPropagateKeyCycleWithEntities:relationships: * EOAccess/EOEntity.m fix _flattenAttribute:relationshipPath:currentAttributes: use relationshipPathBy...Component make _addAttributesToFetchForRelationshipPath:atts: more understandable implement -_assertNoPropagateKeyCycleWithEntities:relationships: implement -_isSingleTableEntity fix validateValue:forKey: * EOAccess/EOExpressionArray.m implement -valueWithSQLExpressionElement:forSQLExpression: fix -valueForSQLExpression: * EOAccess/EODatabaseContext.m reformat -batchNewPrimaryKeysWithEntity:count: reformat -prepareForSaveWithCoordinator:editingContext: reformat and fix -recordChangesInEditingContext: reformat -recordUpdateForObject:changes: fix -valuesForKeys:object: fix -nullifyAttributesInRelationship:sourceObject:destinationObject: add -_mutableValuesForKeys:object: add -_recordInsertForIntermediateRowFromSourceObject:... fix -relayAttributesInRelationship:sourceObject:destinationObject: fix -relayPrimaryKey:sourceObject:destObject:relationship: fix -relayPrimaryKey:object:entity: fix -createAdaptorOperationsForDatabaseOperation: fix -_buildPrimaryKeyGeneratorListForEditingContext: * EOAccess/EODatabaseOperation.m clean code * EOAccess/EODatabaseChannel.m fix -_propertiesToFetch * EOControl/EONSAddOns.[hm] add NSString (EORelationshipPath) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37902 72102866-910b-0410-8b05-ffd578937521
2014-05-22 14:05:51 +00:00
{
value = [sqlExpression sqlStringForAttributePath:self];
}
else
{
NSMutableString* buffer = [NSMutableString string];
if (_prefix!=nil)
[buffer appendString: _prefix];
BOOL isFirst=YES;
int i=0;
for(i=0; i < count; i++)
{
NSObject* component = [self objectAtIndex:i];
NSString* aValue = [self valueWithSQLExpressionElement:component
forSQLExpression:sqlExpression];
if ([aValue length]>0)
{
if (isFirst)
isFirst=NO;
else if (_infix != nil)
[buffer appendString:_infix];
[buffer appendString:aValue];
}
}
if (!isFirst)
{
if(_suffix != nil)
[buffer appendString:_suffix];
value=[NSString stringWithString:buffer];
}
}
}
return value;
}
/* These are *this* subclasses responsibility */
- (NSUInteger) count
{
return GSIArrayCount(_contents);
}
- (id) objectAtIndex:(NSUInteger) index
{
if (index >= GSIArrayCount(_contents))
[self _raiseRangeExceptionWithIndex:index from:_cmd];
return GSIArrayItemAtIndex(_contents, index).obj;
}
- (void) addObject:(id)object
{
if (object == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Attempt to add nil to an array"];
return;
}
GSIArrayAddItem(_contents, (GSIArrayItem)object);
}
- (void) replaceObjectAtIndex:(NSUInteger)index withObject:(id)object
{
if (object == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Attempt to add nil to an array"];
return;
}
else if (index >= GSIArrayCount(_contents))
{
[self _raiseRangeExceptionWithIndex:index from:_cmd];
return;
}
GSIArraySetItemAtIndex(_contents, (GSIArrayItem)object, index);
}
- (void) insertObject:(id)object atIndex:(NSUInteger)index
{
if (object == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Attempt to add nil to an array"];
return;
}
else if (index >= GSIArrayCount(_contents))
{
[self _raiseRangeExceptionWithIndex:index from:_cmd];
}
GSIArrayInsertItem(_contents, (GSIArrayItem)object, index);
}
- (void) removeObjectAtIndex:(NSUInteger)index
{
if (index >= GSIArrayCount(_contents))
{
[self _raiseRangeExceptionWithIndex:index from:_cmd];
}
GSIArrayRemoveItemAtIndex(_contents, index);
}
- (void) removeAllObjects
{
GSIArrayRemoveAllItems(_contents);
}
/* might as well also implement because we can do it faster */
- (id) lastObject
{
return GSIArrayLastItem(_contents).obj;
}
- (id) firstObject
{
if (GSIArrayCount(_contents) == 0)
return nil;
return GSIArrayItemAtIndex(_contents, 0).obj;
}
/* not only make it faster but work around for old buggy implementations of
* NSArray in gnustep with an extra release */
- (void) removeObject:(id)anObject
{
int index = GSIArrayCount(_contents);
BOOL (*eq)(id,SEL,id)
= (BOOL (*)(id, SEL, id))[anObject methodForSelector:eqSel];
/* iterate backwards, so that all objects equal to 'anObject'
* can safely be removed from the array while iterating. */
while (index-- > 0)
{
if ((*eq)(anObject, eqSel, GSIArrayItemAtIndex(_contents, index).obj))
{
GSIArrayRemoveItemAtIndex(_contents, index);
}
}
}
/* private methods. */
- (void) _raiseRangeExceptionWithIndex: (unsigned)index from: (SEL)sel
{
NSDictionary *info;
NSException *exception;
NSString *reason;
unsigned count = GSIArrayCount(_contents);
info = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedInt: index], @"Index",
[NSNumber numberWithUnsignedInt: count], @"Count",
self, @"Array", nil, nil];
reason = [NSString stringWithFormat: @"Index %d is out of range %d (in '%@')", index, count, NSStringFromSelector(sel)];
exception = [NSException exceptionWithName: NSRangeException
reason: reason
userInfo: info];
[exception raise];
}
@end /* EOExpressionArray */
@implementation NSObject (EOExpression)
- (NSString*)expressionValueForContext: (id<EOExpressionContext>)ctx
{
if ([self respondsToSelector: @selector(stringValue)])
return [(id)self stringValue];
else
return [self description];
}
@end
@implementation NSString (EOExpression)
/* Avoid returning the description in case of NSString because if the string
contains whitespaces it will be quoted. Particular adaptors have to override
-formatValue:forAttribute: and they have to quote with the specific
database character the returned string. */
- (NSString*)expressionValueForContext: (id<EOExpressionContext>)ctx
{
return self;
}
@end
@implementation NSString (EOAttributeTypeCheck)
- (BOOL)isNameOfARelationshipPath
{
const char *s = [self cString];
BOOL result = NO;
if (isalnum(*s) || *s == '@' || *s == '_' || *s == '#')
{
for (++s; *s; s++)
{
if (!isalnum(*s) && *s != '@' && *s != '_' && *s != '#' && *s != '$'
&& *s != '.')
return NO;
if (*s == '.')
result = YES;
}
}
return result;
}
@end