mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-21 10:30:58 +00:00
* EOAccess/EOAttribute.m
include EOSQLExpression.h move methods around to fix warnings * EOAccess/EOEntity.m include EOFetchSpecification.h to fix warning * EOAccess/EOAdaptor.m fix Mime include * EOAccess/EOStoredProcedure.m fix warning in setExternalName: * EOAccess/EODatabaseContext.m include EOAttributePriv.h and EOSQLExpression.h to fix warning entityForGlobalID: cast to EOKeyGlobalID to avoid warning. use caching. _fetchRawRowKeyPaths: fix warnings by using proper types. processSnapshotForDatabaseOperation: set EONull value when needed. avoid warnings. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30569 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
eab4c9915c
commit
689fa01970
8 changed files with 109 additions and 78 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2010-06-03 David Wetzel <dave@turbocat.de>
|
||||||
|
* EOAccess/EOAttribute.m
|
||||||
|
include EOSQLExpression.h
|
||||||
|
move methods around to fix warnings
|
||||||
|
* EOAccess/EOEntity.m
|
||||||
|
include EOFetchSpecification.h to fix warning
|
||||||
|
* EOAccess/EOAdaptor.m
|
||||||
|
fix Mime include
|
||||||
|
* EOAccess/EOStoredProcedure.m
|
||||||
|
fix warning in setExternalName:
|
||||||
|
* EOAccess/EODatabaseContext.m
|
||||||
|
include EOAttributePriv.h and EOSQLExpression.h to fix warning
|
||||||
|
entityForGlobalID: cast to EOKeyGlobalID to avoid warning.
|
||||||
|
use caching.
|
||||||
|
_fetchRawRowKeyPaths: fix warnings by using proper types.
|
||||||
|
processSnapshotForDatabaseOperation: set EONull value when needed.
|
||||||
|
avoid warnings.
|
||||||
|
|
||||||
2010-06-03 David Wetzel <dave@turbocat.de>
|
2010-06-03 David Wetzel <dave@turbocat.de>
|
||||||
* configure.ac
|
* configure.ac
|
||||||
replaced DBModeler with Apps/EOModeler Apps/EOModelEditor
|
replaced DBModeler with Apps/EOModeler Apps/EOModelEditor
|
||||||
|
|
|
@ -62,7 +62,6 @@ RCS_ID("$Id$")
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
#include <Foundation/NSSet.h>
|
#include <Foundation/NSSet.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <Foundation/GSMime.h>
|
|
||||||
#else
|
#else
|
||||||
#include <Foundation/Foundation.h>
|
#include <Foundation/Foundation.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,12 +69,11 @@ RCS_ID("$Id$")
|
||||||
#ifndef GNUSTEP
|
#ifndef GNUSTEP
|
||||||
#include <GNUstepBase/GNUstep.h>
|
#include <GNUstepBase/GNUstep.h>
|
||||||
#include <GNUstepBase/NSDebug+GNUstepBase.h>
|
#include <GNUstepBase/NSDebug+GNUstepBase.h>
|
||||||
#include <GNUstepBase/GSMime.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <GNUstepBase/GSMime.h>
|
||||||
#include <GNUstepBase/Unicode.h>
|
#include <GNUstepBase/Unicode.h>
|
||||||
|
|
||||||
|
|
||||||
#include <EOControl/EONSAddOns.h>
|
#include <EOControl/EONSAddOns.h>
|
||||||
#include <EOControl/EODebug.h>
|
#include <EOControl/EODebug.h>
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,14 @@ typedef enum {
|
||||||
|
|
||||||
- (BOOL)isKeyDefinedByPrototype: (NSString *)key;
|
- (BOOL)isKeyDefinedByPrototype: (NSString *)key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns YES if the attribute references aProperty, NO otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
- (BOOL)referencesProperty:(id)aProperty;
|
||||||
|
|
||||||
|
- (void)setParent: (id)parent;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ RCS_ID("$Id$")
|
||||||
#include <EOAccess/EOStoredProcedure.h>
|
#include <EOAccess/EOStoredProcedure.h>
|
||||||
#include <EOAccess/EORelationship.h>
|
#include <EOAccess/EORelationship.h>
|
||||||
#include <EOAccess/EOExpressionArray.h>
|
#include <EOAccess/EOExpressionArray.h>
|
||||||
|
#include <EOAccess/EOSQLExpression.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -699,6 +700,30 @@ RCS_ID("$Id$")
|
||||||
return [_prototype valueType];
|
return [_prototype valueType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setParent: (id)parent
|
||||||
|
{
|
||||||
|
//OK
|
||||||
|
[self willChange];
|
||||||
|
_parent = parent;
|
||||||
|
|
||||||
|
_flags.isParentAnEOEntity = [_parent isKindOfClass: [EOEntity class]];//??
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns YES if the attribute references aProperty, NO otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
- (BOOL)referencesProperty:(id)aProperty
|
||||||
|
{
|
||||||
|
if (!_definitionArray)
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
} else {
|
||||||
|
// _definitionArray is an EOExpressionArray
|
||||||
|
return [_definitionArray referencesObject:aProperty];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation EOAttribute (EOAttributeSQLExpression)
|
@implementation EOAttribute (EOAttributeSQLExpression)
|
||||||
|
@ -1868,30 +1893,6 @@ More details:
|
||||||
|
|
||||||
@implementation EOAttribute (EOAttributePrivate)
|
@implementation EOAttribute (EOAttributePrivate)
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns YES if the attribute references aProperty, NO otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
- (BOOL)referencesProperty:(id)aProperty
|
|
||||||
{
|
|
||||||
if (!_definitionArray)
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
} else {
|
|
||||||
// _definitionArray is an EOExpressionArray
|
|
||||||
return [_definitionArray referencesObject:aProperty];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setParent: (id)parent
|
|
||||||
{
|
|
||||||
//OK
|
|
||||||
[self willChange];
|
|
||||||
_parent = parent;
|
|
||||||
|
|
||||||
_flags.isParentAnEOEntity = [_parent isKindOfClass: [EOEntity class]];//??
|
|
||||||
}
|
|
||||||
|
|
||||||
- (EOAttribute *)realAttribute
|
- (EOAttribute *)realAttribute
|
||||||
{
|
{
|
||||||
return _realAttribute;
|
return _realAttribute;
|
||||||
|
|
|
@ -28,9 +28,8 @@
|
||||||
#define __EOAttributePriv_h__
|
#define __EOAttributePriv_h__
|
||||||
|
|
||||||
@interface EOAttribute (EOAttributePrivate)
|
@interface EOAttribute (EOAttributePrivate)
|
||||||
- (NSMutableArray *)_definitionArray;
|
- (EOExpressionArray *)_definitionArray;
|
||||||
|
|
||||||
- (void)setParent: (id)parent;
|
|
||||||
- (EOAttribute *)realAttribute;
|
- (EOAttribute *)realAttribute;
|
||||||
|
|
||||||
- (Class)_valueClass;
|
- (Class)_valueClass;
|
||||||
|
|
|
@ -84,6 +84,7 @@ RCS_ID("$Id$")
|
||||||
#include <EOAccess/EOEntity.h>
|
#include <EOAccess/EOEntity.h>
|
||||||
#include <EOAccess/EORelationship.h>
|
#include <EOAccess/EORelationship.h>
|
||||||
#include <EOAccess/EOAttribute.h>
|
#include <EOAccess/EOAttribute.h>
|
||||||
|
#include <EOAccess/EOAttributePriv.h>
|
||||||
#include <EOAccess/EOStoredProcedure.h>
|
#include <EOAccess/EOStoredProcedure.h>
|
||||||
#include <EOAccess/EOJoin.h>
|
#include <EOAccess/EOJoin.h>
|
||||||
|
|
||||||
|
@ -93,6 +94,7 @@ RCS_ID("$Id$")
|
||||||
#include <EOAccess/EODatabaseOperation.h>
|
#include <EOAccess/EODatabaseOperation.h>
|
||||||
#include <EOAccess/EOAccessFault.h>
|
#include <EOAccess/EOAccessFault.h>
|
||||||
#include <EOAccess/EOExpressionArray.h>
|
#include <EOAccess/EOExpressionArray.h>
|
||||||
|
#include <EOAccess/EOSQLExpression.h>
|
||||||
|
|
||||||
#include "EOPrivate.h"
|
#include "EOPrivate.h"
|
||||||
#include "EOEntityPriv.h"
|
#include "EOEntityPriv.h"
|
||||||
|
@ -694,18 +696,18 @@ May raise an exception if transaction has began or if you want pessimistic lock
|
||||||
/** return entity corresponding to 'globalID' **/
|
/** return entity corresponding to 'globalID' **/
|
||||||
- (id) entityForGlobalID: (EOGlobalID *)globalID
|
- (id) entityForGlobalID: (EOGlobalID *)globalID
|
||||||
{
|
{
|
||||||
//OK
|
|
||||||
NSString *entityName;
|
NSString *entityName;
|
||||||
EOEntity *entity;
|
|
||||||
|
|
||||||
DESTROY(_lastEntity);
|
entityName = [(EOKeyGlobalID *)globalID entityName];
|
||||||
|
|
||||||
entityName = [globalID entityName];
|
if ((_lastEntity) && (entityName == [_lastEntity name]))
|
||||||
entity = [_database entityNamed: entityName];
|
{
|
||||||
|
return _lastEntity;
|
||||||
|
}
|
||||||
|
|
||||||
ASSIGN(_lastEntity, entity);
|
ASSIGN(_lastEntity, [_database entityNamed: entityName]);
|
||||||
|
|
||||||
return entity;
|
return _lastEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Make object a fault **/
|
/** Make object a fault **/
|
||||||
|
@ -1342,11 +1344,13 @@ userInfo = {
|
||||||
NSString * hintKey = nil;
|
NSString * hintKey = nil;
|
||||||
BOOL continueFetch = NO;
|
BOOL continueFetch = NO;
|
||||||
NSUInteger k;
|
NSUInteger k;
|
||||||
|
EOSQLExpression * expression = nil;
|
||||||
|
|
||||||
NSArray * attributesToFetch;
|
NSMutableArray * attributesToFetch;
|
||||||
if (keyCount == 0)
|
if (keyCount == 0)
|
||||||
{
|
{
|
||||||
attributesToFetch = [entity attributesToFetch];
|
// this is an NSMutableArray
|
||||||
|
attributesToFetch = (NSMutableArray *) [entity attributesToFetch];
|
||||||
} else {
|
} else {
|
||||||
// Populate an array with the attributes we need
|
// Populate an array with the attributes we need
|
||||||
attributesToFetch = [NSMutableArray arrayWithCapacity:keyCount];
|
attributesToFetch = [NSMutableArray arrayWithCapacity:keyCount];
|
||||||
|
@ -1404,7 +1408,7 @@ userInfo = {
|
||||||
{
|
{
|
||||||
if ([hintKey isKindOfClass:[NSString class]])
|
if ([hintKey isKindOfClass:[NSString class]])
|
||||||
{
|
{
|
||||||
hintKey = [[[_adaptorContext adaptor] expressionClass] expressionForString:hintKey];
|
expression = [[[_adaptorContext adaptor] expressionClass] expressionForString:hintKey];
|
||||||
} else {
|
} else {
|
||||||
NSLog(@"%s - %@ is not an NSString but a %@",__PRETTY_FUNCTION__, hintKey, NSStringFromClass([hintKey class]));
|
NSLog(@"%s - %@ is not an NSString but a %@",__PRETTY_FUNCTION__, hintKey, NSStringFromClass([hintKey class]));
|
||||||
}
|
}
|
||||||
|
@ -1420,9 +1424,9 @@ userInfo = {
|
||||||
{
|
{
|
||||||
[adaptorChannel openChannel];
|
[adaptorChannel openChannel];
|
||||||
}
|
}
|
||||||
if (hintKey)
|
if (expression)
|
||||||
{
|
{
|
||||||
[adaptorChannel evaluateExpression:hintKey];
|
[adaptorChannel evaluateExpression:expression];
|
||||||
[adaptorChannel setAttributesToFetch:attributesToFetch];
|
[adaptorChannel setAttributesToFetch:attributesToFetch];
|
||||||
} else {
|
} else {
|
||||||
[adaptorChannel selectAttributes:attributesToFetch
|
[adaptorChannel selectAttributes:attributesToFetch
|
||||||
|
@ -2267,7 +2271,7 @@ userInfo = {
|
||||||
|
|
||||||
[_database invalidateResultCache];
|
[_database invalidateResultCache];
|
||||||
|
|
||||||
snapshots = [_database snapshot];
|
snapshots = [_database snapshots];
|
||||||
gids = [snapshots allKeys];
|
gids = [snapshots allKeys];
|
||||||
[self invalidateObjectsWithGlobalIDs: gids];
|
[self invalidateObjectsWithGlobalIDs: gids];
|
||||||
|
|
||||||
|
@ -2308,7 +2312,7 @@ userInfo = {
|
||||||
- (BOOL)ownsGlobalID: (EOGlobalID *)globalID
|
- (BOOL)ownsGlobalID: (EOGlobalID *)globalID
|
||||||
{
|
{
|
||||||
if ([globalID isKindOfClass: [EOKeyGlobalID class]] &&
|
if ([globalID isKindOfClass: [EOKeyGlobalID class]] &&
|
||||||
[_database entityNamed: [globalID entityName]])
|
[_database entityNamed: [(EOKeyGlobalID*) globalID entityName]])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -5648,22 +5652,15 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
//Near OK
|
//Near OK
|
||||||
EOAdaptor *adaptor = [_database adaptor];//OK
|
EOAdaptor *adaptor = [_database adaptor];//OK
|
||||||
EOEntity *entity = [dbOpe entity];//OK
|
EOEntity *entity = [dbOpe entity];//OK
|
||||||
NSDictionary *newRow = nil;
|
NSMutableDictionary *newRow = nil;
|
||||||
NSDictionary *dbSnapshot = nil;
|
NSDictionary *dbSnapshot = nil;
|
||||||
NSEnumerator *attrNameEnum = nil;
|
NSEnumerator *attrNameEnum = nil;
|
||||||
id attrName = nil;
|
id attrName = nil;
|
||||||
IMP enumNO=NULL; // nextObject
|
IMP enumNO=NULL; // nextObject
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
newRow = [dbOpe newRow]; //OK{a3code = Q77; code = Q7; numcode = 007; } //ALLOK
|
newRow = [dbOpe newRow]; //OK{a3code = Q77; code = Q7; numcode = 007; } //ALLOK
|
||||||
|
|
||||||
|
|
||||||
dbSnapshot = [dbOpe dbSnapshot];
|
dbSnapshot = [dbOpe dbSnapshot];
|
||||||
NSDebugMLLog(@"EODatabaseContext", @"dbSnapshot %p=%@",
|
|
||||||
dbSnapshot, dbSnapshot);
|
|
||||||
|
|
||||||
attrNameEnum = [newRow keyEnumerator];
|
attrNameEnum = [newRow keyEnumerator];
|
||||||
enumNO=NULL;
|
enumNO=NULL;
|
||||||
|
@ -5673,22 +5670,25 @@ Raises an exception is the adaptor is unable to perform the operations.
|
||||||
id newRowValue = nil;
|
id newRowValue = nil;
|
||||||
id dbSnapshotValue = nil;
|
id dbSnapshotValue = nil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
newRowValue = [newRow objectForKey:attrName];
|
newRowValue = [newRow objectForKey:attrName];
|
||||||
|
|
||||||
|
|
||||||
dbSnapshotValue = [dbSnapshot objectForKey: attrName];
|
dbSnapshotValue = [dbSnapshot objectForKey: attrName];
|
||||||
NSDebugMLLog(@"EODatabaseContext", @"dbSnapshotValue=%@",
|
|
||||||
dbSnapshotValue);
|
|
||||||
|
|
||||||
if (dbSnapshotValue && ![newRowValue isEqual: dbSnapshotValue])
|
if (dbSnapshotValue && (![newRowValue isEqual: dbSnapshotValue]))
|
||||||
{
|
{
|
||||||
id adaptorValue = [adaptor fetchedValueForValue: newRowValue
|
id adaptorValue = [adaptor fetchedValueForValue: newRowValue
|
||||||
attribute: attribute]; //this call is OK
|
attribute: attribute];
|
||||||
|
|
||||||
|
if ((!adaptorValue) || ((adaptorValue != dbSnapshotValue) && (![adaptorValue isEqual:dbSnapshotValue])))
|
||||||
//TODO-NOW SO WHAT ?? may be replacing newRow diff values by adaptorValue if different ????
|
{
|
||||||
|
if (!adaptorValue)
|
||||||
|
{
|
||||||
|
adaptorValue = GDL2_EONull;
|
||||||
|
}
|
||||||
|
[newRow setObject:adaptorValue
|
||||||
|
forKey:attrName];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,7 @@ RCS_ID("$Id$")
|
||||||
#include <EOControl/EONSAddOns.h>
|
#include <EOControl/EONSAddOns.h>
|
||||||
#include <EOControl/EOCheapArray.h>
|
#include <EOControl/EOCheapArray.h>
|
||||||
#include <EOControl/EODebug.h>
|
#include <EOControl/EODebug.h>
|
||||||
|
#include <EOControl/EOFetchSpecification.h>
|
||||||
|
|
||||||
#include <EOAccess/EOModel.h>
|
#include <EOAccess/EOModel.h>
|
||||||
#include <EOAccess/EOModelGroup.h>
|
#include <EOAccess/EOModelGroup.h>
|
||||||
|
|
|
@ -224,7 +224,13 @@ RCS_ID("$Id$")
|
||||||
{
|
{
|
||||||
if (_externalName != name) {
|
if (_externalName != name) {
|
||||||
[self willChange];
|
[self willChange];
|
||||||
ASSIGNCOPY(_externalName, ([name length] > 0) ? name : nil);
|
|
||||||
|
if ((!name) || ([name length] < 1)) {
|
||||||
|
ASSIGN(_externalName, nil);
|
||||||
|
} else {
|
||||||
|
ASSIGNCOPY(_externalName, name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue