added + _joinSemanticForName:

added + _nameForJoinSemantic:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30289 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-05-03 22:41:57 +00:00
parent ff63a21003
commit 9ef3e0ff2a
3 changed files with 72 additions and 44 deletions

View file

@ -2,6 +2,11 @@
* EOAccess/EOAttribute.m: Add comment
* EOControl/EOEditingContext.m: Do not raise on inserting bad objects for now
(Non-EOCustomObject subclasses)
* EOAccess/EORelationship.m
* EOAccess/EOPrivate.h
added + _joinSemanticForName:
added + _nameForJoinSemantic:
include JoinSemantic in description, use new methods in code.
2010-05-02 Matt Rice <ratmice@gmail.com>

View file

@ -31,6 +31,7 @@
#include "../EOControl/EOPrivate.h"
#include "EOSQLQualifier.h"
#include "EORelationship.h"
@class EODatabaseContext;
@ -58,4 +59,13 @@ GDL2ACCESS_EXPORT EOGlobalID* EODatabaseContext_globalIDForObjectWithImpPtr(EODa
@end
@interface EORelationship (PrivateAPI)
+ (EOJoinSemantic) _joinSemanticForName:(NSString*) semanticName;
+ (NSString*) _nameForJoinSemantic:(EOJoinSemantic) semantic;
@end
#endif /* __EOAccess_EOPrivat_h__ */

View file

@ -94,6 +94,51 @@ RCS_ID("$Id$")
owner: owner]);
}
+ (EOJoinSemantic) _joinSemanticForName:(NSString*) semanticName
{
if ([semanticName isEqual: @"EOInnerJoin"])
return EOInnerJoin;
else if ([semanticName isEqual: @"EOFullOuterJoin"])
return EOFullOuterJoin;
else if ([semanticName isEqual: @"EOLeftOuterJoin"])
return EOLeftOuterJoin;
else if ([semanticName isEqual: @"EORightOuterJoin"])
return EORightOuterJoin;
else
{
[NSException raise: NSInvalidArgumentException
format: @"%s: Unknown joinSemantic '%@'", __PRETTY_FUNCTION__, semanticName];
}
// make the compiler happy
return EOInnerJoin;
}
+ (NSString *) _nameForJoinSemantic:(EOJoinSemantic) semantic
{
switch (semantic)
{
case EOInnerJoin:
return @"EOInnerJoin";
case EOFullOuterJoin:
return @"EOFullOuterJoin";
case EOLeftOuterJoin:
return @"EOLeftOuterJoin";
case EORightOuterJoin:
return @"EORightOuterJoin";
}
[NSException raise: NSInvalidArgumentException
format: @"%s: Unknown joinSemantic '%d'", __PRETTY_FUNCTION__, semantic];
// make the compiler happy
return nil;
}
- (id)init
{
//OK
@ -194,27 +239,11 @@ RCS_ID("$Id$")
joinSemanticString = [propertyList objectForKey: @"joinSemantic"];
if (joinSemanticString)
{
if ([joinSemanticString isEqual: @"EOInnerJoin"])
[self setJoinSemantic: EOInnerJoin];
else if ([joinSemanticString isEqual: @"EOFullOuterJoin"])
[self setJoinSemantic: EOFullOuterJoin];
else if ([joinSemanticString isEqual: @"EOLeftOuterJoin"])
[self setJoinSemantic: EOLeftOuterJoin];
else if ([joinSemanticString isEqual: @"EORightOuterJoin"])
[self setJoinSemantic: EORightOuterJoin];
else
{
EOFLOGObjectLevelArgs(@"EORelationship", @"Unknown joinSemanticString=%@. entityName=%@ relationshipName=%@",
joinSemanticString,
[(EOEntity*)owner name],
relationshipName);
NSEmitTODO(); //TODO
[self notImplemented: _cmd]; //TODO
}
}
{
[self setJoinSemantic: [[self class] _joinSemanticForName:joinSemanticString]];
}
else
{
{
if (destinationEntityName)
{
EOFLOGObjectLevelArgs(@"EORelationship", @"!joinSemanticString but destinationEntityName. entityName=%@ relationshipName=%@",
@ -499,6 +528,8 @@ RCS_ID("$Id$")
dscr = [dscr stringByAppendingFormat: @" userInfo=%@",
[self userInfo]];
dscr = [dscr stringByAppendingFormat: @" joinSemantic=%@",
[[self class] _nameForJoinSemantic:_joinSemantic]];
dscr = [dscr stringByAppendingFormat: @" joins=%@",
[self joins]];
dscr = [dscr stringByAppendingFormat: @" sourceAttributes=%@",
@ -663,31 +694,13 @@ to know what to-many mean :-) **/
return _joinSemantic;
}
/*
this seems to be GNUstep only -- dw
*/
- (NSString*)joinSemanticString
{
NSString *joinSemanticString = nil;
switch ([self joinSemantic])
{
case EOInnerJoin:
joinSemanticString = @"EOInnerJoin";
break;
case EOFullOuterJoin:
joinSemanticString = @"EOFullOuterJoin";
break;
case EOLeftOuterJoin:
joinSemanticString = @"EOLeftOuterJoin";
break;
case EORightOuterJoin:
joinSemanticString = @"EORightOuterJoin";
break;
default:
NSAssert1(NO, @"Unknwon join semantic code %d",
(int)[self joinSemantic]);
break;
}
return joinSemanticString;
{
return [[self class] _nameForJoinSemantic:[self joinSemantic]];
}
/**