From: helge Date: Wed, 29 Aug 2007 21:06:19 +0000 (+0000) Subject: fixed for OGo bug #1906 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00123f9f9b5665402bfe0792d96d0bb4aa76698c;p=sope fixed for OGo bug #1906 git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1532 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-gdl1/GDLContentStore/ChangeLog b/sope-gdl1/GDLContentStore/ChangeLog index 4973f64f..bdd4c43b 100644 --- a/sope-gdl1/GDLContentStore/ChangeLog +++ b/sope-gdl1/GDLContentStore/ChangeLog @@ -1,3 +1,8 @@ +2007-08-29 Wolfgang Sourdeau + + * EOQualifier+GCS.m: rewrote comparison code, now uses UPPER instead of + the PostgreSQL specific ILIKE. Fixes OGo bug #1906 (v4.7.49) + 2007-07-20 Helge Hess * GCSFolderManager.m: added 'some' rollback after an error (v4.7.48) diff --git a/sope-gdl1/GDLContentStore/EOQualifier+GCS.m b/sope-gdl1/GDLContentStore/EOQualifier+GCS.m index ec0103cc..88343350 100644 --- a/sope-gdl1/GDLContentStore/EOQualifier+GCS.m +++ b/sope-gdl1/GDLContentStore/EOQualifier+GCS.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004-2005 SKYRIX Software AG + Copyright (C) 2004-2007 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -64,30 +64,34 @@ toString:(NSMutableString *)_ms { id val; - - [_ms appendString:[_q key]]; - + NSString *qKey, *qOperator, *qValue, *qFormat; + BOOL isCI; + + qKey = [_q key]; + if ((val = [_q value])) { SEL op = [_q selector]; - + if ([val isNotNull]) { + isCI = NO; + if (sel_eq(op, EOQualifierOperatorEqual)) - [_ms appendString:@" = "]; + qOperator = @"="; else if (sel_eq(op, EOQualifierOperatorNotEqual)) - [_ms appendString:@" != "]; + qOperator = @"!="; else if (sel_eq(op, EOQualifierOperatorLessThan)) - [_ms appendString:@" < "]; + qOperator = @"<"; else if (sel_eq(op, EOQualifierOperatorGreaterThan)) - [_ms appendString:@" > "]; + qOperator = @">"; else if (sel_eq(op, EOQualifierOperatorLessThanOrEqualTo)) - [_ms appendString:@" <= "]; + qOperator = @"<="; else if (sel_eq(op, EOQualifierOperatorGreaterThanOrEqualTo)) - [_ms appendString:@" >= "]; + qOperator = @">="; else if (sel_eq(op, EOQualifierOperatorLike)) - [_ms appendString:@" LIKE "]; + qOperator = @"LIKE"; else if (sel_eq(op, EOQualifierOperatorCaseInsensitiveLike)) { - // TODO: this is PostgreSQL specific, use UPPER? - [_ms appendString:@" ILIKE "]; + isCI = YES; + qOperator = @"LIKE"; } else { [self errorWithFormat:@"%s: unsupported operation for null: %@", @@ -95,11 +99,9 @@ } if ([val isKindOfClass:[NSNumber class]]) - [_ms appendString:[val stringValue]]; + qValue = [val stringValue]; else if ([val isKindOfClass:[NSString class]]) { - [_ms appendString:@"'"]; - [_ms appendString:val]; - [_ms appendString:@"'"]; + qValue = [NSString stringWithFormat: @"'%@'", val]; } else { [self errorWithFormat:@"%s: unsupported value class: %@", @@ -107,18 +109,31 @@ } } else { - if (sel_eq(op, EOQualifierOperatorEqual)) - [_ms appendString:@" IS NULL"]; - else if (sel_eq(op, EOQualifierOperatorEqual)) - [_ms appendString:@" IS NOT NULL"]; + if (sel_eq(op, EOQualifierOperatorEqual)) { + qOperator = @"IS"; + qValue = @"NULL"; + } + else if (sel_eq(op, EOQualifierOperatorEqual)) { + qOperator = @"IS NOT"; + qValue = @"NULL"; + } else { [self errorWithFormat:@"%s: invalid operation for null: %@", __PRETTY_FUNCTION__, NSStringFromSelector(op)]; } } } + else { + qOperator = @"IS"; + qValue = @"NULL"; + } + + if (isCI) + qFormat = @"UPPER(%@) %@ UPPER(%@)"; else - [_ms appendString:@" IS NULL"]; + qFormat = @"%@ %@ %@"; + + [_ms appendFormat: qFormat, qKey, qOperator, qValue]; } - (void)_appendQualifier:(EOQualifier *)_q toString:(NSMutableString *)_ms { diff --git a/sope-gdl1/GDLContentStore/Version b/sope-gdl1/GDLContentStore/Version index 780e00ac..eb335281 100644 --- a/sope-gdl1/GDLContentStore/Version +++ b/sope-gdl1/GDLContentStore/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=7 -SUBMINOR_VERSION:=48 +SUBMINOR_VERSION:=49 # v4.5.29 requires libNGExtensions v4.5.161 # v4.5.26 does not require libNGiCal anymore