Struct query_builder::SelectQuery [] [src]

pub struct SelectQuery<'a, 'c> {
    pub whre: Vec<WhereClause<'a, 'c>>,
    // some fields omitted
}

Struct representing a SQL-INSERT Query A simple query to select everything from a table can be created like this:

Example

use query_builder::SelectQuery;

// create the query
let query = SelectQuery::select(&["*"]).from("users");

// make sure it looks like you would expect it to look
assert_eq!(query.as_string(), "SELECT * FROM users");

Fields

Methods

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

[src]

Creates a new SelectQuery that selects data from the row/s rows

[src]

Sets the table to select from to the value of t

Example

use query_builder::SelectQuery;

let q = SelectQuery::select(&["user"]).from("users");

assert_eq!(q.as_string(), "SELECT user FROM users")

[src]

Sets the limit value of the Query to the value of l

Example

use query_builder::SelectQuery;

let mut q = SelectQuery::select(&["user"]).from("users");
q.limit(12);

assert_eq!(q.as_string(), "SELECT user FROM users LIMIT 12")

[src]

Return whether or not the SelectQuery has a limit

Example

use query_builder::SelectQuery;

let mut q = SelectQuery::select(&["user"]).from("users");
q.limit(12);
 
assert!(q.has_limit());
 
q.clear_limit();
assert!(!q.has_limit());

[src]

Returns the value of the Limit of the SelectQuery if there is one

Example

use query_builder::SelectQuery;
 
let mut q = SelectQuery::select(&["user"]).from("users");
assert_eq!(q.get_limit(), None);
 
q.limit(12);
assert_eq!(q.get_limit(), Some(12));

[src]

Removes the limit from the query

Example

use query_builder::SelectQuery;

let mut q = SelectQuery::select(&["user"]).from("users");
 
// set the limit
q.limit(42);
assert_eq!(q.as_string(), "SELECT user FROM users LIMIT 42");

// clear limit
q.clear_limit();
 
assert_eq!(q.as_string(), "SELECT user FROM users");

[src]

Adds a ORDER BY clause to the query

[src]

Creates the string representation of the query

Example

use query_builder::SelectQuery;

let mut q = SelectQuery::select(&["*"]).from("users");

assert_eq!(q.as_string(), "SELECT * FROM users")

Trait Implementations

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

[src]

Formats the value using the given formatter. Read more

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

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

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

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