Struct odbc_api::handles::Environment [−][src]
An Environment is a global context, in which to access data.
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]
An allocated ODBC Environment handle
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 declare_version(&self, version: AttrOdbcVersion) -> Result<(), Error>[src]
Declares which Version of the ODBC API we want to use. This is the first thing that should be done with any ODBC environment.
pub fn allocate_connection(&self) -> Result<Connection<'_>, Error>[src]
Allocate a new connection handle. The Connection must not outlive the Environment.
pub fn as_raw(&self) -> HEnv[src]
Provides access to the raw ODBC environment handle.
pub fn drivers_buffer_fill(
&mut self,
direction: FetchOrientation,
buffer_description: &mut Vec<u16>,
buffer_attributes: &mut Vec<u16>
) -> Result<bool, Error>[src]
&mut self,
direction: FetchOrientation,
buffer_description: &mut Vec<u16>,
buffer_attributes: &mut Vec<u16>
) -> Result<bool, Error>
List drivers descriptions and driver attribute keywords.
Parameters
direction: Determines whether the Driver Manager fetches the next driver in the list (FetchOrientation::Next) or whether the search starts from the beginning of the list (FetchOrientation::First).buffer_description: In casetrueis returned this buffer is filled with the description of the driver.buffer_attributes: In casetrueis returned this buffer is filled with a list of key value attributes. E.g.:"key1=value1\0key2=value2\0\0".
Use Environment::drivers_buffer_len to determine buffer lengths.
See SQLDrivers
pub fn drivers_buffer_len(
&mut self,
direction: FetchOrientation
) -> Result<Option<(i16, i16)>, Error>[src]
&mut self,
direction: FetchOrientation
) -> Result<Option<(i16, i16)>, Error>
Use together with Environment::drivers_buffer_fill to list drivers descriptions and driver attribute
keywords.
Parameters
direction: Determines whether the Driver Manager fetches the next driver in the list (FetchOrientation::Next) or whether the search starts from the beginning of the list (FetchOrientation::First).
Return
(driver description length, attribute length). Length is in characters minus terminating
terminating zero.
See SQLDrivers
pub fn data_source_buffer_len(
&mut self,
direction: FetchOrientation
) -> Result<Option<(i16, i16)>, Error>[src]
&mut self,
direction: FetchOrientation
) -> Result<Option<(i16, i16)>, Error>
Use together with Environment::data_source_buffer_fill to list drivers descriptions and
driver attribute keywords.
Parameters
direction: Determines whether the Driver Manager fetches the next driver in the list (FetchOrientation::Next) or whether the search starts from the beginning of the list (FetchOrientation::First,FetchOrientation::FirstSystem,FetchOrientation::FirstUser).
Return
(server name length, description length). Length is in characters minus terminating zero.
pub fn data_source_buffer_fill(
&mut self,
direction: FetchOrientation,
buffer_name: &mut Vec<u16>,
buffer_description: &mut Vec<u16>
) -> Result<bool, Error>[src]
&mut self,
direction: FetchOrientation,
buffer_name: &mut Vec<u16>,
buffer_description: &mut Vec<u16>
) -> Result<bool, Error>
List drivers descriptions and driver attribute keywords.
Parameters
direction: Determines whether the Driver Manager fetches the next driver in the list (FetchOrientation::Next) or whether the search starts from the beginning of the list (FetchOrientation::First,FetchOrientation::FirstSystem,FetchOrientation::FirstUser).buffer_name: In casetrueis returned this buffer is filled with the name of the datasource.buffer_description: In casetrueis returned this buffer is filled with a description of the datasource (i.e. Driver name).
Use Environment::data_source_buffer_len to determine buffer lengths.
Trait Implementations
impl AsHandle for Environment[src]
fn as_handle(&self) -> Handle[src]
fn handle_type(&self) -> HandleType[src]
impl Debug for Environment[src]
impl Drop for Environment[src]
impl Send for Environment[src]
See: https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/multithreading?view=sql-server-ver15
impl Sync for Environment[src]
Auto Trait Implementations
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<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.
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>,