[][src]Struct diesel::query_builder::SqlQuery

#[must_use =
  "Queries are only executed when calling `load`, `get_result` or similar."]pub struct SqlQuery { /* fields omitted */ }

The return value of sql_query.

Unlike most queries in Diesel, SqlQuery loads its data by column name, rather than by index. This means that you cannot deserialize this query into a tuple, and any structs used must implement QueryableByName.

See sql_query for examples.


impl SqlQuery[src]

pub fn bind<ST, Value>(self, value: Value) -> UncheckedBind<Self, Value, ST>[src]

Bind a value for use with this SQL query.


This function should be used with care, as Diesel cannot validate that the value is of the right type nor can it validate that you have passed the correct number of parameters.


let users = sql_query("SELECT * FROM users WHERE id > ? AND name <> ?")
    .bind::<Integer, _>(1)
    .bind::<Text, _>("Tess")
let expected_users = vec![
    User { id: 3, name: "Jim".into() },
assert_eq!(Ok(expected_users), users);

Trait Implementations

impl Clone for SqlQuery[src]

impl Debug for SqlQuery[src]

impl<Conn, T> LoadQuery<Conn, T> for SqlQuery where
    Conn: Connection,
    T: QueryableByName<Conn::Backend>, 

impl<DB> QueryFragment<DB> for SqlQuery where
    DB: Backend

impl QueryId for SqlQuery[src]

type QueryId = ()

A type which uniquely represents Self in a SQL query. Read more

impl<Conn> RunQueryDsl<Conn> for SqlQuery[src]

Auto Trait Implementations

impl RefUnwindSafe for SqlQuery[src]

impl Send for SqlQuery[src]

impl Sync for SqlQuery[src]

impl Unpin for SqlQuery[src]

impl UnwindSafe for SqlQuery[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<Conn, DB, T> ExecuteDsl<Conn, DB> for T where
    DB: Backend,
    T: QueryFragment<DB> + QueryId,
    Conn: Connection<Backend = DB>, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> IntoSql for T[src]

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.