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(&mut self) -> Result<Vec<DriverInfo>>
[src]
Stores all driver description and attributes in a Vec
fn data_sources(&mut self) -> Result<Vec<DataSourceInfo>>
[src]
Stores all data source server names and descriptions in a Vec
fn system_data_sources(&mut self) -> Result<Vec<DataSourceInfo>>
[src]
Stores all sytem data source server names and descriptions in a Vec
fn user_data_sources(&mut self) -> Result<Vec<DataSourceInfo>>
[src]
Stores all user data source server names and descriptions in a Vec
impl<V: Version> Environment<V>
[src]
fn new() -> Result<Environment<V>, Option<DiagnosticRecord>>
[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 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)
.
```
impl Environment<Version3>
[src]
fn connect<'env>(
&'env self,
dsn: &str,
usr: &str,
pwd: &str
) -> Result<Connection<'env>>
[src]
&'env self,
dsn: &str,
usr: &str,
pwd: &str
) -> Result<Connection<'env>>
Connects to an ODBC data source
Arguments
dsn
- Data source name configured in theodbc.ini
fileusr
- User identifierpwd
- Authentication (usually password)
fn connect_with_connection_string<'env>(
&'env self,
connection_str: &str
) -> Result<Connection<'env>>
[src]
&'env self,
connection_str: &str
) -> Result<Connection<'env>>
Connects to an ODBC data source using a connection string
See SQLDriverConnect for the syntax.
Trait Implementations
impl<V> Handle for Environment<V>
[src]
impl<V> Handle for Environment<V>
[src]
const HANDLE_TYPE: HandleType
HANDLE_TYPE: HandleType = ffi::SQL_HANDLE_ENV
Used to identify the type of the handle in various functions of the ODBC C interface
fn handle(&self) -> SQLHANDLE
[src]
Returns a ptr to the wrapped ODBC Object