From 15a8557fc009b05c02a3ef046edb205751e9da68 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 14 Aug 2009 12:20:44 +0000 Subject: [PATCH] Monotone-Parent: ef8822c21fe4ccf284c065db96f92ffb2750bad1 Monotone-Revision: e000b5c0e80fdd3891b4885ea6b27d82edaf8572 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-08-14T12:20:44 Monotone-Branch: ca.inverse.sogo --- SOPE/GDLContentStore/ChangeLog | 6 ++++ SOPE/GDLContentStore/GCSFolder.m | 49 +++++++++++++++----------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/SOPE/GDLContentStore/ChangeLog b/SOPE/GDLContentStore/ChangeLog index ba46ca2ff..1982b4d91 100644 --- a/SOPE/GDLContentStore/ChangeLog +++ b/SOPE/GDLContentStore/ChangeLog @@ -1,3 +1,9 @@ +2009-08-14 Wolfgang Sourdeau + + * GCSFolder.m (-deleteAclWithSpecification:): enable the deletion + of the complete list if a nil specification is passed as + parameter, previously we would ignore such as call. + 2009-06-03 Wolfgang Sourdeau * GCSFolderManager.m: replaced invocations of NSLog with diff --git a/SOPE/GDLContentStore/GCSFolder.m b/SOPE/GDLContentStore/GCSFolder.m index 55dd40623..7d7f31c90 100644 --- a/SOPE/GDLContentStore/GCSFolder.m +++ b/SOPE/GDLContentStore/GCSFolder.m @@ -1256,39 +1256,36 @@ static NSArray *contentFieldNames = nil; - (void) deleteAclWithSpecification: (EOFetchSpecification *) _fs { - EOQualifier *qualifier; EOAdaptorChannel *channel; NSException *error; NSMutableString *sql; + NSString *qSql; - qualifier = [_fs qualifier]; - if (qualifier) - { - sql = [NSMutableString stringWithCapacity:256]; - [sql appendString:@"DELETE FROM "]; - [sql appendString:[self aclTableName]]; - [sql appendString:@" WHERE "]; - [sql appendString:[self _sqlForQualifier:qualifier]]; + sql = [NSMutableString stringWithCapacity:256]; + [sql appendString:@"DELETE FROM "]; + [sql appendString:[self aclTableName]]; + qSql = [self _sqlForQualifier: [_fs qualifier]]; + if (qSql) + [sql appendFormat:@" WHERE %@", qSql]; - /* open channel */ + /* open channel */ - if ((channel = [self acquireAclChannel]) == nil) { - [self errorWithFormat:@"could not open acl channel!"]; - return; - } + if ((channel = [self acquireAclChannel]) == nil) { + [self errorWithFormat:@"could not open acl channel!"]; + return; + } - /* run SQL */ - [[channel adaptorContext] beginTransaction]; - if ((error = [channel evaluateExpressionX:sql]) != nil) { - [self errorWithFormat:@"%s: cannot execute acl-fetch SQL '%@': %@", - __PRETTY_FUNCTION__, sql, error]; - [self releaseChannel:channel]; - return; - } - - [[channel adaptorContext] commitTransaction]; - [self releaseChannel:channel]; - } + /* run SQL */ + [[channel adaptorContext] beginTransaction]; + if ((error = [channel evaluateExpressionX:sql]) != nil) { + [self errorWithFormat:@"%s: cannot execute acl-fetch SQL '%@': %@", + __PRETTY_FUNCTION__, sql, error]; + [self releaseChannel:channel]; + return; + } + + [[channel adaptorContext] commitTransaction]; + [self releaseChannel:channel]; } - (unsigned int) recordsCountByExcludingDeleted: (BOOL) excludeDeleted