pub enum Pragma {
Show 29 variants
ApplicationId(i32),
AutoVacuum(AutoVacuum),
CacheSize(i32),
ForeignKeys(bool),
JournalMode(JournalMode),
Synchronous(Synchronous),
TempStore(TempStore),
LockingMode(LockingMode),
SecureDelete(SecureDelete),
UserVersion(i32),
Encoding(Encoding),
PageSize(i32),
MmapSize(i64),
RecursiveTriggers(bool),
CollationList,
CompileOptions,
DatabaseList,
FunctionList,
TableList,
TableXInfo(&'static str),
ModuleList,
IntegrityCheck(Option<&'static str>),
QuickCheck(Option<&'static str>),
Optimize(Option<u32>),
ForeignKeyCheck(Option<&'static str>),
TableInfo(&'static str),
IndexList(&'static str),
IndexInfo(&'static str),
ForeignKeyList(&'static str),
}Expand description
SQLite pragma statements for database configuration and introspection
Variants§
ApplicationId(i32)
Set or query the 32-bit signed big-endian application ID
§Example
let pragma = Pragma::ApplicationId(12345);
assert_eq!(pragma.to_sql().sql(), "PRAGMA application_id = 12345");AutoVacuum(AutoVacuum)
Query or set the auto-vacuum status in the database
§Example
let pragma = Pragma::AutoVacuum(AutoVacuum::Full);
assert_eq!(pragma.to_sql().sql(), "PRAGMA auto_vacuum = FULL");CacheSize(i32)
Suggest maximum number of database disk pages in memory
§Example
let pragma = Pragma::CacheSize(-2000);
assert_eq!(pragma.to_sql().sql(), "PRAGMA cache_size = -2000");ForeignKeys(bool)
Query, set, or clear the enforcement of foreign key constraints
§Example
let pragma = Pragma::ForeignKeys(true);
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_keys = ON");
let pragma = Pragma::ForeignKeys(false);
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_keys = OFF");JournalMode(JournalMode)
Query or set the journal mode for databases
§Example
let pragma = Pragma::JournalMode(JournalMode::Wal);
assert_eq!(pragma.to_sql().sql(), "PRAGMA journal_mode = WAL");Synchronous(Synchronous)
Control how aggressively SQLite will write data
§Example
let pragma = Pragma::Synchronous(Synchronous::Normal);
assert_eq!(pragma.to_sql().sql(), "PRAGMA synchronous = NORMAL");TempStore(TempStore)
Query or set the storage mode used by temporary tables and indices
§Example
let pragma = Pragma::TempStore(TempStore::Memory);
assert_eq!(pragma.to_sql().sql(), "PRAGMA temp_store = MEMORY");LockingMode(LockingMode)
Query or set the database connection locking-mode
§Example
let pragma = Pragma::LockingMode(LockingMode::Exclusive);
assert_eq!(pragma.to_sql().sql(), "PRAGMA locking_mode = EXCLUSIVE");SecureDelete(SecureDelete)
Query or set the secure-delete setting
§Example
let pragma = Pragma::SecureDelete(SecureDelete::Fast);
assert_eq!(pragma.to_sql().sql(), "PRAGMA secure_delete = FAST");UserVersion(i32)
Set or get the user-version integer
§Example
let pragma = Pragma::UserVersion(42);
assert_eq!(pragma.to_sql().sql(), "PRAGMA user_version = 42");Encoding(Encoding)
Query or set the text encoding used by the database
§Example
let pragma = Pragma::Encoding(Encoding::Utf8);
assert_eq!(pragma.to_sql().sql(), "PRAGMA encoding = UTF-8");PageSize(i32)
Query or set the database page size in bytes
§Example
let pragma = Pragma::PageSize(4096);
assert_eq!(pragma.to_sql().sql(), "PRAGMA page_size = 4096");MmapSize(i64)
Query or set the maximum memory map size
§Example
let pragma = Pragma::MmapSize(268435456);
assert_eq!(pragma.to_sql().sql(), "PRAGMA mmap_size = 268435456");RecursiveTriggers(bool)
Enable or disable recursive trigger firing
§Example
let pragma = Pragma::RecursiveTriggers(true);
assert_eq!(pragma.to_sql().sql(), "PRAGMA recursive_triggers = ON");CollationList
Return a list of collating sequences
§Example
let pragma = Pragma::CollationList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA collation_list");CompileOptions
Return compile-time options used when building SQLite
§Example
let pragma = Pragma::CompileOptions;
assert_eq!(pragma.to_sql().sql(), "PRAGMA compile_options");DatabaseList
Return information about attached databases
§Example
let pragma = Pragma::DatabaseList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA database_list");FunctionList
Return a list of SQL functions
§Example
let pragma = Pragma::FunctionList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA function_list");TableList
Return information about tables and views in the schema
§Example
let pragma = Pragma::TableList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA table_list");TableXInfo(&'static str)
Return extended table information including hidden columns
§Example
let pragma = Pragma::TableXInfo("users");
assert_eq!(pragma.to_sql().sql(), "PRAGMA table_xinfo(users)");ModuleList
Return a list of available virtual table modules
§Example
let pragma = Pragma::ModuleList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA module_list");IntegrityCheck(Option<&'static str>)
Perform database integrity check
§Example
// Check entire database
let pragma = Pragma::IntegrityCheck(None);
assert_eq!(pragma.to_sql().sql(), "PRAGMA integrity_check");
// Check specific table
let pragma = Pragma::IntegrityCheck(Some("users"));
assert_eq!(pragma.to_sql().sql(), "PRAGMA integrity_check(users)");QuickCheck(Option<&'static str>)
Perform faster database integrity check
§Example
let pragma = Pragma::QuickCheck(None);
assert_eq!(pragma.to_sql().sql(), "PRAGMA quick_check");
let pragma = Pragma::QuickCheck(Some("users"));
assert_eq!(pragma.to_sql().sql(), "PRAGMA quick_check(users)");Optimize(Option<u32>)
Attempt to optimize the database
§Example
let pragma = Pragma::Optimize(None);
assert_eq!(pragma.to_sql().sql(), "PRAGMA optimize");
let pragma = Pragma::Optimize(Some(0x10002));
assert_eq!(pragma.to_sql().sql(), "PRAGMA optimize(65538)");ForeignKeyCheck(Option<&'static str>)
Check foreign key constraints for a table
§Example
let pragma = Pragma::ForeignKeyCheck(None);
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_key_check");
let pragma = Pragma::ForeignKeyCheck(Some("orders"));
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_key_check(orders)");TableInfo(&'static str)
Return information about table columns
§Example
let pragma = Pragma::TableInfo("users");
assert_eq!(pragma.to_sql().sql(), "PRAGMA table_info(users)");IndexList(&'static str)
Return information about table indexes
§Example
let pragma = Pragma::IndexList("users");
assert_eq!(pragma.to_sql().sql(), "PRAGMA index_list(users)");IndexInfo(&'static str)
Return information about index columns
§Example
let pragma = Pragma::IndexInfo("idx_users_email");
assert_eq!(pragma.to_sql().sql(), "PRAGMA index_info(idx_users_email)");ForeignKeyList(&'static str)
Return foreign key information for a table
§Example
let pragma = Pragma::ForeignKeyList("orders");
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_key_list(orders)");Implementations§
Source§impl Pragma
impl Pragma
Sourcepub fn query(pragma_name: &str) -> SQL<'static, SQLiteValue<'static>>
pub fn query(pragma_name: &str) -> SQL<'static, SQLiteValue<'static>>
Create a PRAGMA query to get the current value (read-only operation)
Sourcepub fn foreign_keys(enabled: bool) -> Self
pub fn foreign_keys(enabled: bool) -> Self
Convenience constructor for foreign_keys pragma
Sourcepub fn journal_mode(mode: JournalMode) -> Self
pub fn journal_mode(mode: JournalMode) -> Self
Convenience constructor for journal_mode pragma
Sourcepub fn table_info(table: &'static str) -> Self
pub fn table_info(table: &'static str) -> Self
Convenience constructor for table_info pragma
Sourcepub fn index_list(table: &'static str) -> Self
pub fn index_list(table: &'static str) -> Self
Convenience constructor for index_list pragma
Sourcepub fn foreign_key_list(table: &'static str) -> Self
pub fn foreign_key_list(table: &'static str) -> Self
Convenience constructor for foreign_key_list pragma
Sourcepub fn integrity_check(table: Option<&'static str>) -> Self
pub fn integrity_check(table: Option<&'static str>) -> Self
Convenience constructor for integrity_check pragma
Sourcepub fn foreign_key_check(table: Option<&'static str>) -> Self
pub fn foreign_key_check(table: Option<&'static str>) -> Self
Convenience constructor for foreign_key_check pragma
Sourcepub fn table_xinfo(table: &'static str) -> Self
pub fn table_xinfo(table: &'static str) -> Self
Convenience constructor for table_xinfo pragma