Expand description
SQLite PRAGMA statements.
A PRAGMA changes a setting of the SQLite library or reads internal
data such as table metadata. Pragma has one variant per pragma, with
enums for settings that take a fixed set of values. Render it with
ToSQL::to_sql and run the SQL with your driver.
Table, index and directory names are written into the SQL as given, without quoting or escaping. Only pass trusted names.
See the SQLite PRAGMA documentation.
§Examples
use drizzle_sqlite::pragma::{Pragma, JournalMode, AutoVacuum};
use drizzle_core::ToSQL;
// Enable foreign key constraints
let pragma = Pragma::foreign_keys(true);
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_keys = ON");
// Set journal mode to WAL
let pragma = Pragma::journal_mode(JournalMode::Wal);
assert_eq!(pragma.to_sql().sql(), "PRAGMA journal_mode = WAL");
// Get table schema information
let pragma = Pragma::table_info("users");
assert_eq!(pragma.to_sql().sql(), "PRAGMA table_info(users)");
// Check database integrity
let pragma = Pragma::integrity_check(None);
assert_eq!(pragma.to_sql().sql(), "PRAGMA integrity_check");Enums§
- Auto
Vacuum - Auto-vacuum modes for
SQLitedatabases - Cache
Spill - Cache spill settings for
SQLitedatabases - Encoding
- Encoding types for
SQLitedatabases - Journal
Mode - Journal modes for
SQLitedatabases - Locking
Mode - Database locking modes
- Pragma
- A
SQLitePRAGMA statement. - Secure
Delete - Secure delete modes for
SQLite - Synchronous
- Synchronous modes for
SQLitedatabases - Temp
Store - Storage modes for temporary tables and indices
- WalCheckpoint
Mode - WAL checkpoint modes
- Writable
Schema - Values for
Pragma::WritableSchema. Misuse can corrupt the database.