I tried to do the sqlite db PRAGMA via c-interface, sqlite3_exec() with the
following statements,

PRAGMA main.cache_size=5000;PRAGMA main.page_size = 2048;PRAGMA
main.locking_mode=NORMAL ;PRAGMA main.synchronous=NORMAL;PRAGMA
main.journal_mode=wal;

Looks some PRAGMA are set, cache_size setting does not work after
sqlite3_exec() returned.

I saw something in https://www.sqlite.org/pragma.html


   - Some pragmas take effect during the SQL compilation stage, not the
   execution stage. This means if using the C-language sqlite3_prepare()
   <https://www.sqlite.org/c3ref/prepare.html>, sqlite3_step()
   <https://www.sqlite.org/c3ref/step.html>, sqlite3_finalize()
   <https://www.sqlite.org/c3ref/finalize.html> API (or similar in a
   wrapper interface), the pragma may run during the sqlite3_prepare()
   <https://www.sqlite.org/c3ref/prepare.html> call, not during the
   sqlite3_step() <https://www.sqlite.org/c3ref/step.html> call as normal
   SQL statements do. Or the pragma might run during sqlite3_step() just like
   normal SQL statements. Whether or not the pragma runs during
   sqlite3_prepare() or sqlite3_step() depends on the pragma and on the
   specific release of SQLite.

And wonder how I can set PRAGMA correctly in c-interface of sqlite3.

Thanks,

Tao
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to