使用sqlite,在更新操作时每次报错“database is locked”

前端之家收集整理的这篇文章主要介绍了使用sqlite,在更新操作时每次报错“database is locked”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
+(XYZAnswers *)myAnswerWithDate:(NSString *)date
{
    NSString *sqlString = [NSString stringWithFormat:@"SELECT * FROM MyAnswers WHERE  dateString = '%@'",date];
    
    sqlite3_stmt *statement = [[XYZsqlConnection sharesqlConnection] sqlPrepare:sqlString];
    XYZAnswers *tempAnswer = [[XYZAnswers alloc] init];

    while (sqlite3_step(statement) == sqlITE_ROW)



在进行

sqlite3_step(statement) 操作后记得sqlite3_finalize(statement); 释放资源

不然数据库出于自我保护,就会报这个错

猜你在找的Sqlite相关文章