Skip to main content

Pragma

Enum Pragma 

Source
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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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)

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§Example

let pragma = Pragma::MmapSize(268435456);
assert_eq!(pragma.to_sql().sql(), "PRAGMA mmap_size = 268435456");
§

RecursiveTriggers(bool)

Enable or disable recursive trigger firing

SQLite Documentation

§Example

let pragma = Pragma::RecursiveTriggers(true);
assert_eq!(pragma.to_sql().sql(), "PRAGMA recursive_triggers = ON");
§

AnalysisLimit(i32)

Query or set the ANALYZE limit

SQLite Documentation

§

AutomaticIndex(bool)

Query or set automatic indexing

SQLite Documentation

§

BusyTimeout(i32)

Query or set the busy timeout (milliseconds)

SQLite Documentation

§

CacheSpill(CacheSpill)

Query or set cache spill settings

SQLite Documentation

§

CaseSensitiveLike(bool)

Query or set case_sensitive_like (deprecated)

SQLite Documentation

§

CellSizeCheck(bool)

Enable or disable cell size checking

SQLite Documentation

§

CheckpointFullFsync(bool)

Enable or disable checkpoint fullfsync

SQLite Documentation

§

CountChanges(bool)

Query or set count_changes (deprecated)

SQLite Documentation

§

DataStoreDirectory(&'static str)

Query or set data_store_directory (deprecated)

SQLite Documentation

§

DefaultCacheSize(i32)

Query or set default_cache_size (deprecated)

SQLite Documentation

§

DeferForeignKeys(bool)

Query or set defer_foreign_keys

SQLite Documentation

§

EmptyResultCallbacks(bool)

Query or set empty_result_callbacks (deprecated)

SQLite Documentation

§

FullColumnNames(bool)

Query or set full_column_names (deprecated)

SQLite Documentation

§

FullFsync(bool)

Query or set fullfsync

SQLite Documentation

§

HardHeapLimit(i64)

Query or set hard_heap_limit

SQLite Documentation

§

IgnoreCheckConstraints(bool)

Query or set ignore_check_constraints

SQLite Documentation

§

JournalSizeLimit(i64)

Query or set journal_size_limit

SQLite Documentation

§

LegacyAlterTable(bool)

Query or set legacy_alter_table

SQLite Documentation

§

LegacyFileFormat

Query legacy_file_format (deprecated)

SQLite Documentation

§

MaxPageCount(i32)

Query or set max_page_count

SQLite Documentation

§

QueryOnly(bool)

Query or set query_only

SQLite Documentation

§

ReadUncommitted(bool)

Query or set read_uncommitted

SQLite Documentation

§

ReverseUnorderedSelects(bool)

Query or set reverse_unordered_selects

SQLite Documentation

§

SchemaVersion(i32)

Query or set schema_version (test-only)

SQLite Documentation

§

ShortColumnNames(bool)

Query or set short_column_names (deprecated)

SQLite Documentation

§

SoftHeapLimit(i64)

Query or set soft_heap_limit

SQLite Documentation

§

TempStoreDirectory(&'static str)

Query or set temp_store_directory (deprecated)

SQLite Documentation

§

Threads(i32)

Query or set threads

SQLite Documentation

§

TrustedSchema(bool)

Query or set trusted_schema

SQLite Documentation

§

WritableSchema(WritableSchema)

Query or set writable_schema (test-only)

SQLite Documentation

§

ParserTrace(bool)

Query or set parser_trace (requires SQLITE_DEBUG)

SQLite Documentation

§

VdbeAddoptrace(bool)

Query or set vdbe_addoptrace (requires SQLITE_DEBUG)

SQLite Documentation

§

VdbeDebug(bool)

Query or set vdbe_debug (requires SQLITE_DEBUG)

SQLite Documentation

§

VdbeListing(bool)

Query or set vdbe_listing (requires SQLITE_DEBUG)

SQLite Documentation

§

VdbeTrace(bool)

Query or set vdbe_trace (requires SQLITE_DEBUG)

SQLite Documentation

§

CollationList

Return a list of collating sequences

SQLite Documentation

§Example

let pragma = Pragma::CollationList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA collation_list");
§

CompileOptions

Return compile-time options used when building SQLite

SQLite Documentation

§Example

let pragma = Pragma::CompileOptions;
assert_eq!(pragma.to_sql().sql(), "PRAGMA compile_options");
§

DatabaseList

Return information about attached databases

SQLite Documentation

§Example

let pragma = Pragma::DatabaseList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA database_list");
§

FunctionList

Return a list of SQL functions

SQLite Documentation

§Example

let pragma = Pragma::FunctionList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA function_list");
§

TableList

Return information about tables and views in the schema

SQLite Documentation

§Example

let pragma = Pragma::TableList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA table_list");
§

TableXInfo(&'static str)

Return extended table information including hidden columns

SQLite Documentation

§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

SQLite Documentation

§Example

let pragma = Pragma::ModuleList;
assert_eq!(pragma.to_sql().sql(), "PRAGMA module_list");
§

DataVersion

Return the data_version counter

SQLite Documentation

§

FreelistCount

Return the number of free pages in the database file

SQLite Documentation

§

PageCount

Return the page count for the database

SQLite Documentation

§

PragmaList

Return a list of available pragmas

SQLite Documentation

§

Stats

Return statistics (test-only)

SQLite Documentation

§

IncrementalVacuum(Option<i32>)

Perform incremental vacuuming

SQLite Documentation

§

ShrinkMemory

Release as much memory as possible

SQLite Documentation

§

WalCheckpoint(Option<WalCheckpointMode>)

Run a WAL checkpoint

SQLite Documentation

§

IntegrityCheck(Option<&'static str>)

Perform database integrity check

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§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

SQLite Documentation

§Example

let pragma = Pragma::TableInfo("users");
assert_eq!(pragma.to_sql().sql(), "PRAGMA table_info(users)");
§

IndexList(&'static str)

Return information about table indexes

SQLite Documentation

§Example

let pragma = Pragma::IndexList("users");
assert_eq!(pragma.to_sql().sql(), "PRAGMA index_list(users)");
§

IndexInfo(&'static str)

Return information about index columns

SQLite Documentation

§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

SQLite Documentation

§

ForeignKeyList(&'static str)

Return foreign key information for a table

SQLite Documentation

§Example

let pragma = Pragma::ForeignKeyList("orders");
assert_eq!(pragma.to_sql().sql(), "PRAGMA foreign_key_list(orders)");

Implementations§

Source§

impl Pragma

Source

pub fn query(pragma_name: &str) -> SQL<'static, SQLiteValue<'static>>

Create a PRAGMA query to get the current value (read-only operation)

Source

pub fn foreign_keys(enabled: bool) -> Self

Convenience constructor for foreign_keys pragma

Source

pub fn journal_mode(mode: JournalMode) -> Self

Convenience constructor for journal_mode pragma

Source

pub fn wal_autocheckpoint(pages: i32) -> Self

Convenience constructor for wal_autocheckpoint pragma

Source

pub fn table_info(table: &'static str) -> Self

Convenience constructor for table_info pragma

Source

pub fn index_list(table: &'static str) -> Self

Convenience constructor for index_list pragma

Source

pub fn foreign_key_list(table: &'static str) -> Self

Convenience constructor for foreign_key_list pragma

Source

pub fn integrity_check(table: Option<&'static str>) -> Self

Convenience constructor for integrity_check pragma

Source

pub fn foreign_key_check(table: Option<&'static str>) -> Self

Convenience constructor for foreign_key_check pragma

Source

pub fn table_xinfo(table: &'static str) -> Self

Convenience constructor for table_xinfo pragma

Source

pub fn encoding(encoding: Encoding) -> Self

Convenience constructor for encoding pragma

Trait Implementations§

Source§

impl Clone for Pragma

Source§

fn clone(&self) -> Pragma

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pragma

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Pragma

Source§

fn eq(&self, other: &Pragma) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> ToSQL<'a, SQLiteValue<'a>> for Pragma

Source§

fn to_sql(&self) -> SQL<'a, SQLiteValue<'a>>

Source§

fn into_sql(self) -> SQL<'a, V>
where Self: Sized,

Consume self and return SQL without cloning. Default delegates to to_sql() (which clones). Types that own their SQL (like SQL and SQLExpr) override this to avoid the clone.
Source§

fn alias(&self, alias: &'static str) -> SQL<'a, V>

Source§

impl StructuralPartialEq for Pragma

Auto Trait Implementations§

§

impl Freeze for Pragma

§

impl RefUnwindSafe for Pragma

§

impl Send for Pragma

§

impl Sync for Pragma

§

impl Unpin for Pragma

§

impl UnwindSafe for Pragma

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.