On Mon, Feb 3, 2014 at 12:30 PM, Stephan Beal <sgb...@googlemail.com> wrote:

> Hi, all,
>
> i have a library which makes very heavy use of sqlite3 and sqlite3_trace().
> All is running fine and well, but recently, for one particular query, i
> started noticing that it gets traced twice: once with its bound values
> expanded and once in its raw form (without bound values), but the second
> form gets traced with a '-- ' comment prefix which is nowhere to be found
> in my code. For example, this is a single step over one query:
>
> SQL TRACE #765: SELECT (max(event.mtime)-2440587.5)*86400 FROM mlink, event
> WHERE mlink.mid=event.objid   AND mlink.fid=3202   AND +mlink.mid IN ok;
> SQL TRACE #767: -- SELECT (max(event.mtime)-2440587.5)*86400 FROM mlink,
> event WHERE mlink.mid=event.objid   AND mlink.fid=?   AND +mlink.mid IN ok;
>

SQLite sends trace output each time a statement first beings executing.  In
your case, the statement started executing once and generated the first
line of output.  But then it noticed that the schema had changed, so it
abandoned that execution, reprepared the statement with the new schema,
then started the statement a second time.  On the second start, the "--"
prefix was added.  The "--" prefix makes the second start a comment so that
you can reply your trace log through the sqlite3 command-line shell and get
the same sequence of SQL statements run.


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to