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 SQLite documentation
- ToSQL Integration: Seamless integration with the query builder
§Categories
- Configuration:
foreign_keys,journal_mode,synchronous, etc. - Introspection:
table_info,index_list,compile_options, etc. - Maintenance:
integrity_check,optimize,quick_check, 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 SQLite databases
- Encoding
- Encoding types for SQLite databases
- Journal
Mode - Journal modes for SQLite databases
- Locking
Mode - Database locking modes
- Pragma
- SQLite pragma statements for database configuration and introspection
- Secure
Delete - Secure delete modes for SQLite
- Synchronous
- Synchronous modes for SQLite databases
- Temp
Store - Storage modes for temporary tables and indices