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 functionsimpl IsFragment: good for returning from functions&impl IsFragment
Required Methods§
Sourcefn extend_text(&self, s: &mut String)
fn extend_text(&self, s: &mut String)
Extend s with the SQL text for this fragment
Sourcefn extend_params<'v, 'p: 'v>(&'p self, p: &mut Vec<DynToSql<'v>>)
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.
Sourcefn extend_locs(&self, la: &mut CodeLocationAccumulator)
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§
Sourcefn mk_sql_text(&self) -> String
fn mk_sql_text(&self) -> String
Returns the SQL text for this fragment as a String
Sourcefn mk_params(&self) -> Vec<&dyn ToSql>
fn mk_params(&self) -> Vec<&dyn ToSql>
Returns an owned Vec of references to the bind parameter values
Sourcefn mk_params_for_exec(&self, sql_text: &str) -> Vec<&dyn ToSql>
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.