pub struct Environment<V> { /* fields omitted */ }
Handle to an ODBC Environment
Creating an instance of this type is the first thing you do then using ODBC. The environment
must outlive all connections created with it.
Stores all driver description and attributes in a Vec
Stores all data source server names and descriptions in a Vec
Stores all sytem data source server names and descriptions in a Vec
Stores all user data source server names and descriptions in a Vec
Creates an ODBC Environment and declares specifaciton of V
are used. You can use the
shorthand create_environment_v3()
instead.
use odbc::*;
fn do_database_stuff() -> std::result::Result<(), Option<DiagnosticRecord>> {
let env : Environment<Version3> = Environment::new()?;
Ok(())
}
While most functions in this crate return a DiagnosticRecord
in the event of an Error the
creation of an environment is special. Since DiagnosticRecord
s are created using the
environment, at least its allocation has to be successful to obtain one. If the allocation
fails it is sadly not possible to receive further Diagnostics. Setting an unsupported version
may however result in an ordinary Some(DiagnosticRecord)
.
Connects to an ODBC data source
dsn
- Data source name configured in the odbc.ini
file
usr
- User identifier
pwd
- Authentication (usually password)
Connects to an ODBC data source using a connection string
See [SQLDriverConnect][1] for the syntax.
[1]: https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqldriverconnect-function
Returns a valid handle to the odbc type.
Used to identify the type of the handle in various functions of the ODBC C interface
Returns a ptr to the wrapped ODBC Object
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information. Read more