[−][src]Struct odbc_iter::Handle
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]
&mut self,
configuration: CNew
) -> Handle<'c, CNew>
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]
&'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>,
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]
&'h mut self,
query: &str
) -> Result<PreparedStatement<'c>, OdbcError>
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]
&'h mut self,
query: &str
) -> Result<ResultSet<'h, 'c, V, Executed, C>, QueryError> where
V: TryFromRow<C>,
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]
&'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>,
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]
&'h mut self,
statement: PreparedStatement<'c>
) -> Result<ResultSet<'h, 'c, V, Prepared, C>, QueryError> where
V: TryFromRow<C>,
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]
&'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>,
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]
&mut self,
f: impl FnOnce(&mut Handle<'c, C>) -> Result<O, E>
) -> Result<Result<O, E>, QueryError>
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]
&mut self,
f: impl FnOnce(&mut Handle<'c, C>) -> O
) -> Result<O, QueryError>
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> RefUnwindSafe for Handle<'c, C> where
C: RefUnwindSafe,
C: RefUnwindSafe,
impl<'c, C = DefaultConfiguration> !Send for Handle<'c, C>
impl<'c, C = DefaultConfiguration> !Sync for Handle<'c, C>
impl<'c, C> Unpin for Handle<'c, C> where
C: Unpin,
C: Unpin,
impl<'c, C> UnwindSafe for Handle<'c, C> where
C: UnwindSafe,
C: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToErrorNoContext<T> for T
[src]
fn to_root_cause(self) -> ErrorNoContext<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.