Trait sqlx::Statement[][src]

pub trait Statement<'q>: Send + Sync {
    type Database: Database;
    pub fn to_owned(
        &self
    ) -> <Self::Database as HasStatement<'static>>::Statement;
pub fn sql(&self) -> &str;
pub fn parameters(
        &self
    ) -> Option<Either<&[<Self::Database as Database>::TypeInfo], usize>>;
pub fn columns(&self) -> &[<Self::Database as Database>::Column]β“˜

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
pub fn query(
        &self
    ) -> Query<'_, Self::Database, <Self::Database as HasArguments<'_>>::Arguments>;
pub fn query_with<'s, A>(
        &'s self,
        arguments: A
    ) -> Query<'s, Self::Database, A>
    where
        A: IntoArguments<'s, Self::Database>
;
pub fn query_as<O>(
        &self
    ) -> QueryAs<'_, Self::Database, O, <Self::Database as HasArguments<'_>>::Arguments>
    where
        O: for<'r> FromRow<'r, <Self::Database as Database>::Row>
;
pub fn query_as_with<'s, O, A>(
        &'s self,
        arguments: A
    ) -> QueryAs<'s, Self::Database, O, A>
    where
        A: IntoArguments<'s, Self::Database>,
        O: for<'r> FromRow<'r, <Self::Database as Database>::Row>
;
pub fn query_scalar<O>(
        &self
    ) -> QueryScalar<'_, Self::Database, O, <Self::Database as HasArguments<'_>>::Arguments>
    where
        (O,): for<'r> FromRow<'r, <Self::Database as Database>::Row>
;
pub fn query_scalar_with<'s, O, A>(
        &'s self,
        arguments: A
    ) -> QueryScalar<'s, Self::Database, O, A>
    where
        A: IntoArguments<'s, Self::Database>,
        (O,): for<'r> FromRow<'r, <Self::Database as Database>::Row>
; pub fn column<I>(&self, index: I) -> &<Self::Database as Database>::Column
    where
        I: ColumnIndex<Self>
, { ... }
pub fn try_column<I>(
        &self,
        index: I
    ) -> Result<&<Self::Database as Database>::Column, Error>
    where
        I: ColumnIndex<Self>
, { ... } }

An explicitly prepared statement.

Statements are prepared and cached by default, per connection. This type allows you to look at that cache in-between the statement being prepared and it being executed. This contains the expected columns to be returned and the expected parameter types (if available).

Statements can be re-used with any connection and on first-use it will be re-prepared and cached within the connection.

Associated Types

Loading content...

Required methods

pub fn to_owned(&self) -> <Self::Database as HasStatement<'static>>::Statement[src]

Creates an owned statement from this statement reference. This copies the original SQL text.

pub fn sql(&self) -> &str[src]

Get the original SQL text used to create this statement.

pub fn parameters(
    &self
) -> Option<Either<&[<Self::Database as Database>::TypeInfo], usize>>
[src]

Get the expected parameters for this statement.

The information returned depends on what is available from the driver. SQLite can only tell us the number of parameters. PostgreSQL can give us full type information.

pub fn columns(&self) -> &[<Self::Database as Database>::Column]β“˜

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Get the columns expected to be returned by executing this statement.

pub fn query(
    &self
) -> Query<'_, Self::Database, <Self::Database as HasArguments<'_>>::Arguments>
[src]

pub fn query_with<'s, A>(&'s self, arguments: A) -> Query<'s, Self::Database, A> where
    A: IntoArguments<'s, Self::Database>, 
[src]

pub fn query_as<O>(
    &self
) -> QueryAs<'_, Self::Database, O, <Self::Database as HasArguments<'_>>::Arguments> where
    O: for<'r> FromRow<'r, <Self::Database as Database>::Row>, 
[src]

pub fn query_as_with<'s, O, A>(
    &'s self,
    arguments: A
) -> QueryAs<'s, Self::Database, O, A> where
    A: IntoArguments<'s, Self::Database>,
    O: for<'r> FromRow<'r, <Self::Database as Database>::Row>, 
[src]

pub fn query_scalar<O>(
    &self
) -> QueryScalar<'_, Self::Database, O, <Self::Database as HasArguments<'_>>::Arguments> where
    (O,): for<'r> FromRow<'r, <Self::Database as Database>::Row>, 
[src]

pub fn query_scalar_with<'s, O, A>(
    &'s self,
    arguments: A
) -> QueryScalar<'s, Self::Database, O, A> where
    A: IntoArguments<'s, Self::Database>,
    (O,): for<'r> FromRow<'r, <Self::Database as Database>::Row>, 
[src]

Loading content...

Provided methods

pub fn column<I>(&self, index: I) -> &<Self::Database as Database>::Column where
    I: ColumnIndex<Self>, 
[src]

Gets the column information at index.

A string index can be used to access a column by name and a usize index can be used to access a column by position.

Panics

Panics if index is out of bounds. See try_column for a non-panicking version.

pub fn try_column<I>(
    &self,
    index: I
) -> Result<&<Self::Database as Database>::Column, Error> where
    I: ColumnIndex<Self>, 
[src]

Gets the column information at index or None if out of bounds.

Loading content...

Implementors

impl<'q> Statement<'q> for AnyStatement<'q>[src]

type Database = Any

impl<'q> Statement<'q> for MssqlStatement<'q>[src]

type Database = Mssql

impl<'q> Statement<'q> for MySqlStatement<'q>[src]

type Database = MySql

impl<'q> Statement<'q> for PgStatement<'q>[src]

type Database = Postgres

impl<'q> Statement<'q> for SqliteStatement<'q>[src]

type Database = Sqlite

Loading content...