Struct ibm_db::Environment [−][src]
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.
Implementations
impl Environment<Version3>
[src]
pub fn drivers(&mut self) -> Result<Vec<DriverInfo>>
[src]
Stores all driver description and attributes in a Vec
pub fn data_sources(&mut self) -> Result<Vec<DataSourceInfo>>
[src]
Stores all data source server names and descriptions in a Vec
pub fn system_data_sources(&mut self) -> Result<Vec<DataSourceInfo>>
[src]
Stores all system data source server names and descriptions in a Vec
pub 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]
pub fn new() -> Result<Environment<V>, Option<DiagnosticRecord>>
[src]
Creates an ODBC Environment and declares specification 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]
pub fn connect<'env>(
&'env self,
dsn: &str,
usr: &str,
pwd: &str
) -> Result<Connection<'env, AutocommitOn>>
[src]
&'env self,
dsn: &str,
usr: &str,
pwd: &str
) -> Result<Connection<'env, AutocommitOn>>
Connects to an ODBC data source
Arguments
dsn
- Data source name configured in theodbc.ini
fileusr
- User identifierpwd
- Authentication (usually password)
pub fn connect_with_connection_string<'env>(
&'env self,
connection_str: &str
) -> Result<Connection<'env, AutocommitOn>>
[src]
&'env self,
connection_str: &str
) -> Result<Connection<'env, AutocommitOn>>
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
Trait Implementations
impl<V: Debug> Debug for Environment<V>
[src]
impl<V> Handle for Environment<V>
[src]
impl<V> Handle for Environment<V>
[src]
const HANDLE_TYPE: HandleType
[src]
fn handle(&self) -> SQLHANDLE
[src]
Auto Trait Implementations
impl<V> RefUnwindSafe for Environment<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> !Send for Environment<V>
impl<V> !Sync for Environment<V>
impl<V> Unpin for Environment<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for Environment<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<H> Diagnostics for H where
H: Handle,
[src]
H: Handle,
pub fn diagnostics(
&self,
rec_number: i16,
message_text: &mut [u8]
) -> ReturnOption<DiagResult, ()>
[src]
&self,
rec_number: i16,
message_text: &mut [u8]
) -> ReturnOption<DiagResult, ()>
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,