pub struct Query<'a> { /* private fields */ }Expand description
A query to Mariadb/Mysql
Implementations§
Source§impl<'a> Query<'a>
impl<'a> Query<'a>
Sourcepub fn information(&self) -> Option<&StatementInformation>
pub fn information(&self) -> Option<&StatementInformation>
Get information about the prepared statement, if the QueryOptions::information was enabled
Sourcepub fn bind<T: Bind + ?Sized>(self, v: &T) -> ConnectionResult<Self>
pub fn bind<T: Bind + ?Sized>(self, v: &T) -> ConnectionResult<Self>
Bind the next argument to the query
Sourcepub async fn fetch_optional_map<M: RowMap<'a>>(
self,
) -> Result<Option<M::T>, M::E>
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
Sourcepub fn fetch_optional<T: FromRow<'a>>(
self,
) -> impl Future<Output = ConnectionResult<Option<T>>> + Send
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
Sourcepub async fn fetch_one<T: FromRow<'a>>(self) -> ConnectionResult<T>
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
Sourcepub async fn fetch_all_map<M: RowMap<'a>>(self) -> Result<Vec<M::T>, M::E>
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
Sourcepub fn fetch_all<T: FromRow<'a>>(
self,
) -> impl Future<Output = ConnectionResult<Vec<T>>> + Send
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
Sourcepub async fn fetch(self) -> ConnectionResult<QueryIterator<'a>>
pub async fn fetch(self) -> ConnectionResult<QueryIterator<'a>>
Execute the query and return an iterator that can return the results
Sourcepub async fn fetch_map<M>(self) -> ConnectionResult<MapQueryIterator<'a, M>>where
for<'b> M: RowMap<'b>,
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
Sourcepub async fn execute(self) -> ConnectionResult<ExecuteResult>
pub async fn execute(self) -> ConnectionResult<ExecuteResult>
Execute query that does not return any columns