Appendix F. SQLite SQL PRAGMA Reference
This appendix covers all of the
PRAGMA
commands recognized by SQLite. Pragmas
are SQLite-specific statements used to control various environmental variables and
state flags within the SQLite environment. They are typically used to activate or
configure many of the optional or advanced features of the SQLite library.
Although some pragmas are read-only, most pragma commands can be used to query the current value or set a new value. To query the current value, just provide the name of the pragma:
PRAGMA pragma_name
;
In most cases this will return a one-column, one-row result set with the current value. To set a new value, use a syntax like this:
PRAGMApragma_name
=value
;
Although a few pragmas will return the updated value, in most cases the set syntax will not return anything. Any unrecognized or malformed pragma will silently return without error. Be very careful about spelling your pragma commands correctly, or SQLite will consider the pragma unrecognized—an application bug that can be extremely difficult to find and fix.
Nearly all pragmas fall into one of two categories. The first category includes pragmas that are associated with the database connection. These pragma values can modify and control how the SQLite engine, as a whole, interacts with all of the databases attached to the database connection.
The second category of pragmas operate on specific databases. These pragmas will typically allow different values for each database that has ...
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.