pub struct QueryEngine { /* private fields */ }Expand description
Query engine for executing SQL statements. Maintains separate ExecutionContexts per database for multi-tenancy. Now with disk persistence support for crash recovery.
Implementations§
Source§impl QueryEngine
impl QueryEngine
pub fn new() -> Self
Sourcepub fn with_persistence(data_dir: &Path) -> Self
pub fn with_persistence(data_dir: &Path) -> Self
Create a QueryEngine with persistence to the specified directory.
Sourcepub fn is_mutation(sql: &str) -> bool
pub fn is_mutation(sql: &str) -> bool
Check if a SQL statement is a mutation (DDL/DML that modifies data).
Sourcepub fn execute(
&self,
sql: &str,
database: Option<&str>,
) -> Result<QueryResult, QueryError>
pub fn execute( &self, sql: &str, database: Option<&str>, ) -> Result<QueryResult, QueryError>
Execute a SQL query against the specified database.
Supports multi-statement input with transaction control:
BEGIN; INSERT ...; INSERT ...; COMMIT; executes atomically.
On ROLLBACK (explicit or on error inside a transaction), all
changes since BEGIN are undone.
Sourcepub fn execute_with_params(
&self,
sql: &str,
database: Option<&str>,
params: &[Value],
) -> Result<QueryResult, QueryError>
pub fn execute_with_params( &self, sql: &str, database: Option<&str>, params: &[Value], ) -> Result<QueryResult, QueryError>
List all tables in the specified database. Execute a parameterized SQL query. Params are JSON values that replace $1, $2, … placeholders.
pub fn list_tables(&self, database: Option<&str>) -> Vec<String>
Sourcepub fn list_databases(&self) -> Vec<String>
pub fn list_databases(&self) -> Vec<String>
List all databases.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for QueryEngine
impl !RefUnwindSafe for QueryEngine
impl Send for QueryEngine
impl Sync for QueryEngine
impl Unpin for QueryEngine
impl UnsafeUnpin for QueryEngine
impl !UnwindSafe for QueryEngine
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> 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