Search code examples
objective-csqlitefmdb

print prepared statements with fmdb


Is there any way to print the prepared statements, or at least implement the sqlite3_trace function when using fmdb? trying to access the statement from the FMResultset didn't work.


Solution

  • A sqlite3_trace function

    void myTraceFunc(void *uData, const char *statement)
    {
        NSLog(@"%s", statement);
    }
    

    can be implemented with

    FMDatabase *db = ...;
    [db open];
    sqlite3_trace([db sqliteHandle], myTraceFunc, NULL);