mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-16 08:20:59 +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>
|
||||
* configure.ac
|
||||
replaced DBModeler with Apps/EOModeler Apps/EOModelEditor
|
||||
|
|
|
@ -62,7 +62,6 @@ RCS_ID("$Id$")
|
|||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSSet.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/GSMime.h>
|
||||
#else
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
@ -70,12 +69,11 @@ RCS_ID("$Id$")
|
|||
#ifndef GNUSTEP
|
||||
#include <GNUstepBase/GNUstep.h>
|
||||
#include <GNUstepBase/NSDebug+GNUstepBase.h>
|
||||
#include <GNUstepBase/GSMime.h>
|
||||
#endif
|
||||
|
||||
#include <GNUstepBase/GSMime.h>
|
||||
#include <GNUstepBase/Unicode.h>
|
||||
|
||||
|
||||
#include <EOControl/EONSAddOns.h>
|
||||
#include <EOControl/EODebug.h>
|
||||
|
||||
|
|
|
@ -168,6 +168,14 @@ typedef enum {
|
|||
|
||||
- (BOOL)isKeyDefinedByPrototype: (NSString *)key;
|
||||
|
||||
/**
|
||||
* Returns YES if the attribute references aProperty, NO otherwise.
|
||||
*/
|
||||
|
||||
- (BOOL)referencesProperty:(id)aProperty;
|
||||
|
||||
- (void)setParent: (id)parent;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ RCS_ID("$Id$")
|
|||
#include <EOAccess/EOStoredProcedure.h>
|
||||
#include <EOAccess/EORelationship.h>
|
||||
#include <EOAccess/EOExpressionArray.h>
|
||||
#include <EOAccess/EOSQLExpression.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -699,6 +700,30 @@ RCS_ID("$Id$")
|
|||
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
|
||||
|
||||
@implementation EOAttribute (EOAttributeSQLExpression)
|
||||
|
@ -1868,30 +1893,6 @@ More details:
|
|||
|
||||
@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
|
||||
{
|
||||
return _realAttribute;
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
#define __EOAttributePriv_h__
|
||||
|
||||
@interface EOAttribute (EOAttributePrivate)
|
||||
- (NSMutableArray *)_definitionArray;
|
||||
- (EOExpressionArray *)_definitionArray;
|
||||
|
||||
- (void)setParent: (id)parent;
|
||||
- (EOAttribute *)realAttribute;
|
||||
|
||||
- (Class)_valueClass;
|
||||
|
|
|
@ -84,6 +84,7 @@ RCS_ID("$Id$")
|
|||
#include <EOAccess/EOEntity.h>
|
||||
#include <EOAccess/EORelationship.h>
|
||||
#include <EOAccess/EOAttribute.h>
|
||||
#include <EOAccess/EOAttributePriv.h>
|
||||
#include <EOAccess/EOStoredProcedure.h>
|
||||
#include <EOAccess/EOJoin.h>
|
||||
|
||||
|
@ -93,6 +94,7 @@ RCS_ID("$Id$")
|
|||
#include <EOAccess/EODatabaseOperation.h>
|
||||
#include <EOAccess/EOAccessFault.h>
|
||||
#include <EOAccess/EOExpressionArray.h>
|
||||
#include <EOAccess/EOSQLExpression.h>
|
||||
|
||||
#include "EOPrivate.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' **/
|
||||
- (id) entityForGlobalID: (EOGlobalID *)globalID
|
||||
{
|
||||
//OK
|
||||
NSString *entityName;
|
||||
EOEntity *entity;
|
||||
|
||||
DESTROY(_lastEntity);
|
||||
entityName = [(EOKeyGlobalID *)globalID entityName];
|
||||
|
||||
entityName = [globalID entityName];
|
||||
entity = [_database entityNamed: entityName];
|
||||
if ((_lastEntity) && (entityName == [_lastEntity name]))
|
||||
{
|
||||
return _lastEntity;
|
||||
}
|
||||
|
||||
ASSIGN(_lastEntity, [_database entityNamed: entityName]);
|
||||
|
||||
ASSIGN(_lastEntity, entity);
|
||||
|
||||
return entity;
|
||||
return _lastEntity;
|
||||
}
|
||||
|
||||
/** Make object a fault **/
|
||||
|
@ -1340,13 +1342,15 @@ userInfo = {
|
|||
NSUInteger keyCount = [rawRowKeyPaths count];
|
||||
id messageHandler = nil; // used to prompt the user after the fetch limit is reached.
|
||||
NSString * hintKey = nil;
|
||||
BOOL continueFetch = NO;
|
||||
BOOL continueFetch = NO;
|
||||
NSUInteger k;
|
||||
EOSQLExpression * expression = nil;
|
||||
|
||||
NSArray * attributesToFetch;
|
||||
NSMutableArray * attributesToFetch;
|
||||
if (keyCount == 0)
|
||||
{
|
||||
attributesToFetch = [entity attributesToFetch];
|
||||
// this is an NSMutableArray
|
||||
attributesToFetch = (NSMutableArray *) [entity attributesToFetch];
|
||||
} else {
|
||||
// Populate an array with the attributes we need
|
||||
attributesToFetch = [NSMutableArray arrayWithCapacity:keyCount];
|
||||
|
@ -1404,7 +1408,7 @@ userInfo = {
|
|||
{
|
||||
if ([hintKey isKindOfClass:[NSString class]])
|
||||
{
|
||||
hintKey = [[[_adaptorContext adaptor] expressionClass] expressionForString:hintKey];
|
||||
expression = [[[_adaptorContext adaptor] expressionClass] expressionForString:hintKey];
|
||||
} else {
|
||||
NSLog(@"%s - %@ is not an NSString but a %@",__PRETTY_FUNCTION__, hintKey, NSStringFromClass([hintKey class]));
|
||||
}
|
||||
|
@ -1420,9 +1424,9 @@ userInfo = {
|
|||
{
|
||||
[adaptorChannel openChannel];
|
||||
}
|
||||
if (hintKey)
|
||||
if (expression)
|
||||
{
|
||||
[adaptorChannel evaluateExpression:hintKey];
|
||||
[adaptorChannel evaluateExpression:expression];
|
||||
[adaptorChannel setAttributesToFetch:attributesToFetch];
|
||||
} else {
|
||||
[adaptorChannel selectAttributes:attributesToFetch
|
||||
|
@ -2267,7 +2271,7 @@ userInfo = {
|
|||
|
||||
[_database invalidateResultCache];
|
||||
|
||||
snapshots = [_database snapshot];
|
||||
snapshots = [_database snapshots];
|
||||
gids = [snapshots allKeys];
|
||||
[self invalidateObjectsWithGlobalIDs: gids];
|
||||
|
||||
|
@ -2308,7 +2312,7 @@ userInfo = {
|
|||
- (BOOL)ownsGlobalID: (EOGlobalID *)globalID
|
||||
{
|
||||
if ([globalID isKindOfClass: [EOKeyGlobalID class]] &&
|
||||
[_database entityNamed: [globalID entityName]])
|
||||
[_database entityNamed: [(EOKeyGlobalID*) globalID entityName]])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
|
@ -5648,51 +5652,47 @@ Raises an exception is the adaptor is unable to perform the operations.
|
|||
//Near OK
|
||||
EOAdaptor *adaptor = [_database adaptor];//OK
|
||||
EOEntity *entity = [dbOpe entity];//OK
|
||||
NSDictionary *newRow = nil;
|
||||
NSMutableDictionary *newRow = nil;
|
||||
NSDictionary *dbSnapshot = nil;
|
||||
NSEnumerator *attrNameEnum = nil;
|
||||
id attrName = nil;
|
||||
IMP enumNO=NULL; // nextObject
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
newRow = [dbOpe newRow]; //OK{a3code = Q77; code = Q7; numcode = 007; } //ALLOK
|
||||
|
||||
|
||||
|
||||
dbSnapshot = [dbOpe dbSnapshot];
|
||||
NSDebugMLLog(@"EODatabaseContext", @"dbSnapshot %p=%@",
|
||||
dbSnapshot, dbSnapshot);
|
||||
|
||||
|
||||
attrNameEnum = [newRow keyEnumerator];
|
||||
enumNO=NULL;
|
||||
while ((attrName = GDL2_NextObjectWithImpPtr(attrNameEnum,&enumNO)))
|
||||
{
|
||||
EOAttribute *attribute = [entity attributeNamed: attrName];
|
||||
id newRowValue = nil;
|
||||
id dbSnapshotValue = nil;
|
||||
|
||||
newRowValue = [newRow objectForKey:attrName];
|
||||
|
||||
|
||||
dbSnapshotValue = [dbSnapshot objectForKey: attrName];
|
||||
|
||||
if (dbSnapshotValue && (![newRowValue isEqual: dbSnapshotValue]))
|
||||
{
|
||||
EOAttribute *attribute = [entity attributeNamed: attrName];
|
||||
id newRowValue = nil;
|
||||
id dbSnapshotValue = nil;
|
||||
|
||||
|
||||
|
||||
newRowValue = [newRow objectForKey:attrName];
|
||||
|
||||
|
||||
dbSnapshotValue = [dbSnapshot objectForKey: attrName];
|
||||
NSDebugMLLog(@"EODatabaseContext", @"dbSnapshotValue=%@",
|
||||
dbSnapshotValue);
|
||||
|
||||
if (dbSnapshotValue && ![newRowValue isEqual: dbSnapshotValue])
|
||||
id adaptorValue = [adaptor fetchedValueForValue: newRowValue
|
||||
attribute: attribute];
|
||||
|
||||
if ((!adaptorValue) || ((adaptorValue != dbSnapshotValue) && (![adaptorValue isEqual:dbSnapshotValue])))
|
||||
{
|
||||
if (!adaptorValue)
|
||||
{
|
||||
id adaptorValue = [adaptor fetchedValueForValue: newRowValue
|
||||
attribute: attribute]; //this call is OK
|
||||
|
||||
|
||||
//TODO-NOW SO WHAT ?? may be replacing newRow diff values by adaptorValue if different ????
|
||||
adaptorValue = GDL2_EONull;
|
||||
}
|
||||
[newRow setObject:adaptorValue
|
||||
forKey:attrName];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ RCS_ID("$Id$")
|
|||
#include <EOControl/EONSAddOns.h>
|
||||
#include <EOControl/EOCheapArray.h>
|
||||
#include <EOControl/EODebug.h>
|
||||
#include <EOControl/EOFetchSpecification.h>
|
||||
|
||||
#include <EOAccess/EOModel.h>
|
||||
#include <EOAccess/EOModelGroup.h>
|
||||
|
|
|
@ -224,7 +224,13 @@ RCS_ID("$Id$")
|
|||
{
|
||||
if (_externalName != name) {
|
||||
[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