Struct query_builder::UpdateQuery [] [src]

pub struct UpdateQuery<'a, 'c> {
    pub set: BTreeMap<&'a str, Value<'c>>,
    pub whre: Vec<WhereClause<'a, 'c>>,
    // some fields omitted
}

Struct representing an SQL Update statement

Fields

A Map containing the field to set with the appropiate values to them

All WhereClauses for conditional Updating in this UpdateQuery

Methods

impl<'a, 'c> UpdateQuery<'a, 'c>
[src]

[src]

Returns a new UpdateQuery that updates the table table

Example

use query_builder::UpdateQuery;
 
let query = UpdateQuery::update("town");
 
assert_eq!(query.as_string(), "UPDATE town");

[src]

Set the limit of the Query to the value of l

Example

use query_builder::{UpdateQuery, Value};
 
let mut query = UpdateQuery::update("users");
// set the limit
query.limit(12);
 
// assert that the limit is actually there
assert_eq!(query.get_limit(), Some(12))

[src]

Returns whether or not the UpdateQuery has a limit

Example

use query_builder::UpdateQuery;
  
// create the query
let mut query = UpdateQuery::update("cities");
 
assert_eq!(query.has_limit(), false);
 
// set limit
query.limit(1);
assert_eq!(query.has_limit(), true);

[src]

Returns the limit of the UpdateQuery if there is one

Example

use query_builder::UpdateQuery;
// create the query
let mut query = UpdateQuery::update("countries");
 
assert_eq!(query.get_limit(), None);
 
// set the limit
query.limit(12);
assert_eq!(query.get_limit(), Some(12));

[src]

Returns the String representation of the UpdateQuery

Example

use query_builder::{UpdateQuery, Value};
 
let mut query = UpdateQuery::update("users");
 
query.set.insert("name", Value::Varchar("jeff")); 
query.limit(1);
 
assert_eq!(query.as_string(),"UPDATE users SET name = 'jeff' LIMIT 1");

Trait Implementations

impl<'a, 'c> Debug for UpdateQuery<'a, 'c>
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a, 'c> Display for UpdateQuery<'a, 'c>
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, 'c> Send for UpdateQuery<'a, 'c>

impl<'a, 'c> Sync for UpdateQuery<'a, 'c>