- (BOOL)executeCacheFlagUpdateQuery
{
BOOL update = NO;
@try {
char *errorMsg;
NSString *sqldelete = [[NSString alloc] initWithFormat:@"UPDATE cache_flags SET slides = %d, speaker_lists = %d
WHERE (slides < %d) OR (speaker_lists < %@) AND id = %d",
[[cacheFlagDic valueForKey:@"SLIDES"] intValue],[[cacheFlagDic valueForKey:@"SPEAKER_LISTS"] intValue],
[[cacheFlagDic valueForKey:@"SLIDES"] intValue],[[cacheFlagDic valueForKey:@"SPEAKER_LISTS"] ],1];
int result = sqlite3_exec([mcDB getOpenedDatabase],
[sqldelete UTF8String], NULL, NULL, &errorMsg);
[sqldelete
release];
if (result == SQLITE_OK) {
update = YES;
}else {
NSLog(@"--executeCacheUpdateQuery: remove failed");
}
}
@catch (NSException * e) {
NSLog(@"-executeCacheUpdateQuery: Caught %@: %@", [e name], [e reason]);
}
@finally {
if ([mcDB isDatabaseOpened]) {
[mcDB closeDatabase];
}
}
return update;
}