On 6/13/2013 8:04 PM, Maxim Khitrov wrote:
I'd like to check my assumptions. After preparing a statement using
the v2 interface, which functions are guaranteed to return the same
values for that statement instance? These are the ones that I'm
interested in at the moment:
sqlite3_bind_parameter_count
sqlite3_bind_parameter_name (for all 0 < i <= parameter_count)
sqlite3_column_count
sqlite3_column_name (for all 0 <= i < column_count)
sqlite3_column_decltype (for all 0 <= i < column_count)
I assume that parameter functions will return the same values since
those are extracted from the SQL text. How do the column functions
behave if there is a schema change and the statement is recompiled?
Those could change. Automatic recompilation is no different then you
finalizing the query and then preparing it anew.
I did a quick test where I prepared a query (SELECT * FROM x), started
its execution, added another column to the same table, then executed
the next step.
The column addition should have failed, unless you are using WAL in
which case changes made by the writer are not visible to outstanding
readers. A useful test would be to prepare the statement, then get
column count (without ever stepping), then add the column, then get
column count again. Or alternatively, step then reset then add the
column. The bottom line is, schema change should occur while the
statement is not active for the experiment to be meaningful.
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users