pub struct TranslatedSql {
pub sql: String,
pub ordered_params: Vec<String>,
}Expand description
Result of translating canonical :name placeholders into a dialect’s
positional form, plus the binding order needed to bind values positionally.
Per-backend execute() impls destructure this and iterate ordered_params
to bind driver-native positional parameters from the caller’s
&[(String, serde_json::Value)] named pairs.
§Example
use pmcp_server_toolkit::sql::{translate_placeholders, Dialect, TranslatedSql};
let translated: TranslatedSql =
translate_placeholders("SELECT :id FROM t", Dialect::Postgres);
assert_eq!(translated.sql, "SELECT $1 FROM t");
assert_eq!(translated.ordered_params, vec!["id".to_string()]);Fields§
§sql: StringThe SQL string with placeholders rewritten into the target dialect’s
positional form ($1/$2 for Postgres, ? for MySQL/Athena, :name
kept for SQLite).
ordered_params: Vec<String>Placeholder names in positional binding order. The Nth entry names the value that the Nth positional parameter should bind.
Trait Implementations§
Source§impl Clone for TranslatedSql
impl Clone for TranslatedSql
Source§fn clone(&self) -> TranslatedSql
fn clone(&self) -> TranslatedSql
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TranslatedSql
impl Debug for TranslatedSql
Source§impl PartialEq for TranslatedSql
impl PartialEq for TranslatedSql
Source§fn eq(&self, other: &TranslatedSql) -> bool
fn eq(&self, other: &TranslatedSql) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for TranslatedSql
impl StructuralPartialEq for TranslatedSql
Auto Trait Implementations§
impl Freeze for TranslatedSql
impl RefUnwindSafe for TranslatedSql
impl Send for TranslatedSql
impl Sync for TranslatedSql
impl Unpin for TranslatedSql
impl UnsafeUnpin for TranslatedSql
impl UnwindSafe for TranslatedSql
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreCreates a shared type from an unshared type.