fetchSpecification:(EOFetchSpecification *)_fs;
- (NSArray *)fetchFields:(NSArray *)_flds matchingQualifier:(EOQualifier *)_q;
- (NSArray *)fetchAclMatchingQualifier:(EOQualifier *)_q;
+- (void)deleteAclMatchingQualifier:(EOQualifier *)_q;
+- (void)deleteAclWithSpecification:(EOFetchSpecification *)_fs;
@end
return [self fetchFields:_flds fetchSpecification:fs];
}
-- (NSArray *)fetchAclWithSpecification:(EOFetchSpecification *)_fs
-{
+- (NSArray *)fetchAclWithSpecification:(EOFetchSpecification *)_fs {
EOQualifier *qualifier;
NSArray *sortOrderings;
EOAdaptorChannel *channel;
return [self fetchAclWithSpecification:fs];
}
+- (void) deleteAclMatchingQualifier:(EOQualifier *)_q {
+ EOFetchSpecification *fs;
+
+ if (_q != nil) {
+ fs = [EOFetchSpecification fetchSpecificationWithEntityName:
+ [self folderName]
+ qualifier:_q
+ sortOrderings:nil];
+ [self deleteAclWithSpecification:fs];
+ }
+}
+
+- (void)deleteAclWithSpecification:(EOFetchSpecification *)_fs
+{
+ EOQualifier *qualifier;
+ EOAdaptorChannel *channel;
+ NSException *error;
+ NSMutableString *sql;
+
+ qualifier = [_fs qualifier];
+ if (qualifier != nil) {
+ sql = [NSMutableString stringWithCapacity:256];
+ [sql appendString:@"DELETE FROM "];
+ [sql appendString:[self aclTableName]];
+ [sql appendString:@" WHERE "];
+ [sql appendString:[self generateSQLForQualifier:qualifier]];
+ }
+
+ /* open channel */
+
+ if ((channel = [self acquireAclChannel]) == nil) {
+ [self errorWithFormat:@"could not open acl channel!"];
+ return;
+ }
+
+ /* run SQL */
+
+ if ((error = [channel evaluateExpressionX:sql]) != nil) {
+ [self errorWithFormat:@"%s: cannot execute acl-fetch SQL '%@': %@",
+ __PRETTY_FUNCTION__, sql, error];
+ [self releaseChannel:channel];
+ return;
+ }
+
+ [self releaseChannel:channel];
+}
+
/* description */
- (NSString *)description {