Struct query_builder::InsertQuery [] [src]

pub struct InsertQuery<'a> {
    pub values: BTreeMap<&'a str, Value<'a>>,
    // some fields omitted
}

Struct representing an SQL Insert Statement

Creating a query that works requires at least to function calls.

Examples

use query_builder::{InsertQuery, Value};
 
// construct the InsertQuery to insert into table 'users'
let mut q = InsertQuery::into("users");
 
// add the value 'jonathan' to be added into the row 'name'
q.values.insert("name", Value::Varchar("jonathan"));
 
assert_eq!(q.as_string(), "INSERT INTO users(name) VALUES('jonathan')");

Fields

A map of the values to inserted into the table. The map is intended to be <row, value>

Methods

impl<'a> InsertQuery<'a>
[src]

[src]

Creates a new InsertQuery that puts data into table.

[src]

Returns a String that represents the InsertQuery in a valid SQL statement

Example

use query_builder::{Value, InsertQuery};

let mut q = InsertQuery::into("users");
q.values.insert("name", Value::Varchar("greg"));

assert_eq!(q.as_string(), "INSERT INTO users(name) VALUES('greg')")

Trait Implementations

impl<'a> Debug for InsertQuery<'a>
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a> Display for InsertQuery<'a>
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> Send for InsertQuery<'a>

impl<'a> Sync for InsertQuery<'a>