pub fn rewrite_params(
sql: &str,
params: &[&dyn ToSqlValue],
) -> Result<(String, Vec<Value>), SqliteCompatError>Expand description
Rewrite OxiSQL-style $N positional placeholders to SQLite ? placeholders,
returning the reordered parameter list.
§Behaviour
$1,$2, … are replaced left-to-right with?.- Parameters inside single-quoted string literals (
'...') are preserved. - Double-quoted identifiers (
"...") are similarly skipped. - The returned
paramsvec is ordered by$Nindex (1-based), so$2, $1in the SQL results in[params[1], params[0]]in the output.
§Errors
Returns SqliteCompatError::TypeMap if a placeholder references a parameter
index that is out of range for the supplied params slice.