pub struct ExecutionContext {
pub source_table: Arc<DataTable>,
pub temp_tables: TempTableRegistry,
pub variables: HashMap<String, String>,
}Expand description
Context for statement execution
Holds all state needed to execute SQL statements including:
- Base source table(s)
- Temporary tables (#table syntax)
- Variables (for future use)
- Execution configuration
Fields§
§source_table: Arc<DataTable>The primary source table (typically from CSV/JSON file)
temp_tables: TempTableRegistryRegistry of temporary tables created during script execution
variables: HashMap<String, String>Variables for template expansion and substitution
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn new(source_table: Arc<DataTable>) -> Self
pub fn new(source_table: Arc<DataTable>) -> Self
Create a new execution context with a source table
Sourcepub fn resolve_table(&self, name: &str) -> Arc<DataTable>
pub fn resolve_table(&self, name: &str) -> Arc<DataTable>
Sourcepub fn resolve_table_strict(&self, name: &str) -> Result<Arc<DataTable>>
pub fn resolve_table_strict(&self, name: &str) -> Result<Arc<DataTable>>
Try to resolve a table, returning an error if temp table not found
Sourcepub fn store_temp_table(
&mut self,
name: String,
table: Arc<DataTable>,
) -> Result<()>
pub fn store_temp_table( &mut self, name: String, table: Arc<DataTable>, ) -> Result<()>
Store a result as a temporary table
Sourcepub fn has_temp_table(&self, name: &str) -> bool
pub fn has_temp_table(&self, name: &str) -> bool
Check if a temporary table exists
Sourcepub fn temp_table_names(&self) -> Vec<String>
pub fn temp_table_names(&self) -> Vec<String>
Get all temporary table names
Sourcepub fn set_variable(&mut self, name: String, value: String)
pub fn set_variable(&mut self, name: String, value: String)
Set a variable for template expansion
Sourcepub fn get_variable(&self, name: &str) -> Option<&String>
pub fn get_variable(&self, name: &str) -> Option<&String>
Get a variable value
Sourcepub fn clear_temp_tables(&mut self)
pub fn clear_temp_tables(&mut self)
Clear all temporary tables (useful between script executions)
Sourcepub fn clear_variables(&mut self)
pub fn clear_variables(&mut self)
Clear all variables
Sourcepub fn source_table_info(&self) -> (String, usize, usize)
pub fn source_table_info(&self) -> (String, usize, usize)
Get source table metadata
Trait Implementations§
Source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
Source§fn clone(&self) -> ExecutionContext
fn clone(&self) -> ExecutionContext
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 ExecutionContext
impl RefUnwindSafe for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnwindSafe for ExecutionContext
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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