* 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
This commit is contained in:
Manuel Guesdon 2014-04-26 18:23:22 +00:00
parent 97b6302f68
commit 04d6bb3aac
19 changed files with 2006 additions and 1345 deletions

109
ChangeLog
View file

@ -1,3 +1,112 @@
2014-04-26 Manuel Guesdon <mguesdon@orange-concept.com>
* 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
2014-03-09 Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>
* EOControl/EOCheapArray.m
* EOControl/EODebug.m

View file

@ -599,6 +599,10 @@ prepareInsertExpressionWithRow:changedValues
int i = 0;
int count = 0;
if (_delegateRespondsTo.willPerformOperations)
adaptorOperations=[_delegate adaptorChannel: self
willPerformOperations: adaptorOperations];
count=[adaptorOperations count];
for(i = 0; i < count; i++)

View file

@ -68,7 +68,7 @@ typedef enum {
EOInOutParameter
} EOParameterDirection;
#define EOATTRIBUTE_PROTO_OVERRIDE_BITS_COUNT 18
@interface EOAttribute : NSObject <EOPropertyListEncoding>
{
NSString *_name;
@ -94,7 +94,7 @@ typedef enum {
unsigned int allowsNull:1;
unsigned int isReadOnly:1;
unsigned int isParentAnEOEntity:1;
unsigned int protoOverride:18;
unsigned int protoOverride:EOATTRIBUTE_PROTO_OVERRIDE_BITS_COUNT;
unsigned int isAttributeValueInitialized:1;
unsigned int unused : 10;
} _flags;
@ -107,6 +107,7 @@ typedef enum {
NSString *_docComment;
id _parent; /* unretained */
NSString *_prototypeName;
EOAttribute *_prototype;
EOExpressionArray *_definitionArray;
EOAttribute *_realAttribute; // if the attribute is flattened //Not in EOF !
@ -166,8 +167,6 @@ typedef enum {
- (NSString *)docComment;
- (BOOL)isKeyDefinedByPrototype: (NSString *)key;
/**
* Returns YES if the attribute references aProperty, NO otherwise.
*/
@ -176,6 +175,12 @@ typedef enum {
- (void)setParent: (id)parent;
- (void)setEntity:(EOEntity*)entity;
- (NSString*)relationshipPath;
- (EOAttribute*)targetAttribute;
@end
@ -219,8 +224,8 @@ typedef enum {
- (void)setDocComment: (NSString *)docComment;
- (id)_normalizeDefinition: (EOExpressionArray *)definition
path: (id)path;
- (id)_normalizeDefinition: (id)definition
path: (NSArray *)path;
@end

File diff suppressed because it is too large Load diff

View file

@ -27,22 +27,53 @@
#ifndef __EOAttributePriv_h__
#define __EOAttributePriv_h__
typedef enum _EOAttributeProtoOverrideBits
{
EOAttributeProtoOverrideBits_externalType = 0,
EOAttributeProtoOverrideBits_columnName = 1,
EOAttributeProtoOverrideBits_readOnly = 2,
EOAttributeProtoOverrideBits_valueClassName = 3,
EOAttributeProtoOverrideBits_valueType = 4,
EOAttributeProtoOverrideBits_width = 5,
EOAttributeProtoOverrideBits_precision = 6,
EOAttributeProtoOverrideBits_scale = 7,
EOAttributeProtoOverrideBits_writeFormat = 8,
EOAttributeProtoOverrideBits_readFormat = 9,
EOAttributeProtoOverrideBits_userInfo = 10,
EOAttributeProtoOverrideBits_serverTimeZone = 11,
EOAttributeProtoOverrideBits_valueFactoryMethodName = 12,
EOAttributeProtoOverrideBits_adaptorValueConversionMethodName = 13,
EOAttributeProtoOverrideBits_factoryMethodArgumentType = 14,
EOAttributeProtoOverrideBits_allowsNull = 15,
EOAttributeProtoOverrideBits_parameterDirection = 16,
EOAttributeProtoOverrideBits_internalInfo = 17,
EOAttributeProtoOverrideBits__count
} EOAttributeProtoOverrideBits;
@interface EOAttribute (EOAttributePrivate)
-(EOExpressionArray*)_objectForPList:(NSDictionary*)pList;
- (EOExpressionArray *)_definitionArray;
- (EOAttribute *)realAttribute;
- (Class)_valueClass;
- (unichar)_valueTypeCharacter;
- (void)_setDefinitionWithoutFlushingCaches: (NSString *)definition;
- (EOModel*)_parentModel;
- (void)_removeFromEntityArray:(NSArray*)entityArray
selector:(SEL)setSelector;
- (void)_setValuesFromTargetAttribute;
-(void)_setSourceToDestinationKeyMap:(NSDictionary*)map;
-(NSDictionary*) _sourceToDestinationKeyMap;
@end
@interface EOAttribute (EOAttributePrivate2)
- (BOOL)_hasAnyOverrides;
- (void)_resetPrototype;
- (void)_updateFromPrototype;
- (void)_setOverrideForKeyEnum: (int)keyEnum;
- (BOOL)_isKeyEnumOverriden: (int)param0;
- (BOOL)_isKeyEnumDefinedByPrototype: (int)param0;
- (void)_setOverrideForKeyEnum: (EOAttributeProtoOverrideBits)keyEnum;
- (BOOL)_isKeyEnumOverriden: (EOAttributeProtoOverrideBits)keyEnum;
- (BOOL)_isKeyEnumDefinedByPrototype: (EOAttributeProtoOverrideBits)keyEnum;
@end
#endif /* __EOAttributePriv_h__ */

View file

@ -479,7 +479,9 @@ static Class _contextClass = Nil;
[_registeredChannels count] + 1);
[_registeredChannels addObject:channel];
[channel setDelegate: nil];
//Channels have same delegate as context
[channel setDelegate: _delegate];
}
- (void)unregisterChannel: (EODatabaseChannel *)channel
@ -1070,7 +1072,6 @@ classPropertyNames = [entity classPropertyNames];
EOEntity *entity;
EORelationship *relationship;
NSUInteger maxBatch = 0;
BOOL isToManyToOne = NO;
EOEntity *destinationEntity = nil;
EOModel *destinationEntityModel = nil;
NSArray *models = nil;
@ -1099,13 +1100,16 @@ classPropertyNames = [entity classPropertyNames];
//Get the max number of fault to fetch
maxBatch = [relationship numberOfToManyFaultsToBatchFetch];
isToManyToOne = [relationship isToManyToOne];//NO
if (isToManyToOne)
{
NSEmitTODO();
[self notImplemented: _cmd]; //TODO if isToManyToOne
}
if(maxBatch == 0)
{
if ([relationship isToManyToOne])
{
maxBatch = [[relationship firstRelationship]numberOfToManyFaultsToBatchFetch];
if(maxBatch == 0)
maxBatch=1;
}
}
//TODO: use maxBatch
//Get the fault entity (aka relationsip destination entity)
destinationEntity = [relationship destinationEntity];

View file

@ -85,6 +85,7 @@
EOMKKDInitializer* _propertyDictionaryInitializer;
EOMKKDInitializer* _instanceDictionaryInitializer;
EOMKKDSubsetMapping* _snapshotToAdaptorRowSubsetMapping;
NSMutableDictionary* _flattenedAttNameToSnapshotKeyMapping;
Class _classForInstances;
@ -116,7 +117,7 @@
unsigned int isAbstractEntity:1;
unsigned int updating:1;
unsigned int cachesObjects:1;
unsigned int unused:1;
unsigned int isSingleTableEntity:1;
unsigned int extraRefCount:22;
} _flags;

File diff suppressed because it is too large Load diff

View file

@ -63,13 +63,13 @@
- (NSArray *)relationshipsPlist;
- (id)rootParent;
- (void)_setParent: (id)param0;
- (NSArray *)_hiddenRelationships;
- (NSMutableArray *)_hiddenRelationships;
- (NSArray *)_propertyNames;
- (id)_flattenAttribute: (id)param0
relationshipPath: (id)param1
currentAttributes: (id)param2;
- (EOAttribute*) _flattenAttribute: (EOAttribute*)attribute
relationshipPath: (NSString*)relationshipPath
currentAttributes: (NSDictionary*)currentAttributes;
- (NSString *)snapshotKeyForAttributeName: (NSString *)attributeName;
- (id)_flattenedAttNameToSnapshotKeyMapping;
- (NSDictionary*)_flattenedAttNameToSnapshotKeyMapping;
- (EOMKKDSubsetMapping *)_snapshotToAdaptorRowSubsetMapping;
- (EOMutableKnownKeyDictionary *)_dictionaryForPrimaryKey;
- (EOMutableKnownKeyDictionary *)_dictionaryForProperties;
@ -93,19 +93,18 @@
@end
@interface EOEntity (EOEntityRelationshipPrivate)
- (EORelationship *)_inverseRelationshipPathForPath: (NSString *)path;
- (NSString *)_inverseRelationshipPathForPath: (NSString *)path;
- (NSDictionary *)_keyMapForRelationshipPath: (NSString *)path;
- (NSDictionary*)_keyMapForIdenticalKeyRelationshipPath: (NSString *)path;
- (EOAttribute*)_mapAttribute: (EOAttribute*)attribute
toDestinationAttributeInLastComponentOfRelationshipPath: (NSString *)path;
- (BOOL)_relationshipPathIsToMany: (NSString *)relPath;
- (BOOL)_relationshipPathHasIdenticalKeys: (id)param0;
- (BOOL)_relationshipPathHasIdenticalKeys: (NSString*)path;
@end
@interface EOEntity (EOEntitySQLExpression)
- (NSString *)valueForSQLExpression: (EOSQLExpression *)sqlExpression;
+ (NSString *)valueForSQLExpression: (EOSQLExpression *)sqlExpression;
@end
@interface EOEntity (EOEntityPrivateXX)
@ -123,7 +122,7 @@ toDestinationAttributeInLastComponentOfRelationshipPath: (NSString *)path;
- (NSArray *)classPropertyAttributeNames;
- (NSArray *)classPropertyToManyRelationshipNames;
- (NSArray *)classPropertyToOneRelationshipNames;
- (id)qualifierForDBSnapshot: (id)param0;
- (EOQualifier*) qualifierForDBSnapshot:(NSDictionary*)dbSnapshot;
- (void)_addAttributesToFetchForRelationshipPath: (NSString *)path
atts: (NSMutableDictionary *)atts;
- (NSArray *)dbSnapshotKeys;

View file

@ -98,6 +98,8 @@
- (NSString *)valueForSQLExpression: (EOSQLExpression *)sqlExpression;
- (BOOL)_isPropertyPath;
@end /* EOExpressionArray */

View file

@ -66,6 +66,7 @@ RCS_ID("$Id$")
#include <EOAccess/EOEntity.h>
#include <EOAccess/EOExpressionArray.h>
#include <EOAccess/EORelationship.h>
#include "EOPrivate.h"
static SEL eqSel;
@ -164,7 +165,7 @@ static SEL eqSel;
- (NSString *)expressionValueForContext: (id<EOExpressionContext>)ctx
{
if (ctx && [self count]
&& [[self objectAtIndex: 0] isKindOfClass: [EORelationship class]])
&& [[self objectAtIndex: 0] isKindOfClass: GDL2_EORelationshipClass])
return [ctx expressionValueForAttributePath: self];
else
{
@ -334,17 +335,10 @@ static SEL eqSel;
- (BOOL)_isPropertyPath
{
/*
int i=0;
int count=0;
count=[self count];
objectAtIndex:i
if it's a string return NO
*/
//TODO
return NO;
if ([self count]<=0)
return NO;
else
return [[self objectAtIndex:0] isKindOfClass:GDL2_EORelationshipClass];
}
- (NSString *)valueForSQLExpression: (EOSQLExpression*)sqlExpression

View file

@ -91,9 +91,17 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
@end /* EOModel (EOModelPrivate) */
@implementation EOModel
+ (void)initialize
{
static BOOL initialized=NO;
if (!initialized)
{
initialized=YES;
};
};
+ (EOModel*) model
{
return AUTORELEASE([[self alloc] init]);
@ -199,8 +207,6 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
- (id)init
{
if ((self = [super init]))
{
// Turbocat
@ -219,7 +225,6 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
name: EOClassDescriptionNeededNotification
object: nil];
//No ?
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(_classDescriptionNeeded:)
@ -1344,7 +1349,7 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
for (; refIdx < refCount; refIdx++) {
id refObj = [references objectAtIndex:refIdx];
if ([refObj class] == [EOAttribute class])
if ([refObj class] == GDL2_EOAttributeClass)
{
[[(EOAttribute*) refObj entity] removeAttribute:refObj];
} else {
@ -1404,7 +1409,7 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
NSString *entityName = nil;
NSString *entityClassName = nil;
if ([entity isKindOfClass: [EOEntity class]])
if ([entity isKindOfClass:GDL2_EOEntityClass])
{
entityName = [entity name];
entityClassName = [entity className];
@ -1895,17 +1900,49 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
return returnPath;
}
-(NSDictionary*)propertyListForEntity:(id)entity
name:(NSString*)name
{
NSDictionary* propList=nil;
NSString* plistPathName = [[[self path] stringByAppendingPathComponent: name]
stringByAppendingPathExtension: @"plist"];
EOFLOGObjectLevelArgs(@"gsdb", @"entity plistPathName =%@",
plistPathName);
propList = [NSDictionary dictionaryWithContentsOfFile: plistPathName];
EOFLOGObjectLevelArgs(@"gsdb", @"entity propList=%@", propList);
if (!propList)
{
if ([[NSFileManager defaultManager]
fileExistsAtPath: plistPathName])
{
NSAssert1(NO,
@"%@ is not a dictionary or is not readable.",
plistPathName);
}
else
{
propList = entity;
NSWarnLog(@"%@ doesn't exists. Using %@",
plistPathName, propList);
}
}
return propList;
}
- (EOEntity *) _verifyBuiltEntityObject: (id)entity
named: (NSString*)name
{
if ([entity isKindOfClass: [EOEntity class]] == NO)
if ([entity isKindOfClass:GDL2_EOEntityClass] == NO)
{
[EOObserverCenter suppressObserverNotification];
NS_DURING
{
NSString *basePath = nil;
NSString *plistPathName = nil;
NSDictionary *propList = nil;
EOFLOGObjectLevelArgs(@"gsdb", @"name=%@", name);
@ -1928,32 +1965,8 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
}
else
{
plistPathName = [[basePath stringByAppendingPathComponent: name]
stringByAppendingPathExtension: @"plist"];
EOFLOGObjectLevelArgs(@"gsdb", @"entity plistPathName =%@",
plistPathName);
propList
= [NSDictionary dictionaryWithContentsOfFile: plistPathName];
EOFLOGObjectLevelArgs(@"gsdb", @"entity propList=%@", propList);
if (!propList)
{
if ([[NSFileManager defaultManager]
fileExistsAtPath: plistPathName])
{
NSAssert1(NO,
@"%@ is not a dictionary or is not readable.",
plistPathName);
}
else
{
propList = entity;
NSWarnLog(@"%@ doesn't exists. Using %@",
plistPathName, propList);
}
}
propList=[self propertyListForEntity:entity
name:name];
}
[self _removeEntity: entity];

View file

@ -50,7 +50,7 @@
{
NSMutableDictionary *_modelsByName;
id _delegate;
@public //EORelationship need access to relationshipForRow
struct {
unsigned int entityNamed:1;
unsigned int relationshipForRow:1;

View file

@ -38,6 +38,8 @@
// ==== Classes ====
GDL2ACCESS_EXPORT Class GDL2_EODatabaseContextClass;
GDL2ACCESS_EXPORT Class GDL2_EOAttributeClass;
GDL2ACCESS_EXPORT Class GDL2_EORelationshipClass;
GDL2ACCESS_EXPORT Class GDL2_EOEntityClass;
// ==== IMPs ====
GDL2ACCESS_EXPORT IMP GDL2_EODatabaseContext_snapshotForGlobalIDIMP;

View file

@ -44,6 +44,7 @@ RCS_ID("$Id$")
#include <EOControl/EOFault.h>
#include <EOControl/EOMutableKnownKeyDictionary.h>
#include <EOAccess/EOAttribute.h>
#include <EOAccess/EOEntity.h>
#include <EOAccess/EODatabaseContext.h>
#include "EOPrivate.h"
@ -51,6 +52,8 @@ RCS_ID("$Id$")
// ==== Classes ====
Class GDL2_EODatabaseContextClass=Nil;
Class GDL2_EOAttributeClass=Nil;
Class GDL2_EORelationshipClass=Nil;
Class GDL2_EOEntityClass=Nil;
// ==== IMPs ====
IMP GDL2_EODatabaseContext_snapshotForGlobalIDIMP=NULL;
@ -69,6 +72,8 @@ void GDL2_EOAccessPrivateInit()
// ==== Classes ====
GDL2_EODatabaseContextClass = [EODatabaseContext class];
GDL2_EOAttributeClass = [EOAttribute class];
GDL2_EORelationshipClass = [EORelationship class];
GDL2_EOEntityClass = [EOEntity class];
GDL2_EODatabaseContext_snapshotForGlobalIDIMP=[GDL2_EODatabaseContextClass instanceMethodForSelector:@selector(snapshotForGlobalID:)];

View file

@ -95,7 +95,6 @@ typedef enum {
/* Computed values */
NSArray *_sourceAttributes;
NSArray *_destinationAttributes;
NSMutableArray *_componentRelationships;//Used ????
}
+ (id)relationshipWithPropertyList: (NSDictionary *)propertyList
@ -192,9 +191,9 @@ typedef enum {
- (EORelationship *)firstRelationship;
- (EOEntity*) intermediateEntity;
- (BOOL)isMultiHop;
- (void)_setSourceToDestinationKeyMap: (id)param0;
- (id)qualifierForDBSnapshot: (id)param0;
- (id)primaryKeyForTargetRowFromSourceDBSnapshot: (id)param0;
- (void)_setSourceToDestinationKeyMap:(NSDictionary *)sourceToDestinationKeyMap;
- (EOQualifier*)qualifierForDBSnapshot:(NSDictionary *)dbSnapshot;
- (NSDictionary *)primaryKeyForTargetRowFromSourceDBSnapshot:(NSDictionary *)dbSnapshot;
- (NSString *)relationshipPath;
- (BOOL)isToManyToOne;
- (NSDictionary *)_sourceToDestinationKeyMap;
@ -203,9 +202,9 @@ typedef enum {
@interface EORelationship (EORelationshipPrivate2)
- (BOOL)isPropagatesPrimaryKeyPossible;
- (id)qualifierOmittingAuxiliaryQualifierWithSourceRow: (id)param0;
- (id)auxiliaryQualifier;
- (void)setAuxiliaryQualifier: (id)param0;
- (EOQualifier*)qualifierOmittingAuxiliaryQualifierWithSourceRow: (NSDictionary *)row;
- (EOQualifier*)auxiliaryQualifier;
- (void)setAuxiliaryQualifier: (EOQualifier*)qualifier;
- (EOMutableKnownKeyDictionary *)_foreignKeyForSourceRow: (NSDictionary *)row;
- (EOMKKDSubsetMapping *)_sourceRowToForeignKeyMapping;
- (NSArray *)_sourceAttributeNames;

File diff suppressed because it is too large Load diff

View file

@ -2053,7 +2053,7 @@ else if([attribute isDerived] == YES)
EOFLOGObjectLevelArgs(@"EOSQLExpression", @"[path objectAtIndex:%d]=%@",
i, relationship);
NSAssert2([relationship isKindOfClass:[EORelationship class]],
NSAssert2([relationship isKindOfClass:GDL2_EORelationshipClass],
@"'%@' is not a relationship but a %@",
relationship,
[relationship class]);

View file

@ -320,7 +320,6 @@ newValueForNumberTypeLengthAttribute(const void *bytes,
};
};
};
return value;
}
@ -397,11 +396,15 @@ newValueForDateTypeLengthAttribute (const void *bytes,
{
getDigits(&str[5],tmpString,2,&error);
month = atoi(tmpString);
//Postgres can return bad dates sometimes (it accept bad date in insert/update)
NSCAssert2(month>0,@"Bad month in date %*s",length,bytes);
if (length > 9)
{
getDigits(&str[8],tmpString,2,&error);
day = atoi(tmpString);
//Postgres can return bad dates sometimes (it accept bad date in insert/update)
NSCAssert2(day>0,@"Bad day in date %*s",length,bytes);
if (length > 12)
{
@ -1140,13 +1143,29 @@ each key
insertStatementForRow: nrow
entity: entity];
if ([self _evaluateExpression: sqlexpr withAttributes: nil] == 0) //call evaluateExpression:
[NSException raise: EOGeneralAdaptorException
format: @"%@ -- %@ 0x%p: cannot insert row for entity '%@'",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
[entity name]];
if (!_delegateRespondsTo.shouldEvaluateExpression
|| [_delegate adaptorChannel: self
shouldEvaluateExpression: sqlexpr])
{
if ([self _evaluateExpression: sqlexpr
withAttributes: nil] == 0)
{
[NSException raise: EOGeneralAdaptorException
format: @"%@ -- %@ 0x%p: cannot insert row for entity '%@'",
NSStringFromSelector(_cmd),
NSStringFromClass([self class]),
self,
[entity name]];
}
else
{
if (_delegateRespondsTo.didEvaluateExpression)
{
[_delegate adaptorChannel: self
didEvaluateExpression: sqlexpr];
}
}
}
}
[_adaptorContext autoCommitTransaction];
@ -1191,8 +1210,19 @@ each key
deleteStatementWithQualifier: qualifier
entity: entity];
rows = [self _evaluateExpression: sqlexpr withAttributes: nil];
if (!_delegateRespondsTo.shouldEvaluateExpression
|| [_delegate adaptorChannel: self
shouldEvaluateExpression: sqlexpr])
{
rows = [self _evaluateExpression: sqlexpr
withAttributes: nil];
if (_delegateRespondsTo.didEvaluateExpression)
{
[_delegate adaptorChannel: self
didEvaluateExpression: sqlexpr];
}
}
[adaptorContext autoCommitTransaction];
return rows;
@ -1262,8 +1292,18 @@ each key
fetchSpecification: fetchSpecification
entity: entity];
[self _evaluateExpression: sqlExpr
withAttributes: attributes];
if (!_delegateRespondsTo.shouldEvaluateExpression
|| [_delegate adaptorChannel: self
shouldEvaluateExpression: sqlExpr])
{
[self _evaluateExpression: sqlExpr
withAttributes: attributes];
if (_delegateRespondsTo.didEvaluateExpression)
{
[_delegate adaptorChannel: self
didEvaluateExpression: sqlExpr];
}
}
[_adaptorContext autoCommitTransaction];
@ -2198,6 +2238,7 @@ each key
EOAttribute *primAttribute;
NSString *sqlString;
NSNumber *pkValue = nil;
NSString *sqlFormat = nil;
const char *string = NULL;
int length = 0;
@ -2211,9 +2252,12 @@ each key
{
return nil; // We support only number keys
}
sqlString = [NSString stringWithFormat: @"SELECT nextval('%@_SEQ')",
[entity primaryKeyRootName]];
sqlFormat=[NSString stringWithFormat: @"SELECT nextval('%@')",
[[[self adaptorContext]adaptor] primaryKeySequenceNameFormat]];
sqlString = [NSString stringWithFormat: sqlFormat,
[entity primaryKeyRootName]];
if ([self isDebugEnabled])
{