#[non_exhaustive]pub enum SqliteLimit {
Length,
SqlLength,
ColumnCount,
ExprDepth,
CompoundSelect,
VdbeOp,
FunctionArg,
Attached,
LikePatternLength,
VariableNumber,
TriggerDepth,
WorkerThreads,
}__sqlite-shared only.Expand description
SQLite resource limits that can be configured per-connection.
These control aspects of SQLite’s behavior and can be used to prevent resource exhaustion or limit query complexity.
Each variant exposes two associated constants: DEFAULT_*_LIMIT (SQLite’s
documented default) and SAFE_*_LIMIT (the hardened value applied by
SqliteConnection::set_recommended_security_limits).
A connection’s actual runtime default can differ from DEFAULT_*_LIMIT
because some builds raise the compile-time maximum (for example the bundled
libsqlite3-sys raises FunctionArg and VariableNumber).
See the SQLite documentation for details.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Length
Maximum length of any string or BLOB or table row, in bytes.
See DEFAULT_LENGTH_LIMIT and
SAFE_LENGTH_LIMIT.
SqlLength
Maximum length of an SQL statement, in bytes.
ColumnCount
Maximum number of columns in a table definition, result set, or index, and also the maximum number of columns in the ORDER BY or GROUP BY clauses.
ExprDepth
Maximum depth of the parse tree for any expression.
This can help prevent stack overflow from deeply nested expressions.
CompoundSelect
Maximum number of terms in a compound SELECT statement.
See DEFAULT_COMPOUND_SELECT_LIMIT
and SAFE_COMPOUND_SELECT_LIMIT.
VdbeOp
Maximum number of instructions in a virtual machine program used to implement an SQL statement.
If sqlite3_prepare_v2()
or the equivalent tries to allocate space for more than this many
opcodes in a single prepared statement, an SQLITE_NOMEM error is
returned.
See DEFAULT_VDBE_OP_LIMIT and
SAFE_VDBE_OP_LIMIT.
FunctionArg
Maximum number of arguments on a function.
Attached
Maximum number of attached databases.
LikePatternLength
Maximum length of the pattern argument to the
LIKE or
GLOB operators.
See DEFAULT_LIKE_PATTERN_LENGTH_LIMIT
and SAFE_LIKE_PATTERN_LENGTH_LIMIT.
VariableNumber
Maximum index number of any parameter in an SQL statement.
See DEFAULT_VARIABLE_NUMBER_LIMIT
and SAFE_VARIABLE_NUMBER_LIMIT.
TriggerDepth
Maximum recursion depth of triggers.
See DEFAULT_TRIGGER_DEPTH_LIMIT and
SAFE_TRIGGER_DEPTH_LIMIT.
WorkerThreads
Maximum number of auxiliary worker threads that a single prepared statement may start.
See DEFAULT_WORKER_THREADS_LIMIT
and SAFE_WORKER_THREADS_LIMIT.
Implementations§
Source§impl SqliteLimit
impl SqliteLimit
Sourcepub const DEFAULT_LENGTH_LIMIT: i32 = 1_000_000_000
pub const DEFAULT_LENGTH_LIMIT: i32 = 1_000_000_000
SQLite’s default for Length.
Sourcepub const SAFE_LENGTH_LIMIT: i32 = 1_000_000
pub const SAFE_LENGTH_LIMIT: i32 = 1_000_000
Hardened value for Length.
Sourcepub const DEFAULT_SQL_LENGTH_LIMIT: i32 = 1_000_000_000
pub const DEFAULT_SQL_LENGTH_LIMIT: i32 = 1_000_000_000
SQLite’s default for SqlLength.
Sourcepub const SAFE_SQL_LENGTH_LIMIT: i32 = 100_000
pub const SAFE_SQL_LENGTH_LIMIT: i32 = 100_000
Hardened value for SqlLength.
Sourcepub const DEFAULT_COLUMN_COUNT_LIMIT: i32 = 2_000
pub const DEFAULT_COLUMN_COUNT_LIMIT: i32 = 2_000
SQLite’s default for ColumnCount.
Sourcepub const SAFE_COLUMN_COUNT_LIMIT: i32 = 100
pub const SAFE_COLUMN_COUNT_LIMIT: i32 = 100
Hardened value for ColumnCount.
Sourcepub const DEFAULT_EXPR_DEPTH_LIMIT: i32 = 1_000
pub const DEFAULT_EXPR_DEPTH_LIMIT: i32 = 1_000
SQLite’s default for ExprDepth.
Sourcepub const SAFE_EXPR_DEPTH_LIMIT: i32 = 10
pub const SAFE_EXPR_DEPTH_LIMIT: i32 = 10
Hardened value for ExprDepth.
Sourcepub const DEFAULT_COMPOUND_SELECT_LIMIT: i32 = 500
pub const DEFAULT_COMPOUND_SELECT_LIMIT: i32 = 500
SQLite’s default for CompoundSelect.
Sourcepub const SAFE_COMPOUND_SELECT_LIMIT: i32 = 3
pub const SAFE_COMPOUND_SELECT_LIMIT: i32 = 3
Hardened value for CompoundSelect.
Sourcepub const DEFAULT_VDBE_OP_LIMIT: i32 = 250_000_000
pub const DEFAULT_VDBE_OP_LIMIT: i32 = 250_000_000
SQLite’s default for VdbeOp.
Sourcepub const SAFE_VDBE_OP_LIMIT: i32 = 25_000
pub const SAFE_VDBE_OP_LIMIT: i32 = 25_000
Hardened value for VdbeOp.
Sourcepub const DEFAULT_FUNCTION_ARG_LIMIT: i32 = 127
pub const DEFAULT_FUNCTION_ARG_LIMIT: i32 = 127
SQLite’s default for FunctionArg.
Sourcepub const SAFE_FUNCTION_ARG_LIMIT: i32 = 8
pub const SAFE_FUNCTION_ARG_LIMIT: i32 = 8
Hardened value for FunctionArg.
Sourcepub const DEFAULT_ATTACHED_LIMIT: i32 = 10
pub const DEFAULT_ATTACHED_LIMIT: i32 = 10
SQLite’s default for Attached.
Sourcepub const SAFE_ATTACHED_LIMIT: i32 = 0
pub const SAFE_ATTACHED_LIMIT: i32 = 0
Hardened value for Attached.
Sourcepub const DEFAULT_LIKE_PATTERN_LENGTH_LIMIT: i32 = 50_000
pub const DEFAULT_LIKE_PATTERN_LENGTH_LIMIT: i32 = 50_000
SQLite’s default for LikePatternLength.
Sourcepub const SAFE_LIKE_PATTERN_LENGTH_LIMIT: i32 = 50
pub const SAFE_LIKE_PATTERN_LENGTH_LIMIT: i32 = 50
Hardened value for LikePatternLength.
Sourcepub const DEFAULT_VARIABLE_NUMBER_LIMIT: i32 = 32_766
pub const DEFAULT_VARIABLE_NUMBER_LIMIT: i32 = 32_766
SQLite’s published default for VariableNumber.
A particular build may compile a different maximum. The default
libsqlite3-sys bundle sets SQLITE_MAX_VARIABLE_NUMBER=250000, so a
connection’s runtime default can exceed this published value.
Sourcepub const SAFE_VARIABLE_NUMBER_LIMIT: i32 = 10
pub const SAFE_VARIABLE_NUMBER_LIMIT: i32 = 10
Hardened value for VariableNumber.
Sourcepub const DEFAULT_TRIGGER_DEPTH_LIMIT: i32 = 1_000
pub const DEFAULT_TRIGGER_DEPTH_LIMIT: i32 = 1_000
SQLite’s default for TriggerDepth.
Sourcepub const SAFE_TRIGGER_DEPTH_LIMIT: i32 = 10
pub const SAFE_TRIGGER_DEPTH_LIMIT: i32 = 10
Hardened value for TriggerDepth.
Sourcepub const DEFAULT_WORKER_THREADS_LIMIT: i32 = 0
pub const DEFAULT_WORKER_THREADS_LIMIT: i32 = 0
SQLite’s default for WorkerThreads.
Sourcepub const SAFE_WORKER_THREADS_LIMIT: i32 = 0
pub const SAFE_WORKER_THREADS_LIMIT: i32 = 0
Hardened value for WorkerThreads, equal to its
default, so the recommended setter leaves it untouched.
Trait Implementations§
Source§impl Clone for SqliteLimit
impl Clone for SqliteLimit
Source§fn clone(&self) -> SqliteLimit
fn clone(&self) -> SqliteLimit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SqliteLimit
Source§impl Debug for SqliteLimit
impl Debug for SqliteLimit
impl Eq for SqliteLimit
Source§impl Hash for SqliteLimit
impl Hash for SqliteLimit
Source§impl PartialEq for SqliteLimit
impl PartialEq for SqliteLimit
Source§fn eq(&self, other: &SqliteLimit) -> bool
fn eq(&self, other: &SqliteLimit) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SqliteLimit
Auto Trait Implementations§
impl Freeze for SqliteLimit
impl RefUnwindSafe for SqliteLimit
impl Send for SqliteLimit
impl Sync for SqliteLimit
impl Unpin for SqliteLimit
impl UnsafeUnpin for SqliteLimit
impl UnwindSafe for SqliteLimit
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.