pub struct SqliteConnection { /* private fields */ }__sqlite-shared only.Expand description
Connections for the SQLite backend. Unlike other backends, SQLite supported connection URLs are:
- File paths (
test.db) - URIs (
file://test.db) - Special identifiers (
:memory:)
§Supported loading model implementations
As SqliteConnection only supports a single loading mode implementation,
it is not required to explicitly specify a loading mode
when calling RunQueryDsl::load_iter() or LoadConnection::load
§DefaultLoadingMode
SqliteConnection only supports a single loading mode, which loads
values row by row from the result set.
use diesel::connection::DefaultLoadingMode;
{
// scope to restrict the lifetime of the iterator
let iter1 = users::table.load_iter::<(i32, String), DefaultLoadingMode>(connection)?;
for r in iter1 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}
}
// works without specifying the loading mode
let iter2 = users::table.load_iter::<(i32, String), _>(connection)?;
for r in iter2 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}This mode does not support creating multiple iterators using the same connection.
use diesel::connection::DefaultLoadingMode;
let iter1 = users::table.load_iter::<(i32, String), DefaultLoadingMode>(connection)?;
let iter2 = users::table.load_iter::<(i32, String), DefaultLoadingMode>(connection)?;
for r in iter1 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}
for r in iter2 {
let (id, name) = r?;
println!("Id: {} Name: {}", id, name);
}§Concurrency
By default, when running into a database lock, the operation will abort with a
Database locked error. However, it’s possible to configure it for greater concurrency,
trading latency for not having to deal with retries yourself.
You can use this example as blue-print for which statements to run after establishing a connection.
It is important to run each PRAGMA in a single statement to make sure all of them apply
correctly. In addition the order of the PRAGMA statements is relevant to prevent timeout
issues for the later PRAGMA statements.
use diesel::connection::SimpleConnection;
let conn = &mut establish_connection();
// see https://fractaledmind.github.io/2023/09/07/enhancing-rails-sqlite-fine-tuning/
// sleep if the database is busy, this corresponds to up to 2 seconds sleeping time.
conn.batch_execute("PRAGMA busy_timeout = 2000;")?;
// better write-concurrency
conn.batch_execute("PRAGMA journal_mode = WAL;")?;
// fsync only in critical moments
conn.batch_execute("PRAGMA synchronous = NORMAL;")?;
// write WAL changes back every 1000 pages, for an in average 1MB WAL file.
// May affect readers if number is increased
conn.batch_execute("PRAGMA wal_autocheckpoint = 1000;")?;
// free some space by truncating possibly massive WAL files from the last run
conn.batch_execute("PRAGMA wal_checkpoint(TRUNCATE);")?;Implementations§
Source§impl SqliteConnection
impl SqliteConnection
Sourcepub fn on_commit<F>(&mut self, hook: F)
pub fn on_commit<F>(&mut self, hook: F)
Registers a callback invoked when a transaction is about to be committed.
The callback returns a CommitDecision: Proceed lets the commit
complete, Rollback converts it into a rollback.
Only one commit hook can be active at a time per connection. Registering a new one replaces the previous.
The callback runs synchronously as part of the committing
sqlite3_step() call, on the thread performing the commit, so it is
never invoked concurrently. Per SQLite, the callback must not use the
connection that triggered it (running any SQL, including a SELECT,
counts as use) and is not reentrant. A panic in the callback aborts the
process.
See: sqlite3_commit_hook
§Example
use diesel::prelude::*;
use diesel::sqlite::{SqliteConnection, CommitDecision};
use std::sync::{Arc, Mutex};
diesel::table! {
users (id) {
id -> Integer,
name -> Text,
}
}
let commits = Arc::new(Mutex::new(0u32));
let commits2 = commits.clone();
conn.on_commit(move || {
*commits2.lock().unwrap() += 1;
CommitDecision::Proceed
});
conn.immediate_transaction(|conn| {
diesel::insert_into(users::table)
.values(users::name.eq("Alice"))
.execute(conn)?;
Ok::<_, diesel::result::Error>(())
}).unwrap();
assert_eq!(*commits.lock().unwrap(), 1);Sourcepub fn remove_commit_hook(&mut self)
pub fn remove_commit_hook(&mut self)
Removes the commit hook. Subsequent commits will not invoke any callback.
See on_commit for usage example.
Sourcepub fn on_rollback<F>(&mut self, hook: F)
pub fn on_rollback<F>(&mut self, hook: F)
Registers a callback invoked after a transaction is rolled back.
This is not invoked for the implicit rollback that occurs when
the connection is closed. It is invoked when a commit hook forces
a rollback by returning CommitDecision::Rollback.
Only one rollback hook can be active at a time per connection. Registering a new one replaces the previous.
The callback must not use the database connection. It is invoked synchronously on the thread driving the connection, so it is never called concurrently, and like the commit hook it is not reentrant. Panics in the callback abort the process.
§Example
use diesel::prelude::*;
use diesel::sqlite::SqliteConnection;
use std::sync::Arc;
use std::sync::atomic::{AtomicU32, Ordering};
let rollbacks = Arc::new(AtomicU32::new(0));
let rb2 = rollbacks.clone();
conn.on_rollback(move || {
rb2.fetch_add(1, Ordering::Relaxed);
});
// Force a rollback by returning an error.
let _ = conn.immediate_transaction(|_conn| {
Err::<(), _>(diesel::result::Error::RollbackTransaction)
});
assert_eq!(rollbacks.load(Ordering::Relaxed), 1);Sourcepub fn remove_rollback_hook(&mut self)
pub fn remove_rollback_hook(&mut self)
Removes the rollback hook. Subsequent rollbacks will not invoke any callback.
See on_rollback for usage example.
Sourcepub fn on_progress<F>(&mut self, n: NonZeroU32, hook: F)
pub fn on_progress<F>(&mut self, n: NonZeroU32, hook: F)
Registers a progress handler that can interrupt long-running queries.
The callback is invoked periodically while a query runs. n is the
approximate number of virtual-machine instructions between callbacks. It
is a NonZeroU32 so the handler cannot be disabled implicitly by
passing zero. Use remove_progress_handler
to disable it. Since SQLite 3.41.0 the callback may also fire during
statement preparation.
The callback returns a ProgressDecision: Continue lets the query
keep executing, Interrupt aborts it (causes SQLITE_INTERRUPT).
Only one progress handler can be active at a time per connection. Registering a new one replaces the previous.
The callback must not use the database connection. It is invoked synchronously on the thread driving the connection, so it is never called concurrently. Panics in the callback abort the process.
§Example
use diesel::prelude::*;
use diesel::sqlite::{SqliteConnection, ProgressDecision};
use std::num::NonZeroU32;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
let cancelled = Arc::new(AtomicBool::new(false));
let cancelled2 = cancelled.clone();
conn.on_progress(NonZeroU32::new(1000).unwrap(), move || {
if cancelled2.load(Ordering::Relaxed) {
ProgressDecision::Interrupt
} else {
ProgressDecision::Continue
}
});
// Later: remove the handler.
conn.remove_progress_handler();Sourcepub fn remove_progress_handler(&mut self)
pub fn remove_progress_handler(&mut self)
Removes the progress handler. Subsequent queries will not invoke any callback.
See on_progress for usage example.
Source§impl SqliteConnection
impl SqliteConnection
Sourcepub fn immediate_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
pub fn immediate_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
Run a transaction with BEGIN IMMEDIATE
This method will return an error if a transaction is already open.
§Example
conn.immediate_transaction(|conn| {
// Do stuff in a transaction
Ok(())
})Sourcepub fn exclusive_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
pub fn exclusive_transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
Run a transaction with BEGIN EXCLUSIVE
This method will return an error if a transaction is already open.
§Example
conn.exclusive_transaction(|conn| {
// Do stuff in a transaction
Ok(())
})Sourcepub fn last_insert_rowid(&self) -> Option<NonZeroI64>
pub fn last_insert_rowid(&self) -> Option<NonZeroI64>
Returns the rowid of the most recent successful INSERT on this connection.
Returns None if no successful INSERT into a rowid table has been performed
on this connection, and Some(rowid) otherwise.
See the SQLite documentation for details.
§Caveats
- Inserts into
WITHOUT ROWIDtables are not recorded - Failed
INSERT(constraint violations) do not change the value INSERT OR REPLACEalways updates the value- Within triggers, returns the rowid of the trigger’s INSERT; reverts after the trigger completes
§Example
use core::num::NonZeroI64;
use diesel::connection::SimpleConnection;
let conn = &mut SqliteConnection::establish(":memory:").unwrap();
conn.batch_execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT NOT NULL)")?;
conn.batch_execute("INSERT INTO users (name) VALUES ('Sean')")?;
let rowid = conn.last_insert_rowid();
assert_eq!(rowid, NonZeroI64::new(1));
conn.batch_execute("INSERT INTO users (name) VALUES ('Tess')")?;
let rowid = conn.last_insert_rowid();
assert_eq!(rowid, NonZeroI64::new(2));Sourcepub fn get_read_only_blob<'conn, 'query, U>(
&'conn self,
blob_column: U,
row_id: i64,
) -> Result<SqliteReadOnlyBlob<'conn>, Error>
pub fn get_read_only_blob<'conn, 'query, U>( &'conn self, blob_column: U, row_id: i64, ) -> Result<SqliteReadOnlyBlob<'conn>, Error>
Returns an object that can be used to stream a BLOB from the database
§Example
use std::io::Read;
use diesel::connection::SimpleConnection;
let conn = &mut SqliteConnection::establish(":memory:").unwrap();
conn.batch_execute("CREATE TABLE myblobs (id INTEGER PRIMARY KEY, mydata BLOB)")?;
conn.batch_execute("INSERT INTO myblobs (mydata) VALUES ('abc')")?;
let mut data = conn.get_read_only_blob(myblobs::mydata, 1)?;
let mut buf = vec![];
data.read_to_end(&mut buf)?;
assert_eq!(buf, b"abc");Sourcepub fn register_collation<F>(
&mut self,
collation_name: &str,
collation: F,
) -> QueryResult<()>
pub fn register_collation<F>( &mut self, collation_name: &str, collation: F, ) -> QueryResult<()>
Register a collation function.
collation must always return the same answer given the same inputs.
If collation panics and unwinds the stack, the process is aborted, since it is used
across a C FFI boundary, which cannot be unwound across and there is no way to
signal failures via the SQLite interface in this case..
If the name is already registered it will be overwritten.
This method will return an error if registering the function fails, either due to an out-of-memory situation or because a collation with that name already exists and is currently being used in parallel by a query.
The collation needs to be specified when creating a table:
CREATE TABLE my_table ( str TEXT COLLATE MY_COLLATION ),
where MY_COLLATION corresponds to name passed as collation_name.
§Example
// sqlite NOCASE only works for ASCII characters,
// this collation allows handling UTF-8 (barring locale differences)
conn.register_collation("RUSTNOCASE", |rhs, lhs| {
rhs.to_lowercase().cmp(&lhs.to_lowercase())
})Sourcepub fn serialize_database_to_buffer(&mut self) -> SerializedDatabase
pub fn serialize_database_to_buffer(&mut self) -> SerializedDatabase
Serialize the current SQLite database into a byte buffer.
The serialized data is identical to the data that would be written to disk if the database was saved in a file.
§Returns
This function returns a byte slice representing the serialized database.
Sourcepub fn deserialize_readonly_database_from_buffer(
&mut self,
data: &[u8],
) -> QueryResult<()>
pub fn deserialize_readonly_database_from_buffer( &mut self, data: &[u8], ) -> QueryResult<()>
Deserialize an SQLite database from a byte buffer.
This function takes a byte slice and attempts to deserialize it into a SQLite database. If successful, the database is loaded into the connection. If the deserialization fails, an error is returned.
The database is opened in READONLY mode.
§Example
let connection = &mut SqliteConnection::establish(":memory:").unwrap();
sql_query("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)")
.execute(connection).unwrap();
sql_query("INSERT INTO users (name, email) VALUES ('John Doe', 'john.doe@example.com'), ('Jane Doe', 'jane.doe@example.com')")
.execute(connection).unwrap();
// Serialize the database to a byte vector
let serialized_db: SerializedDatabase = connection.serialize_database_to_buffer();
// Create a new in-memory SQLite database
let connection = &mut SqliteConnection::establish(":memory:").unwrap();
// Deserialize the byte vector into the new database
connection.deserialize_readonly_database_from_buffer(serialized_db.as_slice()).unwrap();Sourcepub unsafe fn with_raw_connection<R, F>(&mut self, f: F) -> R
pub unsafe fn with_raw_connection<R, F>(&mut self, f: F) -> R
Provides temporary access to the raw SQLite database connection handle.
This method provides a way to access the underlying sqlite3 pointer,
enabling direct use of the SQLite C API for advanced features that
Diesel does not wrap, such as the session extension,
hooks, or other advanced APIs.
§Why Diesel Doesn’t Wrap These APIs
Certain SQLite features, such as the session extension, are optional and only
available when SQLite is compiled with specific flags (e.g., -DSQLITE_ENABLE_SESSION
and -DSQLITE_ENABLE_PREUPDATE_HOOK for sessions). These compile-time options determine
whether the corresponding C API functions exist in the SQLite library’s ABI.
Because Diesel must work with any SQLite library at runtime—including system-provided libraries that may lack these optional features—it cannot safely provide wrappers for APIs that may or may not exist. Doing so would either:
- Cause linker errors at compile time if the user’s
libsqlite3-syswasn’t compiled with the required flags, or - Cause undefined behavior at runtime if Diesel called functions that don’t exist in the linked library.
While feature gates could theoretically solve this problem, Diesel already has an extensive API surface with many existing feature combinations. Each new feature gate adds a combinatorial explosion of test configurations that must be validated, making the library increasingly difficult to maintain. Therefore, exposing the raw connection is the preferred approach for niche SQLite features.
By exposing the raw connection handle, Diesel allows users who know they have access to a properly configured SQLite build to use these advanced features directly through their own FFI bindings.
§Safety
This method is marked unsafe because improper use of the raw connection handle
can lead to undefined behavior. The caller must ensure that:
- The connection handle is not closed during the callback.
- The connection handle is not stored beyond the callback’s scope.
- Concurrent access rules are respected (SQLite connections are not thread-safe unless using serialized threading mode).
- Transaction state is not modified — do not execute
BEGIN,COMMIT,ROLLBACK, orSAVEPOINTstatements via the raw handle. Diesel’sAnsiTransactionManagertracks transaction nesting internally, and bypassing it will cause Diesel’s view of the transaction state to diverge from SQLite’s actual state. - Diesel’s prepared statements are not disturbed — do not call
sqlite3_finalize()orsqlite3_reset()on statements that belong to Diesel’sStatementCache. Doing so will cause use-after-free or double-free when Diesel later accesses those statements.
§Example
use diesel::sqlite::SqliteConnection;
use diesel::Connection;
let mut conn = SqliteConnection::establish(":memory:").unwrap();
// SAFETY: We do not close or store the connection handle,
// and we do not modify Diesel-managed state (transactions, cached statements).
let is_valid = unsafe {
conn.with_raw_connection(|raw_conn| {
// The raw connection pointer can be passed to SQLite C API functions
// from your own `libsqlite3-sys` (native) or `sqlite-wasm-rs` (WASM)
// dependency — for example, `sqlite3_get_autocommit(raw_conn)` or
// `sqlite3session_create(raw_conn, ...)`.
!raw_conn.is_null()
})
};
assert!(is_valid);§Platform Notes
This method works identically on both native and WASM targets. However, you must depend on the appropriate FFI crate for your target:
- Native: Add
libsqlite3-sysas a dependency - WASM (
wasm32-unknown-unknown): Addsqlite-wasm-rsas a dependency
Both crates expose a compatible sqlite3 type that can be used with the
pointer returned by this method.
Sourcepub fn set_limit(&mut self, limit: SqliteLimit, value: i32) -> i32
pub fn set_limit(&mut self, limit: SqliteLimit, value: i32) -> i32
Set a runtime limit for this connection, returning its previous value.
Lowering these limits is a way to harden a connection against untrusted
SQL. See the SQLite documentation
for the meaning of each SqliteLimit.
§Example
use diesel::sqlite::SqliteLimit;
let mut conn = SqliteConnection::establish(":memory:").unwrap();
// Cap SQL statement length at 1 KiB, keeping the previous value.
let previous = conn.set_limit(SqliteLimit::SqlLength, 1024);
assert!(previous > 0);
assert_eq!(conn.get_limit(SqliteLimit::SqlLength), 1024);Sourcepub fn get_limit(&self, limit: SqliteLimit) -> i32
pub fn get_limit(&self, limit: SqliteLimit) -> i32
Get the current value of a runtime limit for this connection.
See the SQLite documentation
for the meaning of each SqliteLimit.
§Example
use diesel::sqlite::SqliteLimit;
let conn = SqliteConnection::establish(":memory:").unwrap();
assert!(conn.get_limit(SqliteLimit::SqlLength) > 0);Sourcepub fn set_recommended_security_limits(&mut self)
pub fn set_recommended_security_limits(&mut self)
Apply SQLite’s recommended limits for hardening against untrusted SQL.
These are the values from the “Untrusted SQL Inputs” table of SQLite’s
security documentation. They are
intentionally restrictive, so call set_limit
afterwards to relax any that are too aggressive for your application.
| Limit | Value |
|---|---|
Length | 1,000,000 |
SqlLength | 100,000 |
ColumnCount | 100 |
ExprDepth | 10 |
CompoundSelect | 3 |
VdbeOp | 25,000 |
FunctionArg | 8 |
Attached | 0 |
LikePatternLength | 50 |
VariableNumber | 10 |
TriggerDepth | 10 |
The table’s PARSER_DEPTH recommendation is omitted because it is a
compile-time only setting with no runtime sqlite3_limit() category.
WorkerThreads is left untouched (its default of 0 is already safe).
§Example
use diesel::sqlite::SqliteLimit;
let mut conn = SqliteConnection::establish(":memory:").unwrap();
conn.set_recommended_security_limits();
assert_eq!(conn.get_limit(SqliteLimit::SqlLength), 100_000);
// Relax an individual limit that is too strict for this application.
conn.set_limit(SqliteLimit::VariableNumber, 999);
assert_eq!(conn.get_limit(SqliteLimit::VariableNumber), 999);Sourcepub fn set_defensive(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_defensive(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable SQLite defensive mode.
When enabled, defensive mode prevents direct writes to shadow tables
(FTS5, R-Tree, etc.), dangerous PRAGMAs like writable_schema,
sqlite3_deserialize() from opening unsafe database images, and other
potentially dangerous operations. Enable it for any connection that may
process untrusted data. It is the single most important hardening flag.
Requires SQLite 3.26.0 or later, otherwise returns an error.
§Security Hardening Recipe
conn.set_defensive(true).unwrap();
conn.set_trusted_schema(false).unwrap();
conn.set_recommended_security_limits();Extension loading is off by default. Enable it only when needed via
with_load_extension_enabled. See
set_recommended_security_limits
to harden the SQLite resource limits as well.
Sourcepub fn is_defensive(&self) -> QueryResult<bool>
pub fn is_defensive(&self) -> QueryResult<bool>
Check if defensive mode is enabled.
See set_defensive for details.
Sourcepub fn set_trusted_schema(&mut self, trusted: bool) -> QueryResult<()>
pub fn set_trusted_schema(&mut self, trusted: bool) -> QueryResult<()>
Enable or disable trusted schema mode.
When disabled (untrusted), SQL functions called from schema objects
(views, triggers, CHECK constraints, DEFAULT expressions, generated
columns, expression indexes) are restricted to those marked
INNOCUOUS. Disable
it when opening database files from untrusted sources, and register your
custom functions with appropriate
SqliteFunctionBehavior flags.
Requires SQLite 3.31.0 or later, otherwise returns an error.
Sourcepub fn is_trusted_schema(&self) -> QueryResult<bool>
pub fn is_trusted_schema(&self) -> QueryResult<bool>
Check if trusted schema mode is enabled.
See set_trusted_schema for details.
Sourcepub fn with_load_extension_enabled<R, E>(
&mut self,
f: impl FnOnce(&mut Self) -> Result<R, E>,
) -> Result<R, E>
pub fn with_load_extension_enabled<R, E>( &mut self, f: impl FnOnce(&mut Self) -> Result<R, E>, ) -> Result<R, E>
Runs the given closure with the load_extension() SQL function enabled,
disabling it again afterwards.
This controls the load_extension()
SQL function, not the sqlite3_load_extension() C API (which Diesel
does not expose). Extension loading is off by default, and scoping it to a
closure keeps the window in which it is enabled as small as possible.
Requires SQLite 3.13.0 or later, otherwise returns an error. Has no effect
if SQLite was compiled with SQLITE_OMIT_LOAD_EXTENSION.
§Panics
If f panics, extension loading is disabled again before the panic
resumes. no-std builds cannot catch the unwind, so there the flag is
restored only on a normal return.
§Example
let result: QueryResult<()> = conn.with_load_extension_enabled(|_conn| Ok(()));
result.unwrap();Sourcepub fn set_fts3_tokenizer_enabled(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_fts3_tokenizer_enabled(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable the fts3_tokenizer() SQL function.
The fts3_tokenizer() function
allows overloading the default FTS3/FTS4 tokenizer, which can be exploited
if an attacker can execute arbitrary SQL. Disable it unless you need custom
FTS3 tokenizers.
Requires SQLite 3.12.0 or later, otherwise returns an error.
Sourcepub fn is_fts3_tokenizer_enabled(&self) -> QueryResult<bool>
pub fn is_fts3_tokenizer_enabled(&self) -> QueryResult<bool>
Check if the fts3_tokenizer() SQL function is enabled.
See set_fts3_tokenizer_enabled for details.
Sourcepub fn set_writable_schema(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_writable_schema(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable direct writes to sqlite_master.
When enabled, allows direct modification of the sqlite_master table,
which can corrupt the database if misused. Keep it disabled unless you
need to repair or modify the schema directly. Defensive mode
(set_defensive) also prevents this.
Requires SQLite 3.28.0 or later, otherwise returns an error.
Sourcepub fn is_writable_schema(&self) -> QueryResult<bool>
pub fn is_writable_schema(&self) -> QueryResult<bool>
Check if direct writes to sqlite_master are enabled.
See set_writable_schema for details.
Sourcepub fn set_attach_create_enabled(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_attach_create_enabled(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable ATTACH from creating new database files.
When disabled, ATTACH can only
open existing database files, not create new ones. Disable it where
database file creation should be restricted.
Requires SQLite 3.49.0 or later, otherwise returns an error.
Sourcepub fn is_attach_create_enabled(&self) -> QueryResult<bool>
pub fn is_attach_create_enabled(&self) -> QueryResult<bool>
Check if ATTACH can create new database files.
See set_attach_create_enabled for details.
Sourcepub fn set_attach_write_enabled(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_attach_write_enabled(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable ATTACH from opening databases in write mode.
When disabled, all attached databases are opened as read-only. Disable it to restrict write access to attached databases.
Requires SQLite 3.49.0 or later, otherwise returns an error.
Sourcepub fn is_attach_write_enabled(&self) -> QueryResult<bool>
pub fn is_attach_write_enabled(&self) -> QueryResult<bool>
Check if ATTACH can open databases in write mode.
See set_attach_write_enabled for details.
Sourcepub fn set_triggers_enabled(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_triggers_enabled(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable trigger execution.
When disabled, triggers will not fire for any DML operations.
Requires SQLite 3.8.7 or later, otherwise returns an error.
Sourcepub fn are_triggers_enabled(&self) -> QueryResult<bool>
pub fn are_triggers_enabled(&self) -> QueryResult<bool>
Check if trigger execution is enabled.
See set_triggers_enabled for details.
Sourcepub fn set_views_enabled(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_views_enabled(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable view expansion.
When disabled, queries against views will fail.
Requires SQLite 3.30.0 or later, otherwise returns an error.
Sourcepub fn are_views_enabled(&self) -> QueryResult<bool>
pub fn are_views_enabled(&self) -> QueryResult<bool>
Check if view expansion is enabled.
See set_views_enabled for details.
Sourcepub fn set_foreign_keys_enabled(&mut self, enabled: bool) -> QueryResult<()>
pub fn set_foreign_keys_enabled(&mut self, enabled: bool) -> QueryResult<()>
Enable or disable foreign key constraint enforcement.
This is equivalent to PRAGMA foreign_keys = ON/OFF.
Requires SQLite 3.8.7 or later, otherwise returns an error.
Sourcepub fn are_foreign_keys_enabled(&self) -> QueryResult<bool>
pub fn are_foreign_keys_enabled(&self) -> QueryResult<bool>
Check if foreign key constraints are enabled.
See set_foreign_keys_enabled for details.
Sourcepub fn set_double_quoted_strings_dml(
&mut self,
enabled: bool,
) -> QueryResult<()>
pub fn set_double_quoted_strings_dml( &mut self, enabled: bool, ) -> QueryResult<()>
Enable or disable double-quoted strings in DML statements.
When enabled, double-quoted strings are interpreted as string literals rather than identifiers, a legacy behavior that can cause issues. Disable it for stricter SQL compliance.
Requires SQLite 3.29.0 or later, otherwise returns an error.
Sourcepub fn are_double_quoted_strings_dml_enabled(&self) -> QueryResult<bool>
pub fn are_double_quoted_strings_dml_enabled(&self) -> QueryResult<bool>
Check if double-quoted strings in DML are enabled.
See set_double_quoted_strings_dml for details.
Sourcepub fn set_double_quoted_strings_ddl(
&mut self,
enabled: bool,
) -> QueryResult<()>
pub fn set_double_quoted_strings_ddl( &mut self, enabled: bool, ) -> QueryResult<()>
Enable or disable double-quoted strings in DDL statements.
When enabled, double-quoted strings are interpreted as string literals rather than identifiers, a legacy behavior that can cause issues. Disable it for stricter SQL compliance.
Requires SQLite 3.29.0 or later, otherwise returns an error.
Sourcepub fn are_double_quoted_strings_ddl_enabled(&self) -> QueryResult<bool>
pub fn are_double_quoted_strings_ddl_enabled(&self) -> QueryResult<bool>
Check if double-quoted strings in DDL are enabled.
See set_double_quoted_strings_ddl for details.
Trait Implementations§
Source§impl Connection for SqliteConnection
impl Connection for SqliteConnection
Source§fn establish(database_url: &str) -> ConnectionResult<Self>
fn establish(database_url: &str) -> ConnectionResult<Self>
Establish a connection to the database specified by database_url.
See SqliteConnection for supported database_url.
If the database does not exist, this method will try to create a new database and then establish a connection to it.
§WASM support
If you plan to use this connection type on the wasm32-unknown-unknown target please
make sure to read the following notes:
- The database is stored in memory by default.
- Persistent VFS (Virtual File Systems) is optional, see https://github.com/Spxg/sqlite-wasm-rs for details
Source§type TransactionManager = AnsiTransactionManager
type TransactionManager = AnsiTransactionManager
Source§fn execute_returning_count<T>(&mut self, source: &T) -> QueryResult<usize>
fn execute_returning_count<T>(&mut self, source: &T) -> QueryResult<usize>
Source§fn transaction_state(&mut self) -> &mut AnsiTransactionManagerwhere
Self: Sized,
fn transaction_state(&mut self) -> &mut AnsiTransactionManagerwhere
Self: Sized,
Source§fn instrumentation(&mut self) -> &mut dyn Instrumentation
fn instrumentation(&mut self) -> &mut dyn Instrumentation
Source§fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)
fn set_instrumentation(&mut self, instrumentation: impl Instrumentation)
Instrumentation implementation for this connectionSource§fn set_prepared_statement_cache_size(&mut self, size: CacheSize)
fn set_prepared_statement_cache_size(&mut self, size: CacheSize)
CacheSize for this connectionSource§fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
fn transaction<T, E, F>(&mut self, f: F) -> Result<T, E>
Source§fn begin_test_transaction(&mut self) -> QueryResult<()>
fn begin_test_transaction(&mut self) -> QueryResult<()>
impl ConnectionSealed for SqliteConnection
Source§impl LoadConnection for SqliteConnection
impl LoadConnection for SqliteConnection
Source§type Cursor<'conn, 'query> = StatementIterator<'conn, 'query>
type Cursor<'conn, 'query> = StatementIterator<'conn, 'query>
LoadConnection::load Read moreSource§type Row<'conn, 'query> = SqliteRow<'conn, 'query>
type Row<'conn, 'query> = SqliteRow<'conn, 'query>
Iterator::Item for the iterator implementation
of LoadConnection::CursorSource§fn load<'conn, 'query, T>(
&'conn mut self,
source: T,
) -> QueryResult<Self::Cursor<'conn, 'query>>where
T: Query + QueryFragment<Self::Backend> + QueryId + 'query,
Self::Backend: QueryMetadata<T::SqlType>,
fn load<'conn, 'query, T>(
&'conn mut self,
source: T,
) -> QueryResult<Self::Cursor<'conn, 'query>>where
T: Query + QueryFragment<Self::Backend> + QueryId + 'query,
Self::Backend: QueryMetadata<T::SqlType>,
Source§impl<'query, V, T, QId, Op, O, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
(O, Self): LoadQuery<'query, SqliteConnection, U, B>,
impl<'query, V, T, QId, Op, O, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
(O, Self): LoadQuery<'query, SqliteConnection, U, B>,
Source§type RowIter<'conn> = <(O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>) as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
type RowIter<'conn> = <(O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>) as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
LoadQuery::internal_loadSource§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, Ret, O, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
(O, Self): LoadQuery<'query, SqliteConnection, U, B>,
impl<'query, V, T, QId, Op, Ret, O, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
(O, Self): LoadQuery<'query, SqliteConnection, U, B>,
Source§type RowIter<'conn> = <(O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>) as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
type RowIter<'conn> = <(O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>) as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
LoadQuery::internal_loadSource§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>)where
T: Table + Copy + QueryId + 'static,
Op: Copy + QueryId + QueryFragment<Sqlite>,
InsertStatement<T, ValuesClause<V, T>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>)where
T: Table + Copy + QueryId + 'static,
Op: Copy + QueryId + QueryFragment<Sqlite>,
InsertStatement<T, ValuesClause<V, T>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, Ret, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>)where
T: Table + Copy + QueryId + 'static,
Op: Copy + QueryId + QueryFragment<Sqlite>,
ReturningClause<Ret>: Copy,
InsertStatement<T, ValuesClause<V, T>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, Ret, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>)where
T: Table + Copy + QueryId + 'static,
Op: Copy + QueryId + QueryFragment<Sqlite>,
ReturningClause<Ret>: Copy,
InsertStatement<T, ValuesClause<V, T>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>)where
T: Table + Copy + QueryId + 'static,
T::FromClause: Copy,
Op: Copy,
Target: Copy,
ConflictOpt: Copy,
InsertStatement<T, OnConflictValues<ValuesClause<V, T>, Target, ConflictOpt>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>)where
T: Table + Copy + QueryId + 'static,
T::FromClause: Copy,
Op: Copy,
Target: Copy,
ConflictOpt: Copy,
InsertStatement<T, OnConflictValues<ValuesClause<V, T>, Target, ConflictOpt>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, Ret, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>)where
T: Table + Copy + QueryId + 'static,
T::FromClause: Copy,
Op: Copy,
ReturningClause<Ret>: Copy,
Target: Copy,
ConflictOpt: Copy,
InsertStatement<T, OnConflictValues<ValuesClause<V, T>, Target, ConflictOpt>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, Ret, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (Yes, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>)where
T: Table + Copy + QueryId + 'static,
T::FromClause: Copy,
Op: Copy,
ReturningClause<Ret>: Copy,
Target: Copy,
ConflictOpt: Copy,
InsertStatement<T, OnConflictValues<ValuesClause<V, T>, Target, ConflictOpt>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, BatchInsert<V, T, QId, STATIC_QUERY_ID>, Op>)where
T: Table + QueryId + 'static,
InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, BatchInsert<V, T, QId, STATIC_QUERY_ID>, Op>)where
T: Table + QueryId + 'static,
InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§type RowIter<'conn> = <InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
type RowIter<'conn> = <InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
LoadQuery::internal_loadSource§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, Ret, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, BatchInsert<V, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>)where
T: Table + QueryId + 'static,
InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, Ret, U, B, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, BatchInsert<V, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>)where
T: Table + QueryId + 'static,
InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§type RowIter<'conn> = <InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
type RowIter<'conn> = <InsertStatement<T, SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
LoadQuery::internal_loadSource§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, OnConflictValues<BatchInsert<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>)where
T: Table + QueryId + 'static,
InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, OnConflictValues<BatchInsert<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>)where
T: Table + QueryId + 'static,
InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§type RowIter<'conn> = <InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
type RowIter<'conn> = <InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
LoadQuery::internal_loadSource§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl<'query, V, T, QId, Op, Ret, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, OnConflictValues<BatchInsert<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>)where
T: Table + QueryId + 'static,
InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
impl<'query, V, T, QId, Op, Ret, U, B, Target, ConflictOpt, const STATIC_QUERY_ID: bool> LoadQuery<'query, SqliteConnection, U, B> for (No, InsertStatement<T, OnConflictValues<BatchInsert<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>)where
T: Table + QueryId + 'static,
InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>: LoadQuery<'query, SqliteConnection, U, B>,
Self: RunQueryDsl<SqliteConnection>,
Source§type RowIter<'conn> = <InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
type RowIter<'conn> = <InsertStatement<T, OnConflictValues<SqliteBatchInsertWrapper<V, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>> as LoadQuery<'query, SqliteConnection, U, B>>::RowIter<'conn>
LoadQuery::internal_loadSource§fn internal_load(
self,
conn: &mut SqliteConnection,
) -> QueryResult<Self::RowIter<'_>>
fn internal_load( self, conn: &mut SqliteConnection, ) -> QueryResult<Self::RowIter<'_>>
Source§impl MultiConnectionHelper for SqliteConnection
impl MultiConnectionHelper for SqliteConnection
Source§fn to_any<'a>(
lookup: &mut <Self::Backend as TypeMetadata>::MetadataLookup,
) -> &mut (dyn Any + 'a)
fn to_any<'a>( lookup: &mut <Self::Backend as TypeMetadata>::MetadataLookup, ) -> &mut (dyn Any + 'a)
i-implement-a-third-party-backend-and-opt-into-breaking-changes only.Source§fn from_any(
lookup: &mut dyn Any,
) -> Option<&mut <Self::Backend as TypeMetadata>::MetadataLookup>
fn from_any( lookup: &mut dyn Any, ) -> Option<&mut <Self::Backend as TypeMetadata>::MetadataLookup>
i-implement-a-third-party-backend-and-opt-into-breaking-changes only.Source§impl R2D2Connection for SqliteConnection
Available on crate feature r2d2 only.
impl R2D2Connection for SqliteConnection
r2d2 only.Source§impl<V, T, QId, Op, O, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>: RunQueryDsl<SqliteConnection>,
impl<V, T, QId, Op, O, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op>: RunQueryDsl<SqliteConnection>,
Source§fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
Source§fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Source§fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
Source§fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
Source§fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Vec with the affected rows. Read moreSource§impl<V, T, QId, Op, Ret, O, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>: RunQueryDsl<SqliteConnection>,
impl<V, T, QId, Op, Ret, O, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Op, ReturningClause<Ret>>: RunQueryDsl<SqliteConnection>,
Source§fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Source§fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
Source§fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
Source§fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Vec with the affected rows. Read moreSource§impl<V, T, QId, Op, O, Target, ConflictOpt, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>: RunQueryDsl<SqliteConnection>,
impl<V, T, QId, Op, O, Target, ConflictOpt, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op>: RunQueryDsl<SqliteConnection>,
Source§fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
Source§fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Source§fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
Source§fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
Source§fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Vec with the affected rows. Read moreSource§impl<V, T, QId, Op, Ret, O, Target, ConflictOpt, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>: RunQueryDsl<SqliteConnection>,
impl<V, T, QId, Op, Ret, O, Target, ConflictOpt, const STATIC_QUERY_ID: bool> RunQueryDsl<SqliteConnection> for (O, InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>)where
T: QuerySource,
V: ContainsDefaultableValue<Out = O>,
O: Default,
InsertStatement<T, OnConflictValues<BatchInsert<Vec<ValuesClause<V, T>>, T, QId, STATIC_QUERY_ID>, Target, ConflictOpt>, Op, ReturningClause<Ret>>: RunQueryDsl<SqliteConnection>,
Source§fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Source§fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
Source§fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
Source§fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Vec with the affected rows. Read moreimpl Send for SqliteConnection
Source§impl SimpleConnection for SqliteConnection
impl SimpleConnection for SqliteConnection
Source§fn batch_execute(&mut self, query: &str) -> QueryResult<()>
fn batch_execute(&mut self, query: &str) -> QueryResult<()>
Source§impl<'b, Changes, Output> UpdateAndFetchResults<Changes, Output> for SqliteConnectionwhere
Changes: Copy + Identifiable + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
Changes::Table: FindDsl<Changes::Id>,
Update<Changes, Changes>: ExecuteDsl<SqliteConnection>,
Find<Changes::Table, Changes::Id>: LoadQuery<'b, SqliteConnection, Output>,
<Changes::Table as Table>::AllColumns: ValidGrouping<()> + SelectableExpression<ReturningQuerySource<UpdateStmt, Changes::Table>>,
<<Changes::Table as Table>::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
impl<'b, Changes, Output> UpdateAndFetchResults<Changes, Output> for SqliteConnectionwhere
Changes: Copy + Identifiable + AsChangeset<Target = <Changes as HasTable>::Table> + IntoUpdateTarget,
Changes::Table: FindDsl<Changes::Id>,
Update<Changes, Changes>: ExecuteDsl<SqliteConnection>,
Find<Changes::Table, Changes::Id>: LoadQuery<'b, SqliteConnection, Output>,
<Changes::Table as Table>::AllColumns: ValidGrouping<()> + SelectableExpression<ReturningQuerySource<UpdateStmt, Changes::Table>>,
<<Changes::Table as Table>::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
Source§fn update_and_fetch(&mut self, changeset: Changes) -> QueryResult<Output>
fn update_and_fetch(&mut self, changeset: Changes) -> QueryResult<Output>
Source§impl WithMetadataLookup for SqliteConnection
impl WithMetadataLookup for SqliteConnection
Source§fn metadata_lookup(&mut self) -> &mut <Sqlite as TypeMetadata>::MetadataLookup
fn metadata_lookup(&mut self) -> &mut <Sqlite as TypeMetadata>::MetadataLookup
i-implement-a-third-party-backend-and-opt-into-breaking-changes only.Auto Trait Implementations§
impl !RefUnwindSafe for SqliteConnection
impl !Sync for SqliteConnection
impl !UnwindSafe for SqliteConnection
impl Freeze for SqliteConnection
impl Unpin for SqliteConnection
impl UnsafeUnpin for SqliteConnection
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> AggregateDistinct<Self>where
Self: DistinctDsl,
fn aggregate_distinct(self) -> AggregateDistinct<Self>where
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> AggregateAll<Self>where
Self: AllDsl,
fn aggregate_all(self) -> AggregateAll<Self>where
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> AggregateFilter<Self, P>
fn aggregate_filter<P>(self, f: P) -> AggregateFilter<Self, P>
Source§fn aggregate_order<O>(self, o: O) -> AggregateOrder<Self, O>where
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> AggregateOrder<Self, O>where
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> BoxableConnection<<C as Connection>::Backend> for Cwhere
C: Connection + Any,
impl<C> BoxableConnection<<C as Connection>::Backend> for Cwhere
C: Connection + Any,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.