if (editingStyle == UITableViewCellEditingStyleDelete) {
PackageClass * packageToDelete = [packages objectAtIndex: indexPath.row];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
[[databaseManager sharedDatabaseManager] deletePackageWithID: packageToDelete.ID];
dispatch_async(dispatch_get_main_queue(), ^{
packageToDelete.installed = NO;
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
});
});
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationAutomatic];
NSLog(@"Main queue proceeds");
}
DatabaseManager:
- (void)deletePackageWithID:(int)ID {
[self.databaseQueue inTransaction:^(FMDatabase *db, BOOL *rollback) {
[db executeUpdateWithFormat:@"DELETE FROM packageRows WHERE id = %d", ID];
}];
}
Thank you in advance for your help!
Arie
Hello Arie,
Could you try aggregating the id's in which you wish to delete and executing a single query within a transaction like this:
DELETE FROM packageRows WHERE id IN (?, ?, ?, ?...);
This would allow you to execute all delete's from a single SQL statement.
(void)deletePackageWithID:(int)ID {
[self.databaseQueue inTransaction:^(FMDatabase *db, BOOL *rollback) {
[db executeUpdateWithFormat:@"DELETE FROM packageRows WHERE
id = %d", ID];
}];
}
Thank you in advance for your help!
Arie
--
You received this message because you are subscribed to the Google Groups "SQLCipher Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlcipher+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nick Parker
--
---