mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-07 04:47:14 +00:00
Monotone-Parent: fd50c862e356e0c0c102bf3b5901ec2e9de8241e
Monotone-Revision: 480d39a8c4def3358ca87a844e455c2ffe987f5f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-06-02T16:22:28 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
df68da38fa
commit
f7ce31f7cb
3 files changed
+44
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user