Skip to main content

Statement

Struct Statement 

Source
pub struct Statement<'sql> { /* private fields */ }
Expand description

Represents SQL statements that can be executed with various options.

Implementations§

Source§

impl<'sql> Statement<'sql>

Source

pub fn execute(&self, params: &[&dyn ToDbValue]) -> Result<ExecResult, Error>

Executes the statement with the given parameters and returns an ExecResult structure. The statement that is executed may not be a query.

Source

pub fn execute_batch( &self, params: BindParameters<'_>, ) -> Result<ExecResult, Error>

Executes a SQL statement against the database multiple times in one round trip.

Source

pub fn execute_named( &self, params: &[(&str, &dyn ToDbValue)], ) -> Result<ExecResult, Error>

Executes the statement with the given named parameters and returns an ExecResult structure. The statement that is executed may not be a query.

Source

pub fn exclude_from_cache(&mut self) -> &mut Self

Specifies that this statement should not be cached.

Source

pub fn fetch_array_size(&mut self, value: u32) -> &mut Self

Specifies the number of rows that should be fetched at a time from the database.

Source

pub fn fetch_lobs(&mut self) -> &mut Self

Specifies that LOB values should be fetched as LOB locators.

Source

pub fn prefetch_rows(&mut self, value: u32) -> &mut Self

Specifies the number of rows that should be fetched when the statement is executed.

Source

pub fn query(&self, params: &[&dyn ToDbValue]) -> Result<Cursor, Error>

Executes the statement with the given parameters and returns a Cursor which can be used to iterate over the rows returned by the query. The statement that is executed must be a query.

Source

pub fn query_named( &self, params: &[(&str, &dyn ToDbValue)], ) -> Result<Cursor, Error>

Executes the statement with the given parameters and returns a Cursor which can be used to iterate over the rows returned by the query. The statement that is executed must be a query.

Source

pub fn query_row(&self, params: &[&dyn ToDbValue]) -> Result<Row, Error>

Executes the statement with the given parameters and returns the first row supplied by the database. If no rows are found, a NoDataFound error is returned instead.

Source

pub fn query_row_named( &self, params: &[(&str, &dyn ToDbValue)], ) -> Result<Row, Error>

Executes the statement with the given parameters and returns the first row supplied by the database. If no rows are found, a NoDataFound error is returned instead.

Auto Trait Implementations§

§

impl<'sql> Freeze for Statement<'sql>

§

impl<'sql> RefUnwindSafe for Statement<'sql>

§

impl<'sql> Send for Statement<'sql>

§

impl<'sql> Sync for Statement<'sql>

§

impl<'sql> Unpin for Statement<'sql>

§

impl<'sql> UnsafeUnpin for Statement<'sql>

§

impl<'sql> UnwindSafe for Statement<'sql>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.