c++ - Are the column count and column decltypes invariant for the duration of the execution of a SQLite prepared statement? -


when @ code other folks have written using sqlite3 c api, find sqlite3_column_decltype , sqlite3_column_count called inner loop (once per result row).

my understanding of database these values never change if statement re-compiled (see the bit sqlite3_prepare_v2).

so should able call these once , cache them after call sqlite3_prepare.

the columns' declared types can change, if use same statement in 2 transactions , database schema changed between them. in same situation, column count can change, if query using select *.

however, single query execution inside transaction (either manual or automatic one). if cache values after call sqlite3_prepare_v2() , use them until next call sqlite3_reset()/sqlite3_finalize(), fine. can cache them longer if ensure uses inside same transaction.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -