Trait rsfbclient::Queryable
source · pub trait Queryable {
// Required method
fn query_iter<'a, P, R>(
&'a mut self,
sql: &str,
params: P
) -> Result<Box<dyn Iterator<Item = Result<R, FbError>> + 'a>, FbError>
where P: IntoParams,
R: FromRow + 'static;
// Provided methods
fn query<P, R>(&mut self, sql: &str, params: P) -> Result<Vec<R>, FbError>
where P: IntoParams,
R: FromRow + 'static { ... }
fn query_first<P, R>(
&mut self,
sql: &str,
params: P
) -> Result<Option<R>, FbError>
where P: IntoParams,
R: FromRow + 'static { ... }
}
Expand description
Implemented for types that can be used to execute sql queries
Required Methods§
sourcefn query_iter<'a, P, R>(
&'a mut self,
sql: &str,
params: P
) -> Result<Box<dyn Iterator<Item = Result<R, FbError>> + 'a>, FbError>where
P: IntoParams,
R: FromRow + 'static,
fn query_iter<'a, P, R>(
&'a mut self,
sql: &str,
params: P
) -> Result<Box<dyn Iterator<Item = Result<R, FbError>> + 'a>, FbError>where
P: IntoParams,
R: FromRow + 'static,
Returns the results of the query as an iterator.
The query must be return an open cursor, so for cases like ‘insert .. returning’ you will need to use the execute_returnable method instead.
possible values for argument params
:
()
: no parameters,
(param0, param1, param2...)
: a tuple of IntoParam
values corresponding to positional ?
sql parameters
A struct for which IntoParams
has been derived (see there for details)
Provided Methods§
sourcefn query<P, R>(&mut self, sql: &str, params: P) -> Result<Vec<R>, FbError>where
P: IntoParams,
R: FromRow + 'static,
fn query<P, R>(&mut self, sql: &str, params: P) -> Result<Vec<R>, FbError>where
P: IntoParams,
R: FromRow + 'static,
Returns the results of the query as a Vec
The query must be return an open cursor, so for cases like ‘insert .. returning’ you will need to use the execute_returnable method instead.
possible values for argument params
:
()
: no parameters,
(param0, param1, param2...)
: a tuple of IntoParam
values corresponding to positional ?
sql parameters
A struct for which IntoParams
has been derived (see there for details)
sourcefn query_first<P, R>(
&mut self,
sql: &str,
params: P
) -> Result<Option<R>, FbError>where
P: IntoParams,
R: FromRow + 'static,
fn query_first<P, R>(
&mut self,
sql: &str,
params: P
) -> Result<Option<R>, FbError>where
P: IntoParams,
R: FromRow + 'static,
Returns the first result of the query, or None.
The query must be return an open cursor, so for cases like ‘insert .. returning’ you will need to use the execute_returnable method instead.
possible values for argument params
:
()
: no parameters,
(param0, param1, param2...)
: a tuple of IntoParam
values corresponding to positional ?
sql parameters
A struct for which IntoParams
has been derived (see there for details)