On 2015-09-19 06:41 PM, gwenn wrote: > SQLITE_SCHEMA is returned only on failure. > But, here, there is not failure. > > Maybe I should not store the column count ? > Maybe I should look at schema version > (http://sqlite.org/pragma.html#pragma_schema_version): > "The schema version is used by SQLite each time a query is executed to > ensure that the internal cache of the schema used when compiling the > SQL query matches the schema of the database against which the > compiled query is actually executed." > Is there a better solution ?
I too may be reading this thread wrong, I am not sure we're on the same page, but I /THINK/ maybe you are worrying about an unnecessary thing. The only way the column count can change for a prepared statement object, is if you changed it. If you have a prepared statement like "SELECT * FROM t..." then the definition might change once the SCHEMA has changed - but that will only have effect outside of the implicit transaction you are in, as in you will only notice when you reset the prepared statement - and you should always check column counts then. The bit I am not sure about is whether, after a schema change and reset, whether that select statement will give an error or simply recompile with a new column count - but that can be checked rather easily and then respond accordingly. Hope this makes some sense, Ryan