Skip to main content

Query

Struct Query 

Source
pub struct Query<'a> { /* private fields */ }
Expand description

A query to Mariadb/Mysql

Implementations§

Source§

impl<'a> Query<'a>

Source

pub fn information(&self) -> Option<&StatementInformation>

Get information about the prepared statement, if the QueryOptions::information was enabled

Source

pub fn bind<T: Bind + ?Sized>(self, v: &T) -> ConnectionResult<Self>

Bind the next argument to the query

Source

pub async fn fetch_optional_map<M: RowMap<'a>>( self, ) -> Result<Option<M::T>, M::E>

Execute the query and return zero or one mapped rows

All arguments must have been bound

If the query returns more than one row an error is returned

Source

pub fn fetch_optional<T: FromRow<'a>>( self, ) -> impl Future<Output = ConnectionResult<Option<T>>> + Send

Execute the query and return zero or one rows

All arguments must have been bound

If the query returns more than one row an error is returned

Source

pub async fn fetch_one<T: FromRow<'a>>(self) -> ConnectionResult<T>

Execute the query and return one row

All arguments must have been bound

If the query does not return exactly one row an error is returned

Source

pub async fn fetch_all_map<M: RowMap<'a>>(self) -> Result<Vec<M::T>, M::E>

Execute the query and return all mapped rows in a vector

All arguments must have been bound

Source

pub fn fetch_all<T: FromRow<'a>>( self, ) -> impl Future<Output = ConnectionResult<Vec<T>>> + Send

Execute the query and return all rows in a vector

All arguments must have been bound

Source

pub async fn fetch(self) -> ConnectionResult<QueryIterator<'a>>

Execute the query and return an iterator that can return the results

Source

pub async fn fetch_map<M>(self) -> ConnectionResult<MapQueryIterator<'a, M>>
where for<'b> M: RowMap<'b>,

Execute the query and return an iterator that can return the mapped results

Source

pub async fn execute(self) -> ConnectionResult<ExecuteResult>

Execute query that does not return any columns

Auto Trait Implementations§

§

impl<'a> Freeze for Query<'a>

§

impl<'a> RefUnwindSafe for Query<'a>

§

impl<'a> Send for Query<'a>

§

impl<'a> Sync for Query<'a>

§

impl<'a> Unpin for Query<'a>

§

impl<'a> !UnwindSafe for Query<'a>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V