Expand description
SQLite PRAGMA statements for database configuration and introspection
This module provides type-safe, ergonomic access to SQLite’s PRAGMA statements.
PRAGMA statements are SQL extension specific to SQLite and are used to modify
the operation of the SQLite library or to query the SQLite library for internal
(non-table) data.
§Features
- Type Safety: Enums for all pragma values (no string literals needed)
- Ergonomic API: Uses
&'static strinstead ofString- no.to_string()calls - Documentation Links: Each pragma links to official
SQLitedocumentation ToSQLIntegration: Seamless integration with the query builder
§Categories
- Configuration:
foreign_keys,journal_mode,wal_autocheckpoint,cache_spill, etc. - Introspection:
table_info,index_list,compile_options, etc. - Maintenance:
integrity_check,incremental_vacuum,wal_checkpoint, etc.
§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
SQLitepragma statements for database configuration and introspection- 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 - Writable schema modes (test-only)