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§

source

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§

source

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)

source

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)

Object Safety§

This trait is not object safe.

Implementors§