SQLite Forum

PRAGMAs as functions ?
Login

PRAGMAs as functions ?

(1) By HowardKapustein (howardk) on 2021-05-16 23:05:57 [link] [source]

Does SQLite provide read access to (some/most/which) PRAGMAs?

I'm specifically interested in user_version with a secondary interest in other informational functions e.g.

sqlite> select user_version();
Error: no such function: user_version
sqlite> select data_version();
Error: no such function: data_version
sqlite> select application_id();
Error: no such function: application_id
sqlite> select page_size();
Error: no such function: page_size
sqlite> select cache_size();
Error: no such function: cache_size

plus statistics via sqlite3_config options per https://www.sqlite.org/c3ref/c_config_covering_index_scan.html

(which for some inexplicable reason are doc'd on the webpage named c_config_covering_index_scan.html)

Perhaps there's a compile option I've overlooked? Running with...

sqlite> pragma compile_options;
compile_options
COMPILER=gcc-5.2.0
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS5
ENABLE_JSON1
ENABLE_RTREE
ENABLE_STMTVTAB
ENABLE_UNKNOWN_SQL_FUNCTION
THREADSAFE=0

(2) By anonymous on 2021-05-17 02:12:45 in reply to 1 [link] [source]

(3) By HowardKapustein (howardk) on 2021-05-18 21:44:00 in reply to 2 [source]

Doh! I saw that and entirely misread the pragma_foo() text and examples. My bad. Sorry about that, and thanks