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]

[src]

Stores all driver description and attributes in a Vec

[src]

Stores all data source server names and descriptions in a Vec

[src]

Stores all sytem data source server names and descriptions in a Vec

[src]

Stores all user data source server names and descriptions in a Vec

impl<V: Version> Environment<V>
[src]

[src]

Creates an ODBC Environment and declares specifaciton of V are used. You can use the shorthand create_environment_v3() instead.

Example

use odbc::*;
fn do_database_stuff() -> std::result::Result<(), Option<DiagnosticRecord>> {
    let env : Environment<Version3> = Environment::new()?; // first thing to do
    // ...
    Ok(())
}

Return

While most functions in this crate return a DiagnosticRecord in the event of an Error the creation of an environment is special. Since DiagnosticRecords 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). ```

impl Environment<Version3>
[src]

[src]

Connects to an ODBC data source

Arguments

  • dsn - Data source name configured in the odbc.ini file
  • usr - User identifier
  • pwd - Authentication (usually password)

[src]

Connects to an ODBC data source using a connection string

See SQLDriverConnect for the syntax.

Trait Implementations

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

[src]

Returns a valid handle to the odbc type.

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

HANDLE_TYPE: HandleType = ffi::SQL_HANDLE_ENV

Used to identify the type of the handle in various functions of the ODBC C interface

[src]

Returns a ptr to the wrapped ODBC Object