pub struct ExecutionContext { /* private fields */ }Expand description
Context for query execution.
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
pub fn new() -> Self
pub fn with_batch_size(self, size: usize) -> Self
pub fn add_table(&mut self, table: TableData)
pub fn get_table(&self, name: &str) -> Option<Arc<RwLock<TableData>>>
pub fn batch_size(&self) -> usize
Sourcepub fn create_table(
&mut self,
name: String,
columns: Vec<ColumnSchema>,
primary_key: Option<Vec<String>>,
constraints: Vec<StoredConstraint>,
if_not_exists: bool,
) -> ExecutorResult<()>
pub fn create_table( &mut self, name: String, columns: Vec<ColumnSchema>, primary_key: Option<Vec<String>>, constraints: Vec<StoredConstraint>, if_not_exists: bool, ) -> ExecutorResult<()>
Create a new table.
Sourcepub fn drop_table(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
pub fn drop_table(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
Drop a table.
Sourcepub fn alter_table(
&mut self,
name: &str,
op: &PlanAlterOperation,
) -> ExecutorResult<()>
pub fn alter_table( &mut self, name: &str, op: &PlanAlterOperation, ) -> ExecutorResult<()>
Alter a table.
Sourcepub fn create_index(
&mut self,
name: String,
table: String,
columns: Vec<String>,
unique: bool,
if_not_exists: bool,
) -> ExecutorResult<()>
pub fn create_index( &mut self, name: String, table: String, columns: Vec<String>, unique: bool, if_not_exists: bool, ) -> ExecutorResult<()>
Create an index.
Sourcepub fn drop_index(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
pub fn drop_index(&mut self, name: &str, if_exists: bool) -> ExecutorResult<()>
Drop an index.
Sourcepub fn get_index_manager(&self, table: &str) -> Option<Arc<TableIndexManager>>
pub fn get_index_manager(&self, table: &str) -> Option<Arc<TableIndexManager>>
Get the index manager for a table.
Sourcepub fn get_indexes(&self, table: &str) -> Option<&Vec<IndexSchema>>
pub fn get_indexes(&self, table: &str) -> Option<&Vec<IndexSchema>>
Get index metadata for a table.
Sourcepub fn get_table_schema(&self, name: &str) -> Option<&TableSchema>
pub fn get_table_schema(&self, name: &str) -> Option<&TableSchema>
Get table schema.
Sourcepub fn list_tables(&self) -> Vec<String>
pub fn list_tables(&self) -> Vec<String>
List all table names.
Sourcepub fn to_snapshot(&self) -> ExecutionContextSnapshot
pub fn to_snapshot(&self) -> ExecutionContextSnapshot
Create a serializable snapshot of the execution context.
Sourcepub fn from_snapshot(snapshot: ExecutionContextSnapshot) -> Self
pub fn from_snapshot(snapshot: ExecutionContextSnapshot) -> Self
Restore execution context from a snapshot.
Sourcepub fn save_to_file(&self, path: &Path) -> Result<()>
pub fn save_to_file(&self, path: &Path) -> Result<()>
Save the execution context to a file.
Sourcepub fn load_from_file(path: &Path) -> Result<Self>
pub fn load_from_file(path: &Path) -> Result<Self>
Load the execution context from a file.
Sourcepub fn merge_from_file(&mut self, path: &Path) -> Result<()>
pub fn merge_from_file(&mut self, path: &Path) -> Result<()>
Merge data from a file into the current context (for loading on startup).
Sourcepub fn insert_rows(
&self,
table_name: &str,
columns: &[String],
rows: Vec<Vec<Value>>,
) -> ExecutorResult<u64>
pub fn insert_rows( &self, table_name: &str, columns: &[String], rows: Vec<Vec<Value>>, ) -> ExecutorResult<u64>
Insert rows into a table.
Sourcepub fn update_rows(
&self,
table_name: &str,
assignments: &[(String, Value)],
predicate: Option<&dyn Fn(&Row, &[String]) -> bool>,
) -> ExecutorResult<u64>
pub fn update_rows( &self, table_name: &str, assignments: &[(String, Value)], predicate: Option<&dyn Fn(&Row, &[String]) -> bool>, ) -> ExecutorResult<u64>
Update rows in a table.
Sourcepub fn delete_rows(
&self,
table_name: &str,
predicate: Option<&dyn Fn(&Row, &[String]) -> bool>,
) -> ExecutorResult<u64>
pub fn delete_rows( &self, table_name: &str, predicate: Option<&dyn Fn(&Row, &[String]) -> bool>, ) -> ExecutorResult<u64>
Delete rows from a table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExecutionContext
impl RefUnwindSafe for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnsafeUnpin 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