pub struct PkDeletePlan {
pub table_name: String,
pub pk_columns: Vec<String>,
pub param_to_pk_col: Vec<(usize, usize)>,
/* private fields */
}Expand description
Cached plan for primary key DELETE statements DELETE FROM table WHERE pk_col = ? [AND pk_col2 = ? …]
This plan bypasses:
- AST cloning during parameter binding
- Schema cloning during execution
- Re-checking the DELETE pattern on every execution
At execution time, we extract PK values directly from params and call delete_by_pk_fast.
Fields§
§table_name: StringTable name (normalized to uppercase for case-insensitive matching)
pk_columns: Vec<String>Primary key column names in order (for validation)
param_to_pk_col: Vec<(usize, usize)>Mapping from parameter index (0-based) to PK column index
e.g., for WHERE id = ?, this would be [(0, 0)]
Implementations§
Source§impl PkDeletePlan
impl PkDeletePlan
Sourcepub fn new(
table_name: String,
pk_columns: Vec<String>,
param_to_pk_col: Vec<(usize, usize)>,
) -> Self
pub fn new( table_name: String, pk_columns: Vec<String>, param_to_pk_col: Vec<(usize, usize)>, ) -> Self
Create a new PkDeletePlan
Sourcepub fn build_pk_values(&self, params: &[SqlValue]) -> Vec<SqlValue>
pub fn build_pk_values(&self, params: &[SqlValue]) -> Vec<SqlValue>
Build the PK values array from parameters
Sourcepub fn is_fast_path_valid(&self) -> Option<bool>
pub fn is_fast_path_valid(&self) -> Option<bool>
Get cached validation result, if available
Sourcepub fn set_fast_path_valid(&self, valid: bool) -> bool
pub fn set_fast_path_valid(&self, valid: bool) -> bool
Set validation result (can only be called once) Returns the cached value (either newly set or existing)
Trait Implementations§
Source§impl Clone for PkDeletePlan
impl Clone for PkDeletePlan
Source§fn clone(&self) -> PkDeletePlan
fn clone(&self) -> PkDeletePlan
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PkDeletePlan
impl RefUnwindSafe for PkDeletePlan
impl Send for PkDeletePlan
impl Sync for PkDeletePlan
impl Unpin for PkDeletePlan
impl UnwindSafe for PkDeletePlan
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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