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]

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

impl Environment<NoVersion>
[src]

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."),
};

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(())
}

Trait Implementations

impl<V> Handle for Environment<V>
[src]

Returns a valid handle to the odbc type.