[][src]Function odbc_iter::thread_local::connection_with

pub fn connection_with<O>(
    connection_string: &str,
    f: impl Fn(Result<Connection, OdbcError>) -> (Option<Connection>, O)
) -> O

Access to thread local connection.

Provided closure will receive the Connection object and may return it for reuse by another call or drop it to force new connection to be established to database on next call.

If there was an error during connection it is provided to the closure. Next call will attempt to connect again and a new error may be provided.

connection_string is used only when making new Connection object initially, after error or after old Connection object was dropped.