Skip to main content

Op

Enum Op 

Source
pub enum Op {
Show 51 variants Integer { value: i64, dest: usize, }, Real { value: f64, dest: usize, }, Str { value: String, dest: usize, }, Blob { value: Vec<u8>, dest: usize, }, Null { dest: usize, }, Arith { op: BinaryOp, lhs: usize, rhs: usize, dest: usize, }, Bitwise { op: BinaryOp, lhs: usize, rhs: usize, dest: usize, }, Is { is: bool, lhs: usize, rhs: usize, dest: usize, la: Option<Affinity>, ra: Option<Affinity>, }, Truthy { want: bool, not: bool, operand: usize, dest: usize, }, Like { glob: bool, lhs: usize, rhs: usize, dest: usize, }, Json { as_text: bool, lhs: usize, rhs: usize, dest: usize, }, Func { name: String, arg_start: usize, arg_count: usize, dest: usize, }, Concat { lhs: usize, rhs: usize, dest: usize, }, Compare { op: BinaryOp, lhs: usize, rhs: usize, dest: usize, la: Option<Affinity>, ra: Option<Affinity>, coll: Collation, }, And { lhs: usize, rhs: usize, dest: usize, }, Or { lhs: usize, rhs: usize, dest: usize, }, Not { reg: usize, dest: usize, }, IsNull { reg: usize, negated: bool, dest: usize, }, Copy { src: usize, dest: usize, }, Cast { reg: usize, type_name: String, dest: usize, }, Goto { target: usize, }, IfFalse { reg: usize, target: usize, }, Rewind { target: usize, }, Column { col: usize, dest: usize, }, Next { target: usize, }, RewindC { cursor: usize, target: usize, }, ColumnC { cursor: usize, col: usize, dest: usize, }, NextC { cursor: usize, target: usize, }, NullRow { cursor: usize, }, MarkMatched { cursor: usize, }, IfMatched { cursor: usize, target: usize, }, DecrJumpZero { reg: usize, target: usize, }, IfPosDecr { reg: usize, target: usize, }, Negate { reg: usize, dest: usize, }, BitNot { reg: usize, dest: usize, }, ResultRow { start: usize, count: usize, }, DistinctCheck { start: usize, count: usize, target: usize, }, SorterInsert { row_start: usize, row_count: usize, key_start: usize, key_count: usize, }, SorterSort { keys: Vec<SortKey>, }, SorterRewind { target: usize, }, SorterRow { start: usize, count: usize, }, SorterNext { target: usize, }, AggStep { slot: usize, kind: AggKind, arg: Option<usize>, distinct: bool, filter: Option<usize>, order: Vec<AggOrderKey>, }, AggFinal { slot: usize, kind: AggKind, dest: usize, }, GroupStep { key_start: usize, key_count: usize, aggs: Vec<AggSpec>, }, GroupEmit { outputs: Vec<GroupOut>, agg_kinds: Vec<AggKind>, }, GroupFinalize { agg_kinds: Vec<AggKind>, target: usize, }, GroupKey { key: usize, dest: usize, }, GroupAgg { slot: usize, dest: usize, }, GroupNext { target: usize, }, Halt,
}
Expand description

One VDBE instruction. Registers are addressed by index into the register file.

Variants§

§

Integer

Load an integer constant into dest.

Fields

§value: i64
§dest: usize
§

Real

Load a real constant into dest.

Fields

§value: f64
§dest: usize
§

Str

Load a text constant into dest.

Fields

§value: String
§dest: usize
§

Blob

Load a blob constant into dest.

Fields

§value: Vec<u8>
§dest: usize
§

Null

Load NULL into dest.

Fields

§dest: usize
§

Arith

dest = lhs <op> rhs for an arithmetic BinaryOp (Add/Sub/Mul/Div/Mod).

Fields

§lhs: usize
§rhs: usize
§dest: usize
§

Bitwise

dest = lhs <op> rhs for a bitwise BinaryOp (BitAnd/BitOr/LShift/RShift), with SQLite’s NULL-yields-NULL semantics.

Fields

§lhs: usize
§rhs: usize
§dest: usize
§

Is

dest = lhs IS rhs (is true) or lhs IS NOT rhs (is false); treats NULL as comparable, always 1/0.

Fields

§is: bool
§lhs: usize
§rhs: usize
§dest: usize
§la: Option<Affinity>

Comparison affinities of the operands — IS/IS NOT apply the same pre-comparison affinity as =, then compare with NULL as comparable.

§

Truthy

dest = (truth(operand) == Some(want)) XOR not as 0/1 — the x IS [NOT] TRUE|FALSE truthiness test (a NULL operand is neither true nor false). want is the boolean operand; not selects the IS NOT form.

Fields

§want: bool
§not: bool
§operand: usize
§dest: usize
§

Like

dest = lhs LIKE rhs (glob false) or lhs GLOB rhs (glob true); NULL on either side yields NULL.

Fields

§glob: bool
§lhs: usize
§rhs: usize
§dest: usize
§

Json

dest = lhs -> rhs (as_text false) or lhs ->> rhs (as_text true): the JSON extraction operators.

Fields

§as_text: bool
§lhs: usize
§rhs: usize
§dest: usize
§

Func

dest = name(reg[arg_start], …, reg[arg_start+arg_count-1]): a pure, context-free scalar function call, evaluated by re-using the tree-walker’s func::eval_scalar over literal-reconstructed argument values.

Fields

§name: String
§arg_start: usize
§arg_count: usize
§dest: usize
§

Concat

dest = lhs || rhs (text concatenation).

Fields

§lhs: usize
§rhs: usize
§dest: usize
§

Compare

dest = lhs <op> rhs for a comparison BinaryOp (Eq/NotEq/Lt/…), with SQLite’s NULL-yields-NULL three-valued result (1/0/NULL). la/ra are the operands’ comparison affinities (from their source expressions), applied before comparing exactly as the tree-walker does.

Fields

§lhs: usize
§rhs: usize
§dest: usize
§coll: Collation

The comparison’s collating sequence (column-derived; BINARY default).

§

And

dest = lhs AND rhs (three-valued).

Fields

§lhs: usize
§rhs: usize
§dest: usize
§

Or

dest = lhs OR rhs (three-valued).

Fields

§lhs: usize
§rhs: usize
§dest: usize
§

Not

dest = NOT reg (three-valued; NULL stays NULL).

Fields

§reg: usize
§dest: usize
§

IsNull

dest = reg IS [NOT] NULL (1/0).

Fields

§reg: usize
§negated: bool
§dest: usize
§

Copy

Copy src into dest.

Fields

§src: usize
§dest: usize
§

Cast

dest = CAST(reg AS type_name).

Fields

§reg: usize
§type_name: String
§dest: usize
§

Goto

Unconditional jump to instruction index target.

Fields

§target: usize
§

IfFalse

Jump to target when reg is false or NULL (i.e. not true).

Fields

§reg: usize
§target: usize
§

Rewind

Position the table cursor at the first row; jump to target (the loop exit) when the table is empty.

Fields

§target: usize
§

Column

Load column col of the cursor’s current row into dest.

Fields

§col: usize
§dest: usize
§

Next

Advance the cursor; jump back to target (the loop body) if a row remains, else fall through.

Fields

§target: usize
§

RewindC

Multi-cursor Rewind (B5b nested-loop join): position cursor cursor at its first row; jump to target when that cursor’s row-set is empty.

Fields

§cursor: usize
§target: usize
§

ColumnC

Multi-cursor Column: load column col of cursor cursor’s current row.

Fields

§cursor: usize
§col: usize
§dest: usize
§

NextC

Multi-cursor Next: advance cursor cursor; jump back to target if a row remains, else fall through.

Fields

§cursor: usize
§target: usize
§

NullRow

Mark cursor cursor as the NULL row (LEFT JOIN null-padding): every subsequent ColumnC on it reads NULL until the next RewindC on that cursor clears the mark.

Fields

§cursor: usize
§

MarkMatched

FULL JOIN bookkeeping: record that cursor cursor’s current row has been matched, in a per-row bitmap that survives RewindC (unlike the NULL flag).

Fields

§cursor: usize
§

IfMatched

FULL JOIN anti-join pass: jump to target when cursor cursor’s current row was already marked matched (so it is skipped in the second pass).

Fields

§cursor: usize
§target: usize
§

DecrJumpZero

Decrement reg; jump to target once it reaches zero (a LIMIT counter).

Fields

§reg: usize
§target: usize
§

IfPosDecr

If reg is positive, decrement it and jump to target (an OFFSET skip).

Fields

§reg: usize
§target: usize
§

Negate

dest = -reg (numeric negation).

Fields

§reg: usize
§dest: usize
§

BitNot

dest = ~reg (bitwise NOT; NULL stays NULL).

Fields

§reg: usize
§dest: usize
§

ResultRow

Emit registers [start, start+count) as one output row.

Fields

§start: usize
§count: usize
§

DistinctCheck

DISTINCT gate: if the row in [start, start+count) was already seen, jump to target (skip it); otherwise record it and fall through.

Fields

§start: usize
§count: usize
§target: usize
§

SorterInsert

Append a row to the sorter: the output values in [row_start, row_start+ row_count) keyed by [key_start, key_start+key_count).

Fields

§row_start: usize
§row_count: usize
§key_start: usize
§key_count: usize
§

SorterSort

Sort the accumulated sorter rows by their keys (per keys, in order).

Fields

§keys: Vec<SortKey>
§

SorterRewind

Position the sorter cursor at the first sorted row; jump to target (the emit-loop exit) when the sorter is empty.

Fields

§target: usize
§

SorterRow

Load the current sorter row’s stored output values into [start, start+ count).

Fields

§start: usize
§count: usize
§

SorterNext

Advance the sorter cursor; jump back to target if a row remains.

Fields

§target: usize
§

AggStep

Fold the current row into aggregate slot: for CountStar bump the row counter, otherwise collect arg (when non-NULL). When distinct, a value equal (BINARY) to one already collected for this slot is skipped, so the slot folds only over distinct argument values. When filter is set, a row whose predicate register is not true (FILTER (WHERE …)) contributes to neither the count nor the collected values. When order is non-empty (group_concat(x ORDER BY …)), each collected value also records its ORDER BY key row so finalization can sort before concatenating.

Fields

§slot: usize
§kind: AggKind
§distinct: bool
§filter: Option<usize>
§

AggFinal

Finalize aggregate slot into dest.

Fields

§slot: usize
§kind: AggKind
§dest: usize
§

GroupStep

GROUP BY fold: find-or-create the group for the key in [key_start, key_start+key_count) (first-seen order, NULLs group together) and step each per-group aggregate.

Fields

§key_start: usize
§key_count: usize
§aggs: Vec<AggSpec>
§

GroupEmit

Emit one row per group (in first-seen order): each output is either a group-key value or a finalized per-group aggregate.

Fields

§outputs: Vec<GroupOut>
§agg_kinds: Vec<AggKind>
§

GroupFinalize

Finalize the accumulated groups (computing each slot’s value per group) into an emit list, then position the group cursor at the first group; jump to target (the emit-loop exit) when there are no groups. Used by the HAVING/ORDER BY grouped path, where each group’s keys and aggregates are loaded into registers so arbitrary predicates / sort keys can be computed by ordinary ops.

Fields

§agg_kinds: Vec<AggKind>
§target: usize
§

GroupKey

Load group-key value at index key of the current group into dest.

Fields

§key: usize
§dest: usize
§

GroupAgg

Load the finalized aggregate at slot of the current group into dest.

Fields

§slot: usize
§dest: usize
§

GroupNext

Advance the group cursor; jump back to target if a group remains.

Fields

§target: usize
§

Halt

Stop execution.

Trait Implementations§

Source§

impl Clone for Op

Source§

fn clone(&self) -> Op

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 Debug for Op

Source§

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

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

impl PartialEq for Op

Source§

fn eq(&self, other: &Op) -> 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 Op

Auto Trait Implementations§

§

impl Freeze for Op

§

impl RefUnwindSafe for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnsafeUnpin for Op

§

impl UnwindSafe for Op

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.