pub enum Pragma {
Show 74 variants
ApplicationId(i32),
AutoVacuum(AutoVacuum),
CacheSize(i32),
ForeignKeys(bool),
JournalMode(JournalMode),
WalAutocheckpoint(i32),
Synchronous(Synchronous),
TempStore(TempStore),
LockingMode(LockingMode),
SecureDelete(SecureDelete),
UserVersion(i32),
Encoding(Encoding),
PageSize(i32),
MmapSize(i64),
RecursiveTriggers(bool),
AnalysisLimit(i32),
AutomaticIndex(bool),
BusyTimeout(i32),
CacheSpill(CacheSpill),
CaseSensitiveLike(bool),
CellSizeCheck(bool),
CheckpointFullFsync(bool),
CountChanges(bool),
DataStoreDirectory(&'static str),
DefaultCacheSize(i32),
DeferForeignKeys(bool),
EmptyResultCallbacks(bool),
FullColumnNames(bool),
FullFsync(bool),
HardHeapLimit(i64),
IgnoreCheckConstraints(bool),
JournalSizeLimit(i64),
LegacyAlterTable(bool),
LegacyFileFormat,
MaxPageCount(i32),
QueryOnly(bool),
ReadUncommitted(bool),
ReverseUnorderedSelects(bool),
SchemaVersion(i32),
ShortColumnNames(bool),
SoftHeapLimit(i64),
TempStoreDirectory(&'static str),
Threads(i32),
TrustedSchema(bool),
WritableSchema(WritableSchema),
ParserTrace(bool),
VdbeAddoptrace(bool),
VdbeDebug(bool),
VdbeListing(bool),
VdbeTrace(bool),
CollationList,
CompileOptions,
DatabaseList,
FunctionList,
TableList,
TableXInfo(&'static str),
ModuleList,
DataVersion,
FreelistCount,
PageCount,
PragmaList,
Stats,
IncrementalVacuum(Option<i32>),
ShrinkMemory,
WalCheckpoint(Option<WalCheckpointMode>),
IntegrityCheck(Option<&'static str>),
QuickCheck(Option<&'static str>),
Optimize(Option<u32>),
ForeignKeyCheck(Option<&'static str>),
TableInfo(&'static str),
IndexList(&'static str),
IndexInfo(&'static str),
IndexXInfo(&'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");WalAutocheckpoint(i32)
Query or set the WAL auto-checkpoint threshold (pages)
§Example
let pragma = Pragma::WalAutocheckpoint(1000);
assert_eq!(pragma.to_sql().sql(), "PRAGMA wal_autocheckpoint = 1000");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");AnalysisLimit(i32)
Query or set the ANALYZE limit
AutomaticIndex(bool)
Query or set automatic indexing
BusyTimeout(i32)
Query or set the busy timeout (milliseconds)
CacheSpill(CacheSpill)
Query or set cache spill settings
CaseSensitiveLike(bool)
Query or set case_sensitive_like (deprecated)
CellSizeCheck(bool)
Enable or disable cell size checking
CheckpointFullFsync(bool)
Enable or disable checkpoint fullfsync
CountChanges(bool)
Query or set count_changes (deprecated)
DataStoreDirectory(&'static str)
Query or set data_store_directory (deprecated)
DefaultCacheSize(i32)
Query or set default_cache_size (deprecated)
DeferForeignKeys(bool)
Query or set defer_foreign_keys
EmptyResultCallbacks(bool)
Query or set empty_result_callbacks (deprecated)
FullColumnNames(bool)
Query or set full_column_names (deprecated)
FullFsync(bool)
Query or set fullfsync
HardHeapLimit(i64)
Query or set hard_heap_limit
IgnoreCheckConstraints(bool)
Query or set ignore_check_constraints
JournalSizeLimit(i64)
Query or set journal_size_limit
LegacyAlterTable(bool)
Query or set legacy_alter_table
LegacyFileFormat
Query legacy_file_format (deprecated)
MaxPageCount(i32)
Query or set max_page_count
QueryOnly(bool)
Query or set query_only
ReadUncommitted(bool)
Query or set read_uncommitted
ReverseUnorderedSelects(bool)
Query or set reverse_unordered_selects
SchemaVersion(i32)
Query or set schema_version (test-only)
ShortColumnNames(bool)
Query or set short_column_names (deprecated)
SoftHeapLimit(i64)
Query or set soft_heap_limit
TempStoreDirectory(&'static str)
Query or set temp_store_directory (deprecated)
Threads(i32)
Query or set threads
TrustedSchema(bool)
Query or set trusted_schema
WritableSchema(WritableSchema)
Query or set writable_schema (test-only)
ParserTrace(bool)
Query or set parser_trace (requires SQLITE_DEBUG)
VdbeAddoptrace(bool)
Query or set vdbe_addoptrace (requires SQLITE_DEBUG)
VdbeDebug(bool)
Query or set vdbe_debug (requires SQLITE_DEBUG)
VdbeListing(bool)
Query or set vdbe_listing (requires SQLITE_DEBUG)
VdbeTrace(bool)
Query or set vdbe_trace (requires SQLITE_DEBUG)
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");DataVersion
Return the data_version counter
FreelistCount
Return the number of free pages in the database file
PageCount
Return the page count for the database
PragmaList
Return a list of available pragmas
Stats
Return statistics (test-only)
IncrementalVacuum(Option<i32>)
Perform incremental vacuuming
ShrinkMemory
Release as much memory as possible
WalCheckpoint(Option<WalCheckpointMode>)
Run a WAL checkpoint
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)");IndexXInfo(&'static str)
Return extended information about index columns
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 wal_autocheckpoint(pages: i32) -> Self
pub fn wal_autocheckpoint(pages: i32) -> Self
Convenience constructor for wal_autocheckpoint 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
Trait Implementations§
Source§impl<'a> ToSQL<'a, SQLiteValue<'a>> for Pragma
impl<'a> ToSQL<'a, SQLiteValue<'a>> for Pragma
fn to_sql(&self) -> SQL<'a, SQLiteValue<'a>>
Source§fn into_sql(self) -> SQL<'a, V>where
Self: Sized,
fn into_sql(self) -> SQL<'a, V>where
Self: Sized,
to_sql() (which clones). Types that own their SQL
(like SQL and SQLExpr) override this to avoid the clone.