mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-18 23:54:19 +01:00
Store current offset and value positions on program builder to remap bound parameters
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::{
|
||||
cell::Cell,
|
||||
cmp::Ordering,
|
||||
num::NonZero,
|
||||
rc::{Rc, Weak},
|
||||
sync::Arc,
|
||||
};
|
||||
@@ -38,7 +39,8 @@ pub struct ProgramBuilder {
|
||||
pub parameters: Parameters,
|
||||
pub result_columns: Vec<ResultSetColumn>,
|
||||
pub table_references: Vec<TableReference>,
|
||||
// Index of the referenced insert value to maintain ordering of paramaterized values
|
||||
// Indexes of the referenced insert values to maintain ordering of paramaters
|
||||
pub param_positions: Option<Vec<(usize, NonZero<usize>)>>,
|
||||
pub current_col_idx: Option<usize>,
|
||||
}
|
||||
|
||||
@@ -97,6 +99,7 @@ impl ProgramBuilder {
|
||||
parameters: Parameters::new(),
|
||||
result_columns: Vec::new(),
|
||||
table_references: Vec::new(),
|
||||
param_positions: None,
|
||||
current_col_idx: None,
|
||||
}
|
||||
}
|
||||
@@ -110,6 +113,12 @@ impl ProgramBuilder {
|
||||
span
|
||||
}
|
||||
|
||||
pub fn set_param_remap(&mut self, remap: Option<Vec<NonZero<usize>>>) {
|
||||
if let Some(remap) = remap {
|
||||
self.parameters.set_remap(remap);
|
||||
}
|
||||
}
|
||||
|
||||
/// End the current constant span. The last instruction that was emitted is the last
|
||||
/// instruction in the span.
|
||||
pub fn constant_span_end(&mut self, span_idx: usize) {
|
||||
|
||||
Reference in New Issue
Block a user