more bugfixes and support for TCSDB

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@14470 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2002-09-16 23:58:26 +00:00
parent c7019ce5f3
commit 9dee3aa072

View file

@ -34,6 +34,9 @@ static char rcsId[] = "$Id$";
#if !defined(__NetBSD__) #if !defined(__NetBSD__)
#include <values.h> #include <values.h>
#endif #endif
#ifdef TCSDB
#include <TCSimpleDB/TCSimpleDB.h>
#endif
static NSDictionary* localMinMaxDictionary=nil; static NSDictionary* localMinMaxDictionary=nil;
static NSMutableDictionary* associationsHandlerClasses=nil; static NSMutableDictionary* associationsHandlerClasses=nil;
@ -605,10 +608,14 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
forKeyPath:(NSString*)keyPath forKeyPath:(NSString*)keyPath
{ {
id retValue=nil; id retValue=nil;
#ifdef GDL2 #ifdef GDL2
id EONullNull=[EONull null]; id EONullNull=[EONull null];
#else
#ifdef TCSDB
id EONullNull=[DBNull null];
#else #else
id EONullNull=[NSNull null]; id EONullNull=[NSNull null];
#endif
#endif #endif
LOGClassFnStart(); LOGClassFnStart();
NSDebugMLLog(@"associations",@"GSWAssociation: keyPath=%@ object=%p (class: %@)", NSDebugMLLog(@"associations",@"GSWAssociation: keyPath=%@ object=%p (class: %@)",
@ -636,6 +643,31 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
if (retValue==EONullNull) if (retValue==EONullNull)
retValue=nil; retValue=nil;
#else #else
#ifdef TCSDB
// the same as on GDL2
NS_DURING
{
// NSLog(@"GSWAssociation valueInObject:%@ forKeyPath:%@", object, keyPath);
retValue=[object valueForKeyPath:keyPath];
}
NS_HANDLER
{
NSLog(@"Attempt to get %@ -%@ raised an exception (%@)",
[object class],
keyPath,
localException);
localException = [localException exceptionByAddingToUserInfoKey:@"Invalid Ivars/Methods"
format:@"-[%@ %@]",
[object class],
keyPath];
[localException raise];
}
NS_ENDHANDLER;
if (retValue==EONullNull)
retValue=nil;
#else // NO TCSDB and NO GDL2
NSMutableArray* keys=[[keyPath componentsSeparatedByString:@"."] mutableCopy]; NSMutableArray* keys=[[keyPath componentsSeparatedByString:@"."] mutableCopy];
id part=nil; id part=nil;
Class handlerClass=Nil; Class handlerClass=Nil;
@ -735,6 +767,7 @@ static NSMutableArray* associationsLogsHandlerClasses=nil;
if (retValue==EONullNull) if (retValue==EONullNull)
retValue=nil; retValue=nil;
}; };
#endif
#endif #endif
}; };
if (retValue) if (retValue)