[][src]Struct odbc_iter::Handle

pub struct Handle<'c, C: Configuration = DefaultConfiguration> { /* fields omitted */ }

Statically ensures that Connection can only be used after ResultSet was consumed to avoid runtime errors.

Operations on Connection are only allowed after ResultSet was dropped. Allocated PreparedStatement objects reference Connection directly so Handle can be still used to query or allocate more PreparedStatement objects.

Methods

impl<'h, 'c: 'h, C: Configuration> Handle<'c, C>[src]

pub fn with_configuration<CNew: Configuration>(
    &mut self,
    configuration: CNew
) -> Handle<'c, CNew>
[src]

pub fn tables<'i, V>(
    &'h mut self,
    catalog: &'i str,
    schema: Option<&'i str>,
    table: Option<&'i str>,
    table_type: Option<&'i str>
) -> Result<ResultSet<'h, 'c, V, Executed, C>, QueryError> where
    V: TryFromRow<C>, 
[src]

Query list of tables from given catalog. Optionally result can be filtered by table name and table type.

pub fn prepare(
    &'h mut self,
    query: &str
) -> Result<PreparedStatement<'c>, OdbcError>
[src]

Prepare statement for fast execution and parametrization. For one-off queries it is more efficient to use query() function.

pub fn query<V>(
    &'h mut self,
    query: &str
) -> Result<ResultSet<'h, 'c, V, Executed, C>, QueryError> where
    V: TryFromRow<C>, 
[src]

Execute one-off query.

pub fn query_with_parameters<'t, V, F>(
    &'h mut self,
    query: &str,
    bind: F
) -> Result<ResultSet<'h, 'c, V, Executed, C>, QueryError> where
    V: TryFromRow<C>,
    F: FnOnce(Binder<'c, 'c, Allocated>) -> Result<Binder<'c, 't, Allocated>, BindError>, 
[src]

Execute one-off query with parameters. This creates prepared statement and binds values to it before execution.

pub fn execute<V>(
    &'h mut self,
    statement: PreparedStatement<'c>
) -> Result<ResultSet<'h, 'c, V, Prepared, C>, QueryError> where
    V: TryFromRow<C>, 
[src]

Execute prepared statement without parameters.

pub fn execute_with_parameters<'t, V, F>(
    &'h mut self,
    statement: PreparedStatement<'c>,
    bind: F
) -> Result<ResultSet<'h, 'c, V, Prepared, C>, QueryError> where
    V: TryFromRow<C>,
    F: FnOnce(Binder<'c, 'c, Prepared>) -> Result<Binder<'c, 't, Prepared>, BindError>, 
[src]

Bind parameters and execute prepared statement.

pub fn start_transaction(&mut self) -> Result<(), QueryError>[src]

Calls "START TRANSACTION"

pub fn commit(&mut self) -> Result<(), QueryError>[src]

Calls "COMMIT"

pub fn rollback(&mut self) -> Result<(), QueryError>[src]

Calls "ROLLBACK"

pub fn in_transaction<O, E>(
    &mut self,
    f: impl FnOnce(&mut Handle<'c, C>) -> Result<O, E>
) -> Result<Result<O, E>, QueryError>
[src]

Call function in transaction. If function returns Err the transaction will be rolled back otherwise committed.

pub fn outside_of_transaction<O>(
    &mut self,
    f: impl FnOnce(&mut Handle<'c, C>) -> O
) -> Result<O, QueryError>
[src]

Commit current transaction, run function and start new transaction. This is useful when you need to do changes with auto-commit (for example change schema) while in open transaction already.

Trait Implementations

impl<'c, C: Debug + Configuration> Debug for Handle<'c, C>[src]

Auto Trait Implementations

impl<'c, C = DefaultConfiguration> !Sync for Handle<'c, C>

impl<'c, C = DefaultConfiguration> !Send for Handle<'c, C>

impl<'c, C> Unpin for Handle<'c, C> where
    C: Unpin

impl<'c, C> RefUnwindSafe for Handle<'c, C> where
    C: RefUnwindSafe

impl<'c, C> UnwindSafe for Handle<'c, C> where
    C: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<E, C> WrapContext<C> for E[src]

type ContextError = ErrorContext<E, C>

impl<T> ToErrorNoContext<T> for T[src]