Closed zhoupIT closed 8 years ago
LKDBHelper* globalHelper = [IDSginUserTest getUsingLKDBHelper]; [globalHelper executeDB:^(FMDatabase db) { [db beginTransaction]; IDSginUserTest signuser = [[IDSginUserTest alloc] init]; for (NSDictionary *dict in responseObject) { signuser = [IDSginUserTest personWithDict:dict]; [globalHelper insertToDB:signuser]; }
BOOL insertSucceed = [globalHelper insertWhenNotExists:signuser]; //insert fail if(insertSucceed == NO) [db rollback]; else [db commit]; }];
这样一直连表都没有生成,我直接插入,速度就太慢了.请问一下,这是为什么啊,我模仿的demo的
可能在事务状态下 没法创建表, 你可以先保存一条数据后,再进行事务操作
怎么先保存一条数据? 我这样做了,可还是不行
哦 你没有执行 结束事务吧 要commit 下
LKDBHelper* globalHelper = [IDSginUserTest getUsingLKDBHelper]; [globalHelper executeDB:^(FMDatabase db) { [db beginTransaction]; IDSginUserTest signuser = [[IDSginUserTest alloc] init]; for (NSDictionary *dict in responseObject) { signuser = [IDSginUserTest personWithDict:dict]; [globalHelper insertToDB:signuser]; }
这样一直连表都没有生成,我直接插入,速度就太慢了.请问一下,这是为什么啊,我模仿的demo的