我想知道是否有人能帮助我理解这段代码有什么问题。我从来没有通过过sqlite3_prepare_v2语句,调试器说:
“nsInternalConsistenceyException”,原因:“创建Add语句时出错。”“内存不足”
static sqlite3 *database = nil;
sqlite3_stmt *addStmt = nil;
if(addStmt == nil) {
NSLog(@"About to add start time...\n");
const char *sql = "INSERT INTO games_played(start) VALUES(?)";
if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database));
NSLog(@"add statement created successfully!\n");
}
NSLog(@"About to bind start time...\n");
sqlite3_bind_text(addStmt, 1, @"start time", -1, SQLITE_TRANSIENT);
最佳答案
我从来没有打开过数据库…我想这就是问题所在。