// @try {
//
// if(sqlite3_exec(iDateContainer.iSql, "BEGIN;", NULL, NULL, &dataErr) == SQLITE_OK)
// {
// NSLog(@"事务启动成功");
// sqlite3_free(dataErr);
// [cur_sm_group_inf Create_Sm_Group_Inf];
// [cur_sm_member_inf Create_Sm_Member_Inf];
// [cur_sm_item_inf Create_Sm_Item_Inf];
//
// sqlite3_exec(iDateContainer.iSql, "delete from sm_member_inf", 0, 0, &dataErr);
// sqlite3_exec(iDateContainer.iSql, "delete from sm_item_inf", 0, 0, &dataErr);
// sqlite3_exec(iDateContainer.iSql, "delete from sm_group_inf", 0, 0, &dataErr);
//
//
// [parser setDelegate:self];
// [parser setShouldProcessNamespaces:NO];
// [parser setShouldReportNamespacePrefixes:NO];
// [parser setShouldResolveExternalEntities:NO];
//
// [parser parse];
//
// if(sqlite3_exec(iDateContainer.iSql, "COMMIT", NULL, NULL, &dataErr) == SQLITE_OK)
// {
// NSLog(@"事务提交成功");
//
// }
// sqlite3_free(dataErr);
// }else{
// sqlite3_free(dataErr);
// NSLog(@"事务启动失败");
// }
//
//
// }
// @catch (NSException *exception) {
// NSLog(@"事务抛出异常 回滚");
// if (sqlite3_exec(iDateContainer.iSql, "ROLLBACK", NULL, NULL, &dataErr)== SQLITE_OK) {
// NSLog(@"回滚事务成功");
// }
// sqlite3_free(dataErr);
// NSLog(@"failed to sqlite%@",[exception description]);
// }
// @finally {
// NSLog(@"try 处理结束 ");
// }
iOS 中sqlite 事务提交代码
最新推荐文章于 2024-05-04 01:43:00 发布