On 19 Oct 2018, at 3:43pm, Tim Streater <[email protected]> wrote:
> is it OK to generate the myid and goodtext parts using the usual string
> methods from my host language, leaving only badtext as a bound variable, so
> that my prepared statement looks like this:
>
> select somecol from mytable where myid=3 and badtext=? and
> goodtext="somegoodtext"
That will work fine. Just a note that your string quoting characters are wrong
(this may have been done by your email client). They should both be
apostrophes:
select somecol from mytable
where myid=3 and badtext=? and goodtext='somegoodtext'
Presumably you will
CREATE INDEX t_tgb ON mytable (myid,goodtext,badtext)
> My other question relates to when the database is actually touched. Is it the
> case that statement preparation and variable binding do not affect the
> database itself and it's only when the prepared statement is actually
> executed that the database is touched and might generate an SQLITE_BUSY
> response?
The database needs to be read, but not written, during _prepare_v2(). It won't
be written until _step(). Depending on your journal mode, it's possible that
_prepare() will be blocked because another connection is making a change.
However, proper use of _timeout() will mean you will not care about either of
the above.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users