On Wed, Oct 07, 2015 at 09:35:54AM -0400, Richard Hipp wrote: > On 10/7/15, Aki Tuomi <cmouse at cmouse.fi> wrote: > > > > Is there any way to see whether sqlite3_trace has been attached to a > > particular connection? > > > > Perhaps run "sqlite3_exec(db, "SELECT 'trace-test';",0,0,0)" and see > if you get a trace callback? >
Problem is that I can see the trace on some queries, but not on all. I have tried to make sure there is only one, and only one database connection, but I would like to ensure somehow that there isn't anything fishy going on. We use persistent SQL statements on our code, which means they are prepared once during SQL connection lifetime. Can this cause any issues? Basically our quries follow this cycle: bind bind ... execute fetch reset clear bindings I changed the code to set the trace every time before sqlite3_step in execute and got the following result: SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type=:qtype and name=:qname <no trace> SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type=:qtype and name=:qname Oct 07 16:53:20 Query: SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type='SOA' and name='example.com' SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and type=:qtype and name=:qname and domain_id=:domain_id <no trace> SELECT content,ttl,prio,type,domain_id,disabled,name,auth FROM records WHERE disabled=0 and name=:qname and domain_id=:domain_id <no trace> I am now extremely puzzled why my_trace is not being called more than once. By abusing the sqliteInt.h from sources I was able to also ensure that xTrace is set before sqlite3_step is called. Aki