Skip to main content

SqliteLimit

Enum SqliteLimit 

Source
#[non_exhaustive]
pub enum SqliteLimit { Length, SqlLength, ColumnCount, ExprDepth, CompoundSelect, VdbeOp, FunctionArg, Attached, LikePatternLength, VariableNumber, TriggerDepth, WorkerThreads, }
Available on crate feature __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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

See DEFAULT_SQL_LENGTH_LIMIT and SAFE_SQL_LENGTH_LIMIT.

§

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.

See DEFAULT_COLUMN_COUNT_LIMIT and SAFE_COLUMN_COUNT_LIMIT.

§

ExprDepth

Maximum depth of the parse tree for any expression.

This can help prevent stack overflow from deeply nested expressions.

See DEFAULT_EXPR_DEPTH_LIMIT and SAFE_EXPR_DEPTH_LIMIT.

§

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.

See DEFAULT_FUNCTION_ARG_LIMIT and SAFE_FUNCTION_ARG_LIMIT.

§

Attached

Maximum number of attached databases.

See DEFAULT_ATTACHED_LIMIT and SAFE_ATTACHED_LIMIT.

§

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

Source

pub const DEFAULT_LENGTH_LIMIT: i32 = 1_000_000_000

SQLite’s default for Length.

Source

pub const SAFE_LENGTH_LIMIT: i32 = 1_000_000

Hardened value for Length.

Source

pub const DEFAULT_SQL_LENGTH_LIMIT: i32 = 1_000_000_000

SQLite’s default for SqlLength.

Source

pub const SAFE_SQL_LENGTH_LIMIT: i32 = 100_000

Hardened value for SqlLength.

Source

pub const DEFAULT_COLUMN_COUNT_LIMIT: i32 = 2_000

SQLite’s default for ColumnCount.

Source

pub const SAFE_COLUMN_COUNT_LIMIT: i32 = 100

Hardened value for ColumnCount.

Source

pub const DEFAULT_EXPR_DEPTH_LIMIT: i32 = 1_000

SQLite’s default for ExprDepth.

Source

pub const SAFE_EXPR_DEPTH_LIMIT: i32 = 10

Hardened value for ExprDepth.

Source

pub const DEFAULT_COMPOUND_SELECT_LIMIT: i32 = 500

SQLite’s default for CompoundSelect.

Source

pub const SAFE_COMPOUND_SELECT_LIMIT: i32 = 3

Hardened value for CompoundSelect.

Source

pub const DEFAULT_VDBE_OP_LIMIT: i32 = 250_000_000

SQLite’s default for VdbeOp.

Source

pub const SAFE_VDBE_OP_LIMIT: i32 = 25_000

Hardened value for VdbeOp.

Source

pub const DEFAULT_FUNCTION_ARG_LIMIT: i32 = 127

SQLite’s default for FunctionArg.

Source

pub const SAFE_FUNCTION_ARG_LIMIT: i32 = 8

Hardened value for FunctionArg.

Source

pub const DEFAULT_ATTACHED_LIMIT: i32 = 10

SQLite’s default for Attached.

Source

pub const SAFE_ATTACHED_LIMIT: i32 = 0

Hardened value for Attached.

Source

pub const DEFAULT_LIKE_PATTERN_LENGTH_LIMIT: i32 = 50_000

SQLite’s default for LikePatternLength.

Source

pub const SAFE_LIKE_PATTERN_LENGTH_LIMIT: i32 = 50

Hardened value for LikePatternLength.

Source

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.

Source

pub const SAFE_VARIABLE_NUMBER_LIMIT: i32 = 10

Hardened value for VariableNumber.

Source

pub const DEFAULT_TRIGGER_DEPTH_LIMIT: i32 = 1_000

SQLite’s default for TriggerDepth.

Source

pub const SAFE_TRIGGER_DEPTH_LIMIT: i32 = 10

Hardened value for TriggerDepth.

Source

pub const DEFAULT_WORKER_THREADS_LIMIT: i32 = 0

SQLite’s default for WorkerThreads.

Source

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

Source§

fn clone(&self) -> SqliteLimit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for SqliteLimit

Source§

impl Debug for SqliteLimit

Source§

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

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

impl Eq for SqliteLimit

Source§

impl Hash for SqliteLimit

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SqliteLimit

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for SqliteLimit

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> AggregateDistinct<Self>
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> AggregateAll<Self>
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> AggregateFilter<Self, P>
where P: AsExpression<Bool>, Self: FilterDsl<P::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> AggregateOrder<Self, O>
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

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

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
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> IntoSql for T

Source§

fn into_sql<T>(self) -> AsExprOf<Self, T>

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
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.
Source§

impl<T> WindowExpressionMethods for T

Source§

fn over(self) -> Over<Self>
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> WindowFilter<Self, P>
where P: AsExpression<Bool>, Self: FilterDsl<P::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> PartitionBy<Self, E>
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> WindowOrder<Self, E>
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> FrameBy<Self, E>
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more