From: helge Date: Thu, 31 Aug 2006 00:31:14 +0000 (+0000) Subject: support OR and icase-like qualifiers X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a903c978aa0123c0b3e4db5335eae68ec7c7b93;p=sope support OR and icase-like qualifiers git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1354 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-gdl1/GDLContentStore/ChangeLog b/sope-gdl1/GDLContentStore/ChangeLog index 29bf3ed5..b7826499 100644 --- a/sope-gdl1/GDLContentStore/ChangeLog +++ b/sope-gdl1/GDLContentStore/ChangeLog @@ -1,3 +1,8 @@ +2006-08-31 Wolfgang Sourdeau + + * EOQualifier+GCS.m: added support for OR qualifiers and for case + insensitive-like qualifiers on PostgreSQL (v4.5.37) + 2006-07-04 Helge Hess * use %p for pointer formats, fixed gcc 4.1 warnings (v4.5.36) diff --git a/sope-gdl1/GDLContentStore/EOQualifier+GCS.m b/sope-gdl1/GDLContentStore/EOQualifier+GCS.m index 5a5fd7d2..e7e62248 100644 --- a/sope-gdl1/GDLContentStore/EOQualifier+GCS.m +++ b/sope-gdl1/GDLContentStore/EOQualifier+GCS.m @@ -42,6 +42,24 @@ if (count > 1) [_ms appendString:@")"]; } } +- (void)_appendOrQualifier:(EOAndQualifier *)_q + toString:(NSMutableString *)_ms +{ + // TODO: move to EOQualifier category + NSArray *qs; + unsigned i, count; + + qs = [_q qualifiers]; + if ((count = [qs count]) == 0) + return; + + for (i = 0; i < count; i++) { + if (i != 0) [_ms appendString:@" OR "]; + if (count > 1) [_ms appendString:@"("]; + [[qs objectAtIndex:i] _gcsAppendToString:_ms]; + if (count > 1) [_ms appendString:@")"]; + } +} - (void)_appendKeyValueQualifier:(EOKeyValueQualifier *)_q toString:(NSMutableString *)_ms { @@ -67,6 +85,10 @@ [_ms appendString:@" >= "]; else if (sel_eq(op, EOQualifierOperatorLike)) [_ms appendString:@" LIKE "]; + else if (sel_eq(op, EOQualifierOperatorCaseInsensitiveLike)) { + // TODO: this is PostgreSQL specific, use UPPER? + [_ms appendString:@" ILIKE "]; + } else { [self logWithFormat:@"ERROR(%s): unsupported operation for null: %@", __PRETTY_FUNCTION__, NSStringFromSelector(op)]; @@ -104,6 +126,8 @@ if ([_q isKindOfClass:[EOAndQualifier class]]) [self _appendAndQualifier:(id)_q toString:_ms]; + else if ([_q isKindOfClass:[EOOrQualifier class]]) + [self _appendOrQualifier:(id)_q toString:_ms]; else if ([_q isKindOfClass:[EOKeyValueQualifier class]]) [self _appendKeyValueQualifier:(id)_q toString:_ms]; else diff --git a/sope-gdl1/GDLContentStore/Version b/sope-gdl1/GDLContentStore/Version index f9f8f165..cc3cbaec 100644 --- a/sope-gdl1/GDLContentStore/Version +++ b/sope-gdl1/GDLContentStore/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=36 +SUBMINOR_VERSION:=37 # v4.5.29 requires libNGExtensions v4.5.161 # v4.5.26 does not require libNGiCal anymore