views:

738

answers:

2

Hi,

I'm doing an iPhone application, and I'm using SQLite.

The problem is that I had some issues with the query (I did bad binding) so, this is my question:

How can I log in my iPhone application the effective SQL query/statement with the bindings that SQLite receives?

Thanks.

A: 

I don't think this is possible.

As far as I know, prepared statements aren't built into "full SQL" strings before they get to the database engine. The parameter values aren't escaped, quoted, and inserted into the SQL string only to be parsed and decoded in the next step: the values bypass the query parsing entirely and go straight into the data engine.

Marco
+1  A: 

Easiest way would be to create a wrapper to your call to sql functions and add log functionality to it.

I'm not sure the file written by the PRAGMA journal_mode is readable, but I couldnt use this pragma.

You can also have a look at an excellent existing wrapper from Gus Mueller: fmdb

Stephan Burlot