我正在使用 sqlite 并在数据库中插入值,但我得到 Database is locked 错误这是我的代码
-(void)addmoreDATADetails
{
if(addStmt == nil)
{
const char *sql = "insert into moreBankroll(MoreName) Values(?)";
if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database));
}
sqlite3_bind_text(addStmt, 1, [moreName UTF8String], -1, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(addStmt))
{
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
}
else
{
moreId=sqlite3_last_insert_rowid(database);
}
sqlite3_reset(addStmt);
}
如果我要添加
XYZAppDelegate *appDelegate = (XYZAppDelegate *)[UIApplication sharedApplication].delegate;
dbPath =[appDelegate getDBPath];
if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK)
这个在上面的函数中是说没有这样的表moreBankroll
此代码在另一个项目中运行良好,但在我的项目中运行良好,请帮助