From 1f91cdf82be908af042b6ebc961a51f9f8569e9f Mon Sep 17 00:00:00 2001 From: helge Date: Sat, 9 Jun 2007 20:31:37 +0000 Subject: [PATCH] added a fix for gstep-base git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1497 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-gdl1/PostgreSQL/ChangeLog | 5 +++ sope-gdl1/PostgreSQL/GNUmakefile | 3 +- sope-gdl1/PostgreSQL/NSNumber+ExprValue.m | 49 +++++++++++++++++++++++ sope-gdl1/PostgreSQL/NSNumber+PGVal.m | 2 +- sope-gdl1/PostgreSQL/Version | 2 +- 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 sope-gdl1/PostgreSQL/NSNumber+ExprValue.m diff --git a/sope-gdl1/PostgreSQL/ChangeLog b/sope-gdl1/PostgreSQL/ChangeLog index 70af34a8..85d8c7bf 100644 --- a/sope-gdl1/PostgreSQL/ChangeLog +++ b/sope-gdl1/PostgreSQL/ChangeLog @@ -1,3 +1,8 @@ +2007-06-09 Helge Hess + + * added NSNumber+ExprValue.m which returns 0/1 for bool values on + GNUstep-Base (v4.7.50) + 2007-03-22 Helge Hess * EOAttribute+PostgreSQL72.m: removed sql3types.h from inclusion (which diff --git a/sope-gdl1/PostgreSQL/GNUmakefile b/sope-gdl1/PostgreSQL/GNUmakefile index 6a427dee..8608a925 100644 --- a/sope-gdl1/PostgreSQL/GNUmakefile +++ b/sope-gdl1/PostgreSQL/GNUmakefile @@ -1,7 +1,7 @@ # # GNUmakefile # -# Copyright (C) 2004-2006 SKYRIX Software AG +# Copyright (C) 2004-2007 SKYRIX Software AG # # Author: Helge Hess (helge.hess@skyrix.com) # @@ -48,6 +48,7 @@ PostgreSQL_OBJC_FILES = \ NSNumber+PGVal.m \ EOKeyGlobalID+PGVal.m \ NSNull+PGVal.m \ + NSNumber+ExprValue.m \ PostgreSQL72DataTypeMappingException.m PostgreSQL_PRINCIPAL_CLASS = PostgreSQL72Adaptor diff --git a/sope-gdl1/PostgreSQL/NSNumber+ExprValue.m b/sope-gdl1/PostgreSQL/NSNumber+ExprValue.m new file mode 100644 index 00000000..b2f9d463 --- /dev/null +++ b/sope-gdl1/PostgreSQL/NSNumber+ExprValue.m @@ -0,0 +1,49 @@ +/* + NSNumber+ExprValue.m + + Copyright (C) 2007 Helge Hess + + Author: Helge Hess (helge@opengroupware.org) + + This file is part of the PostgreSQL Adaptor Library + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#if GNUSTEP_BASE_LIBRARY + +#include "common.h" + +@implementation NSNumber(ExprValue) + +- (NSString *)expressionValueForContext:(id)_context { + /* + on gstep-base -stringValue of bool's return YES or NO, which seems to + be different on Cocoa and liBFoundation. + */ + Class BoolClass = Nil; + + if (BoolClass == Nil) BoolClass = NSClassFromString(@"NSBoolNumber"); + + if ([self isKindOfClass:BoolClass]) + return [self boolValue] ? @"1" : @"0"; + + return [self stringValue]; +} + +@end /* NSNumber(ExprValue) */ + +#endif /* GNUSTEP_BASE_LIBRARY */ diff --git a/sope-gdl1/PostgreSQL/NSNumber+PGVal.m b/sope-gdl1/PostgreSQL/NSNumber+PGVal.m index b3fd3f1c..36baed50 100644 --- a/sope-gdl1/PostgreSQL/NSNumber+PGVal.m +++ b/sope-gdl1/PostgreSQL/NSNumber+PGVal.m @@ -126,7 +126,7 @@ static NSNumber *noNum = nil; if (len < 4) { /* apparently this is 'INT'? */ if (debugOn) NSLog(@" type len < 4 (%@), return string", _type); #if GNUSTEP_BASE_LIBRARY - /* + /* on gstep-base -stringValue of bool's return YES or NO, which seems to be different on Cocoa and liBFoundation. */ diff --git a/sope-gdl1/PostgreSQL/Version b/sope-gdl1/PostgreSQL/Version index 1d3fc25a..430b6e6f 100644 --- a/sope-gdl1/PostgreSQL/Version +++ b/sope-gdl1/PostgreSQL/Version @@ -1,5 +1,5 @@ # version file -SUBMINOR_VERSION:=49 +SUBMINOR_VERSION:=50 # v4.5.41 requires libGDLAccess v4.5.50 -- 2.39.5