SQLite Forum

Bug ? Same query that works in shell produces constraint violation when run by a C program with sqlite3_{prepare,bind,step}
> Those are exactly the same values I use in the shell version of the query, which works .

(Not the problem you report but:) Your bind_text call appears to include the "+00:00" part.

I notice in your original post:

> ... so I do (in shell), eg: INSERT INTO $my_table, (timestamp, ...

If that $my_table is in your SQL, it may be confounding the parameter index value. Schema elements cannot be parameterized; only values can.

> Is there no way to get the VSIX winsqlite3.dll code to print out more information about the query it has prepared ?

I don't think so. However, you can use a CLI shell compiled with the same options, (other than those designating a VSIX build, of course), to see what the query plan is for any given SQL.

> Why don't '.echo on' or '.explain on' seem to work when run with sqlite3_exec ?

Those are CLI shell features rather than SQLite library features.

> Is there any other way of getting the libraries to print more info ?

There are, but you would have to rebuild. Then you would get **a lot** of information. I think it is premature to bring in such heavy artillery for this issue.

> It would be nice if the VSIX package supplied debugging versions of the libraries & their *.pdb files . I am now trying to build them from source with debugging enabled.

I doubt this is a bug. Have you tried the exact same SQL in the shell after using .param to set symbolic parameter values? My bet is that will work, and focus can then concentrate on how your binding differs.