pub struct QuerySql {
pub stmt: Statement,
pub params: Vec<TypedValue>,
pub ret: Option<Vec<Type>>,
pub last_insert_id_hack: Option<u64>,
}Expand description
Executes a SQL statement against the database.
Only sent to SQL-capable drivers (those with Capability::sql
set to true). The statement is a fully lowered stmt::Statement that
the SQL serialization layer converts into a backend-specific SQL string.
§Examples
use toasty_core::driver::operation::{QuerySql, Operation};
let op = QuerySql {
stmt: sql_statement,
ret: Some(vec![stmt::Type::String, stmt::Type::I64]),
last_insert_id_hack: None,
};
let operation: Operation = op.into();
assert!(operation.is_query_sql());Fields§
§stmt: StatementThe SQL statement to execute. Scalar values that should be sent as
bind parameters have been replaced with Expr::Arg(n) where n is
the index into params.
params: Vec<TypedValue>Typed bind parameters extracted from the statement. Each entry
corresponds to an Expr::Arg(n) placeholder in the statement.
ret: Option<Vec<Type>>The types of columns in the result set. When Some, the driver uses
these types to decode returned rows. When None, the statement does
not return rows (e.g., DELETE without RETURNING).
last_insert_id_hack: Option<u64>Temporary MySQL workaround for RETURNING from INSERT.
When set, the driver should fetch LAST_INSERT_ID() to simulate
RETURNING behavior for the specified number of inserted rows.
Non-MySQL drivers should assert this is None.