我喜欢在此之后记录编译后的Statement:
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
sqlite3_bind_int( compiledStatement, 1, updateThis.web_id);
[...]
}
NSLog(@"Put out the complete SQLite Statement.");
直接输出失败了,我认为这不是这样做的方法:
NSLog(@"%@",compiledStatement);
答案 0 :(得分:9)
您无法打印compiledStatement。你可以做的是实现sqlite3_trace回调函数。这将打印每个执行的sql语句。
要实现该功能,请在@implementation块
之前添加此功能void sqliteCallbackFunc(void *foo, const char* statement) {
NSLog(@"=> %s", statement);
}
这是你要指的功能。
指向此函数的简单调用:
sqlite3_trace(db, sqliteCallbackFunc, NULL);