Bsql

Trait Bsql 

Source
pub trait Bsql: Debug + Sync {
    // Required methods
    fn extend_text(&self, s: &mut String);
    fn extend_params<'v, 'p: 'v>(&'p self, p: &mut Vec<DynToSql<'v>>);
    fn extend_locs(&self, la: &mut CodeLocationAccumulator);

    // Provided methods
    fn mk_sql_text(&self) -> String { ... }
    fn mk_params(&self) -> Vec<&dyn ToSql> { ... }
    fn mk_params_for_exec(&self, sql_text: &str) -> Vec<&dyn ToSql> { ... }
}
Expand description

SQL text with its associated bind values

Useable as:

  • &dyn IsFragment: normally good for passing into functions
  • impl IsFragment: good for returning from functions
  • &impl IsFragment

Required Methods§

Source

fn extend_text(&self, s: &mut String)

Extend s with the SQL text for this fragment

Source

fn extend_params<'v, 'p: 'v>(&'p self, p: &mut Vec<DynToSql<'v>>)

Extend p with the bind parameter values for this fragment

§Lifetimes

We put elements with lifetime 'p into a vector of elements of a possibly-shorter lifetime 'v. That allows us to mix a variety of input lifetimes.

Source

fn extend_locs(&self, la: &mut CodeLocationAccumulator)

Extend la with the bsql macro call code locations

Builder from bsql! implements this nontrivially, and that means it catches every call to bsql!.

The helper types implement this as a no-op.

Provided Methods§

Source

fn mk_sql_text(&self) -> String

Returns the SQL text for this fragment as a String

Source

fn mk_params(&self) -> Vec<&dyn ToSql>

Returns an owned Vec of references to the bind parameter values

Source

fn mk_params_for_exec(&self, sql_text: &str) -> Vec<&dyn ToSql>

Gets ready to execute this statement

  • Notifies the coverage code that these fragments were executed.
  • Prints any necessary debugging output including the SQL statement.
  • Returns the parameter value vector as for mk_params.

Implementations on Foreign Types§

Source§

impl<'f, F: Bsql + ?Sized> Bsql for &'f F

Source§

fn extend_text(&self, s: &mut String)

Source§

fn extend_params<'v, 'p: 'v>(&'p self, p: &mut Vec<DynToSql<'v>>)

Source§

fn extend_locs(&self, la: &mut CodeLocationAccumulator)

Implementors§

Source§

impl Bsql for EmptyFragment

Source§

impl<F: Bsql> Bsql for Builder<F>

Source§

impl<F: Bsql, G: Bsql> Bsql for Concat<F, G>

Source§

impl<R: AsBsqlRow> Bsql for AsBsqlRowParams<'_, R>