Struct query_builder::WhereClause
[−]
[src]
pub struct WhereClause<'a, 'b> { /* fields omitted */ }
Struct representing an WHERE-Clause
Methods
impl<'a, 'b> WhereClause<'a, 'b>
[src]
pub fn new(
table: &'a str,
cond: Value<'b>,
how: Option<Condition>
) -> WhereClause<'a, 'b>
[src]
table: &'a str,
cond: Value<'b>,
how: Option<Condition>
) -> WhereClause<'a, 'b>
Creates a new WHERE-clause
If the Value of how
is none when initializing the clause, Condition::And
is assumed and used for the clause.
Note: If the WhereClause
is the first one to be inserted in the string of an query,
the condition will be left out.
pub fn as_string(&self) -> String
[src]
Returns a String
representing the WhereClause
with it's condition part
The returned String
is also the default representation returned when calling the
Display
trait functions on this struct.
Example
use query_builder::{WhereClause, Condition, Value}; let wclause = WhereClause::new("user", Value::Varchar("gerald"), Some(Condition::Or)); assert_eq!(wclause.as_string(), "OR user = 'gerald'")
pub fn as_string_no_cond_with_prefix(&self) -> String
[src]
Returns a String
representing the WhereClause
without it's condition part
but with the WHERE
phrase in the beginning
Example
use query_builder::{WhereClause, Value}; let clause = WhereClause::new("user", Value::Varchar("thomas"), None); assert_eq!(clause.as_string_no_cond_with_prefix(), "WHERE user = 'thomas'")
pub fn as_string_no_cond(&self) -> String
[src]
Returns a String
representing the WhereClause
without WHERE
prefix and
without it's conditional parts
Example
use query_builder::{WhereClause, Value}; let clause = WhereClause::new("user", Value::Varchar("jeanny"), None); assert_eq!(clause.as_string_no_cond(), "user = 'jeanny'")
Trait Implementations
impl<'a, 'b> Debug for WhereClause<'a, 'b>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a, 'b> Display for WhereClause<'a, 'b>
[src]
fn fmt(&self, f: &mut Formatter) -> FormatResult
[src]
Formats the value using the given formatter. Read more