I would like to get the final SQL query, with parameter values bound (replaced) for debugging. It is a rather large and complex query (some joins, and about 20 parameters). Just wondered if it was possible to access the final query passed to the sqlite db.
theSQL = "SELECT a,b,c FROM myTable where aField = ?";
sqlite3_prepare_v2(myDb, theSQL, -1, &compiledStatement, NULL);
sqlite3_bind_text(compiledStatement, 1, myUTF8stringParam, -1, SQLITE_STATIC);
theSQLwithBoundParams = //<<<--- here is missing what I look for ;)
NSLog(@"Perpared Statement with params: %@", theSQLwithBoundParams);
You migth want to take a look at this question. Basically, you can write your own
sqlite3_trace to record the latest query.