On Fri, Sep 26, 2014 at 6:44 PM, Hody Crouch <hody.cro...@gmail.com> wrote:

> Test code is provided below.  If you change the sql query to include 'val2
> = ?' rather than 'val2 LIKE ?', you will see trace output.
>

It works fine when I try it:

drh@bella:~/sqlite/bld$ gcc -g -I. x1.c sqlite3.o -ldl -lpthread
drh@bella:~/sqlite/bld$ ./a.out
TRACE: SELECT val1, val2 from t where val2 LIKE 'A%'
drh@bella:~/sqlite/bld$



>
> #include <stdio.h>
> #include <stdlib.h>
> #include "sqlite3.h"
>
> static void trace_callback( void* udp, const char* sql ) {
>   printf("TRACE: %s\n", sql);
> };
>
> int main(int argc, char* argv[])
> {
>   sqlite3 *db;
>   char *sql;
>
>   sqlite3_open("test.db", &db);
>
>   // Enable tracing
>   sqlite3_trace(db, trace_callback, 0);
>
>   sql = "SELECT val1, val2 from t where val2 LIKE ?";
>
>   sqlite3_stmt* statement = NULL;
>   sqlite3_prepare_v2(db, sql, -1, &statement, NULL);
>   sqlite3_bind_text(statement, 1, "A%", -1, NULL);
>   sqlite3_step(statement);
>   sqlite3_close(db);
>   return 0;
> }
>
> On Fri, Sep 26, 2014 at 6:20 PM, Richard Hipp <d...@sqlite.org> wrote:
>
> > On Thu, Sep 25, 2014 at 5:58 PM, Hody Crouch <hody.cro...@gmail.com>
> > wrote:
> >
> > > While using sqlite3 with node, I used trace and found that a specific
> > query
> > > did not result in a callback invocation.  I have only seen this
> behavior
> > if
> > > all of the following conditions are met:
> > > - sql query includes 'LIKE ?'
> > > - prepare the query
> > > - bind a parameter
> > > - execute the query
> > >
> >
> > I am unable to reproduce the problem.  Please send more hints.  Perhaps
> > send source code.
> >
> >
> > >
> > > If I change the query to use '=' instead of 'LIKE', the trace callback
> is
> > > invoked as expected.
> > >
> > > I looked at http://www.sqlite.org/src/info/11d5aa455e0d98f3c1e6a08 in
> > > hopes
> > > that this issue might be resolved.  Using
> > sqlite-amalgamation-201409200035
> > > and a test app in c, the issue is still reproducible.
> > >
> > > Test table schema: CREATE TABLE t (val1 TEXT, val2 TEXT);
> > >
> > > Query to reproduce the issue:
> > > SELECT val1, val2 from t where val2 LIKE ?
> > >
> > > The description of the ticket I mentioned seems similar, but I don't
> know
> > > enough about the sqlite3 inner workings to offer much more than the
> above
> > > report.  Let me know if you need to see the test app as well.
> > >
> > > Thanks.
> > > _______________________________________________
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >
> >
> >
> >
> > --
> > D. Richard Hipp
> > d...@sqlite.org
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
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