-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fin Springs wrote:
> Under what circumstances could one expect to get SQLITE_SCHEMA back  
> from sqlite3_exec()?

When using the sqlite3_prepare_v2 api, SQLite attempts to reprepare
statements five times when the schema changes(*).  In theory another
connection repeatedly changing the schema could cause all 5 tries to
fail.  The main cause of them failing is if the statement becomes
invalid.  One example would be if it uses a collation that was unregistered.

sqlite3_exec uses the old deprecated v1 of sqlite3_prepare and only
makes one retry attempt.  I have no idea why it doesn't just use v2 of
the function.

(*) A schema change is far more than actually changing a table.
Prepared statements are low level code and include things like "use
index 12 to get column 3".  Any schema change to any table or index
could make those numbers wrong and the simplest solution is for the
internals to return SQLITE_SCHEMA and have the statements reprepared.
Even things like changing collations or user defined functions are
sufficient to need repreparation even if your query doesn't use them.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI9qLjmOOfHg372QQRAscmAKDkeFt/PAD2im09AQ2cllXkhyaq6wCg2NLC
g9wqVCe9u03oGFPpHL2hamA=
=FMms
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to