Skip to main content

MutableCommandPlan

Struct MutableCommandPlan 

Source
pub struct MutableCommandPlan { /* private fields */ }

Implementations§

Source§

impl MutableCommandPlan

Source

pub fn prune_subqueries( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Compact a mutation’s scalar-query arena using its existing source-then-expression namespace remapping. Command CTEs and retained source queries keep their independent owners.

Source§

impl MutableCommandPlan

Source

pub fn map_insert_target( self, index: usize, control: &ProductionControl<'_>, map: impl FnMut(OwnedScalarExpr, &ProductionControl<'_>) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>

Rewrite a selected INSERT target’s bounds without moving its column name or the other targets.

Source

pub fn map_assignment_value( self, slot: CommandAssignmentSlot, control: &ProductionControl<'_>, map: impl FnMut(OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>

Rewrite only the value of a selected assignment. Target bounds remain with their original execution boundary and are never visited by this operation.

Source

pub fn map_assignment( self, slot: CommandAssignmentSlot, control: &ProductionControl<'_>, map: impl FnMut(OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>

Rewrite every bound followed by the value of one assignment, preserving grouped-target order and admitting each replacement independently.

Source§

impl MutableCommandPlan

Source

pub fn map_assignment_columns( self, slot: CommandAssignmentSlot, control: &ProductionControl<'_>, map: impl FnMut(&str) -> Result<Produced<String>, SQLError>, ) -> Result<Self, SQLError>

Retarget names independently of assignment bounds and values.

Source§

impl MutableCommandPlan

Source

pub fn map_query_child( self, slot: CommandQuerySlot, control: &ProductionControl<'_>, map: impl FnOnce(MutableQueryPlan) -> Result<MutableQueryPlan, SQLError>, ) -> Result<Self, SQLError>

Source

pub fn map_query_child_with_parent( self, slot: CommandQuerySlot, control: &ProductionControl<'_>, map: impl FnOnce(&CommandPlan, MutableQueryPlan) -> Result<MutableQueryPlan, SQLError>, ) -> Result<Self, SQLError>

Rewrite a command-owned query while observing the command’s unchanged namespace. The selected query temporarily becomes empty in its original container.

Source

pub fn map_source( self, control: &ProductionControl<'_>, map: impl FnOnce(MutableSourcePlan) -> Result<MutableSourcePlan, SQLError>, ) -> Result<Self, SQLError>

Source

pub fn map_source_with_parent( self, control: &ProductionControl<'_>, map: impl FnOnce(&CommandPlan, MutableSourcePlan) -> Result<MutableSourcePlan, SQLError>, ) -> Result<Self, SQLError>

Rewrite UPDATE/DELETE/MERGE’s source without copying its command-owned box or scalar siblings.

Source§

impl MutableCommandPlan

Source

pub fn finish_inference_columns( self, control: &ProductionControl<'_>, ) -> Result<Produced<CommandPlan>, SQLError>

Finish inference normalization after all expression edits. Existing names retain their order; newly simple columns follow in expression order, including duplicates.

Source§

impl MutableCommandPlan

Source

pub fn set_explain_parameters( self, parameters: Option<Produced<Vec<SQLParam>>>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Replace only EXPLAIN’s inferred parameter owner after its body analysis succeeds.

Source

pub fn map_executable_body( self, control: &ProductionControl<'_>, map: impl FnOnce(MutableExecutablePlan) -> Result<MutableExecutablePlan, SQLError>, ) -> Result<Self, SQLError>

Rewrite EXPLAIN or PREPARE’s complete nested statement without moving its wrapper metadata or changing the query/command variant.

Source§

impl MutableCommandPlan

Source

pub fn map_source_input( self, control: &ProductionControl<'_>, map: impl FnOnce(Option<MutableSourcePlan>) -> Result<Option<MutableSourcePlan>, SQLError>, ) -> Result<Self, SQLError>

Edit an UPDATE/DELETE input, including installation where no FROM/USING clause existed. A retained source reuses its original command-owned box.

Source

pub fn map_predicate_input( self, control: &ProductionControl<'_>, map: impl FnOnce(Option<OwnedScalarExpr>, &mut ScalarQueryArena) -> Result<Option<OwnedScalarExpr>, SQLError>, ) -> Result<Self, SQLError>

Edit a possibly absent qualification together with its original scalar-query namespace. The callback owns the detached scalar; new query occurrences are admitted by the arena before attachment.

Source§

impl MutableCommandPlan

Source

pub fn map_insert_source( self, control: &ProductionControl<'_>, map: impl FnOnce(&InsertPlan, Option<MutableQueryPlan>) -> Result<MutableQueryPlan, SQLError>, ) -> Result<Self, SQLError>

Source

pub fn set_implicit_insert_columns<'a>( self, names: impl ExactSizeIterator<Item = &'a str>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn set_rule_values_input( self, input: Produced<RuleValuesInput>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn retain_insert_columns( self, control: &ProductionControl<'_>, keep: impl FnMut(usize, &AssignmentTarget<ScalarExpr>) -> Result<bool, SQLError>, ) -> Result<Self, SQLError>

Keep selected target columns in their original buffer, moving each indirection owner with its name and retiring only removed payloads.

Source

pub fn take_insert_rows_query( self, control: &ProductionControl<'_>, ) -> Result<(Self, MutableQueryPlan), SQLError>

VALUES leave the command without a payload copy. The command retains its own scalar-query namespace for RETURNING and assignment targets; the new query admits its independent namespace copy.

Source§

impl MutableCommandPlan

Source

pub fn set_target_privilege_subject( self, subject: Produced<RoleReference>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn retarget_mutation( self, target: Produced<String>, include_descendants: bool, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn clear_mutation_ctes( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn record_view_rule_relation( self, relation: &str, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn preserve_view_rule_returning( self, relation: &str, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source§

impl MutableCommandPlan

Source§

impl MutableCommandPlan

Source

pub fn replace_returning_alias( self, index: usize, alias: Option<Produced<String>>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source§

impl MutableCommandPlan

Source

pub fn map_returning_inputs<I: ExactSizeIterator<Item = OwnedProjection>>( self, control: &ProductionControl<'_>, map: impl FnOnce(&CommandPlan, OwnedProjectionIter, &mut ScalarQueryArena) -> Result<I, SQLError>, ) -> Result<Self, SQLError>

Rewrite RETURNING projections and append embedded queries to the same admitted arena.

Source§

impl MutableCommandPlan

Source

pub fn discard_rule_rows( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Remove a suppressed mutation’s row source and query dependencies while retaining the capacities of cleared inline vectors.

Source

pub fn prune_rule_assignments( self, required: &dyn Fn(&str) -> bool, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Split wholly unused grouped assignments into their surviving single target descriptors and replace every discarded bound/value with NULL.

Source§

impl MutableCommandPlan

Source

pub fn transform_scalar_nodes( self, control: &ProductionControl<'_>, transform: &mut ScalarNodeTransform<'_>, ) -> Result<Self, SQLError>

Source§

impl MutableCommandPlan

Source

pub fn map_insert_column( self, index: usize, control: &ProductionControl<'_>, map: impl FnMut(&str) -> Result<Produced<String>, SQLError>, ) -> Result<Self, SQLError>

Source

pub fn map_merge_insert_column( self, clause: usize, index: usize, control: &ProductionControl<'_>, map: impl FnMut(&str) -> Result<Produced<String>, SQLError>, ) -> Result<Self, SQLError>

Source

pub fn set_implicit_merge_columns<'a>( self, clause: usize, names: impl ExactSizeIterator<Item = &'a str>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn map_conflict_columns( self, control: &ProductionControl<'_>, map: impl FnMut(&str) -> Result<Produced<String>, SQLError>, ) -> Result<Self, SQLError>

Source§

impl MutableCommandPlan

Source

pub fn prepend_view_check( self, view: Produced<String>, control: &ProductionControl<'_>, predicate: impl FnOnce(&mut ScalarQueryArena) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>

Source

pub fn record_view_update_inputs( self, relation: &str, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn finalize_view_update_inputs( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn record_view_insert_inputs( self, relation: &str, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source

pub fn finalize_view_insert_inputs( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Source§

impl MutableCommandPlan

Source

pub fn reserved_bytes(&self) -> usize

Source

pub fn map_scalar( self, slot: CommandScalarSlot, control: &ProductionControl<'_>, map: impl FnOnce(OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>

Rewrite one scalar root without changing the statement’s other inputs or its diagnostic order.

Source

pub fn map_query_body( self, control: &ProductionControl<'_>, map: impl FnOnce(MutableQueryPlan) -> Result<MutableQueryPlan, SQLError>, ) -> Result<Self, SQLError>

Rewrite a retained query body while preserving its original enclosing box. EXPLAIN option interpretation and utility execution remain with their existing owners.

Source

pub fn finish( self, control: &ProductionControl<'_>, ) -> Result<Produced<CommandPlan>, SQLError>

Source§

impl MutableCommandPlan

Source

pub fn map_cte( self, index: usize, control: &ProductionControl<'_>, map: impl FnOnce(MutableExecutablePlan) -> Result<MutableExecutablePlan, SQLError>, ) -> Result<Self, SQLError>

Rewrite a data-modifying command’s CTE without copying its declaration or enclosing box.

Source§

impl MutableCommandPlan

Source

pub fn map_queries_while( self, control: &ProductionControl<'_>, visit: &mut (dyn FnMut(MutableQueryPlan) -> Result<(MutableQueryPlan, bool), SQLError> + '_), ) -> Result<Self, SQLError>

Source§

impl MutableCommandPlan

Source

pub fn normalize_window_definitions( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>

Methods from Deref<Target = CommandPlan>§

Source

pub fn ctes(&self) -> &[CtePlan]

WITH definitions owned by this command, in declaration order.

Source

pub fn query_inputs(&self) -> impl Iterator<Item = &QueryPlan>

Borrow query children evaluated in the command’s WITH scope without collecting a child list. INSERT’s source precedes the scalar-query arena. Source-plan subqueries are owned by source_input; visitors should not traverse either owner twice.

Source

pub fn source_input(&self) -> Option<&SourcePlan>

Source

pub fn mutation_target(&self) -> Option<&str>

Source

pub fn returning(&self) -> Option<&[ProjectionPlan]>

Source

pub fn scalar_subqueries(&self) -> &[QueryPlan]

Source

pub fn target_qualifier(&self) -> Option<&str>

Source

pub fn returning_aliases(&self) -> Option<&ReturningAliases>

Source

pub fn expressions(&self) -> impl Iterator<Item = &ScalarExpr>

Scalar roots owned by this mutation, excluding its relational children.

Source

pub fn copy_for_rewrite( &self, control: &ProductionControl<'_>, ) -> Result<MutableCommandPlan, SQLError>

Copy complete command syntax while retaining independently replaceable executable fields. Utility syntax remains with this command owner and is not evaluated by copying.

Source

pub fn name(&self) -> &'static str

Source

pub fn visit_scalar_expressions(&self, visit: &mut dyn FnMut(&ScalarExpr))

Visit scalar roots without copying the plan or collecting its children. Mutations retain their analysis order: CTEs, direct expressions, query inputs, then source inputs. Query-bearing utilities share the scalar rewrite’s ownership boundary.

Source

pub fn try_visit_scalar_expressions<'a, E>( &'a self, visit: &mut dyn FnMut(&'a ScalarExpr) -> Result<(), E>, ) -> Result<(), E>

Stop at the first callback error, without copying syntax or visiting later inputs.

Trait Implementations§

Source§

impl Debug for MutableCommandPlan

Source§

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

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

impl Deref for MutableCommandPlan

Source§

type Target = CommandPlan

The resulting type after dereferencing.
Source§

fn deref(&self) -> &CommandPlan

Dereferences the value.

Auto Trait Implementations§

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> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.