Struct odbc::Environment
[−]
[src]
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.
Methods
impl Environment<Version3>
[src]
fn drivers(&self) -> Result<Vec<DriverInfo>>
Stores all driver description and attributes in a Vec
fn data_sources(&self) -> Result<Vec<DataSourceInfo>>
Stores all data source server names and descriptions in a Vec
fn system_data_sources(&self) -> Result<Vec<DataSourceInfo>>
Stores all sytem data source server names and descriptions in a Vec
fn user_data_sources(&self) -> Result<Vec<DataSourceInfo>>
Stores all user data source server names and descriptions in a Vec
impl Environment<NoVersion>
[src]
fn new() -> Result<Environment<NoVersion>, EnvAllocError>
Allocates a new ODBC Environment
After creation the Environment
is in the NoVersion
state. To do something with it you
need to set the ODBC Version using set_odbc_version_3
.
Example
let env = match Environment::new(){ // Successful creation of Environment Ok(env) => env, // Sadly, we do not know the reason for failure, because there is no `Environment` to // to get the `DiagnosticRecord` from. Err(EnvAllocError) => panic!("Could not create an ODBC Environment."), };
fn set_odbc_version_3(self) -> Result<Environment<Version3>>
Tells the driver(s) that we will use features of up to ODBC version 3
The first thing to do with an ODBC Environment
is to set a version.
Example
fn do_database_stuff() -> std::result::Result<(), Box<std::error::Error>> { use odbc::*; let env = Environment::new()?.set_odbc_version_3()?; // first thing to do // ... Ok(()) }