Monotone-Parent: fd50c862e356e0c0c102bf3b5901ec2e9de8241e
Monotone-Revision: 480d39a8c4def3358ca87a844e455c2ffe987f5f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-02T16:22:28 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
df68da38fa
commit
f7ce31f7cb
|
@ -1,3 +1,8 @@
|
|||
2009-06-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* GCSFolder.m ([GCSFolder -recordsCountByExcludingDeleted:]): new
|
||||
method that returns the amount of records in a GCS folder.
|
||||
|
||||
2009-03-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* GCSFolderType.m ([GCSFolderType +folderTypeWithName:_typeName]):
|
||||
|
|
|
@ -140,6 +140,8 @@
|
|||
- (void) deleteAclMatchingQualifier: (EOQualifier *) _q;
|
||||
- (void) deleteAclWithSpecification: (EOFetchSpecification *) _fs;
|
||||
|
||||
- (unsigned int) recordsCountByExcludingDeleted: (BOOL) includeDeleted;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* __GDLContentStore_GCSFolder_H__ */
|
||||
|
|
|
@ -1291,6 +1291,43 @@ static NSArray *contentFieldNames = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (unsigned int) recordsCountByExcludingDeleted: (BOOL) excludeDeleted
|
||||
{
|
||||
NSMutableString *sqlString;
|
||||
EOAdaptorChannel *channel;
|
||||
NSException *error;
|
||||
NSDictionary *row;
|
||||
unsigned int count;
|
||||
NSArray *attrs;
|
||||
|
||||
count = 0;
|
||||
|
||||
sqlString = [NSMutableString stringWithFormat:
|
||||
@"SELECT COUNT(*) AS CNT FROM %@",
|
||||
[self storeTableName]];
|
||||
if (excludeDeleted)
|
||||
[sqlString appendString: @" WHERE (c_deleted != 1 OR c_deleted IS NULL)"];
|
||||
|
||||
channel = [self acquireStoreChannel];
|
||||
if (channel)
|
||||
{
|
||||
error = [channel evaluateExpressionX: sqlString];
|
||||
if (error)
|
||||
[self errorWithFormat: @"%s: cannot execute SQL '%@': %@",
|
||||
__PRETTY_FUNCTION__, sqlString, error];
|
||||
else
|
||||
{
|
||||
attrs = [channel describeResults: NO];
|
||||
row = [channel fetchAttributes: attrs withZone: NULL];
|
||||
count = [[row objectForKey: @"cnt"] unsignedIntValue];
|
||||
[channel cancelFetch];
|
||||
}
|
||||
[self releaseChannel: channel];
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/* description */
|
||||
|
||||
- (NSString *)description {
|
||||
|
|
Loading…
Reference in New Issue