[−][src]Struct odbc_api::Environment
An ODBC 3.8 environment. Associated with an Environment
is any information that is global in
nature, such as:
- The
Environment
's state - The current environment-level diagnostics
- The handles of connections currently allocated on the environment
- The current stetting of each environment attribute
Implementations
impl Environment
[src]
pub unsafe fn new() -> Result<Self, Error>
[src]
Allocates a new ODBC Environment and declares that the Application wants to use ODBC version 3.8.
Safety
There may only be one Odbc environment in any process at any time. Take care using this function in unit tests, as these run in parallel by default in Rust. Also no library should probably wrap the creation of an odbc environment into a safe function call. This is because using two of these "safe" libraries at the same time in different parts of your program may lead to race condition thus violating Rust's safety guarantees.
Creating one environment in your binary is safe however.
pub fn connect(
&self,
data_source_name: &U16Str,
user: &U16Str,
pwd: &U16Str
) -> Result<Connection<'_>, Error>
[src]
&self,
data_source_name: &U16Str,
user: &U16Str,
pwd: &U16Str
) -> Result<Connection<'_>, Error>
Allocates a connection handle and establishes connections to a driver and a data source.
- See [Connecting with SQLConnect][1]
- See [SQLConnectFunction][2]
Arguments
data_source_name
- Data source name. The data might be located on the same computer as the program, or on another computer somewhere on a network.user
- User identifier.pwd
- Authentication string (typically the password). [1]: https://docs.microsoft.com/sql/odbc/reference/syntax/sqlconnect-function [2]: https://docs.microsoft.com/sql/odbc/reference/syntax/sqlconnect-function
pub fn connect_with_connection_string(
&self,
connection_string: &str
) -> Result<Connection<'_>, Error>
[src]
&self,
connection_string: &str
) -> Result<Connection<'_>, Error>
Allocates a connection handle and establishes connections to a driver and a data source.
An alternative to connect
. It supports data sources that require more connection
information than the three arguments in connect
and data sources that are not defined in
the system information.
To find out your connection string try: https://www.connectionstrings.com/
pub fn connect_with_connection_string_utf16(
&self,
connection_string: &U16Str
) -> Result<Connection<'_>, Error>
[src]
&self,
connection_string: &U16Str
) -> Result<Connection<'_>, Error>
Allocates a connection handle and establishes connections to a driver and a data source.
An alternative to connect
. It supports data sources that require more connection
information than the three arguments in connect
and data sources that are not defined in
the system information.
To find out your connection string try: https://www.connectionstrings.com/
Auto Trait Implementations
impl RefUnwindSafe for Environment
impl !Send for Environment
impl !Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[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.
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>,