pub struct Environment { /* private fields */ }
Expand description

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

Enable or disable (default) connection pooling for ODBC connections. Call this function before creating the ODBC environment for which you want to enable connection pooling.

See: https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/driver-manager-connection-pooling

Safety

An ODBC driver must be fully thread-safe, and connections must not have thread affinity to support connection pooling. This means the driver is able to handle a call on any thread at any time and is able to connect on one thread, to use the connection on another thread, and to disconnect on a third thread.

An allocated ODBC Environment handle

Declares which Version of the ODBC API we want to use. This is the first thing that should be done with any ODBC environment.

Allocate a new connection handle. The Connection must not outlive the Environment.

Provides access to the raw ODBC environment handle.

List drivers descriptions and driver attribute keywords. Returns None to indicate the end of the list.

Safety

Callers need to make sure only one thread is iterating over driver information at a time. Method changes environment state. This method would be safe to call via an exclusive &mut reference, yet that would restrict usecases. E.g. requesting information would only be possible before connections borrow a reference.

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 case true is returned this buffer is filled with the description of the driver.
  • buffer_attributes: In case true is 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

Use together with Environment::drivers_buffer_fill to list drivers descriptions and driver attribute keywords.

Safety

Callers need to make sure only one thread is iterating over driver information at a time. Method changes environment state. This method would be safe to call via an exclusive &mut reference, yet that would restrict usecases. E.g. requesting information would only be possible before connections borrow a reference.

Parameters
Return

(driver description length, attribute length). Length is in characters minus terminating terminating zero.

See SQLDrivers

Use together with Environment::data_source_buffer_fill to list drivers descriptions and driver attribute keywords.

Safety

Callers need to make sure only one thread is iterating over data source information at a time. Method changes environment state. This method would be safe to call via an exclusive &mut reference, yet that would restrict usecases. E.g. requesting information would only be possible before connections borrow a reference.

Parameters
Return

(server name length, description length). Length is in characters minus terminating zero.

List drivers descriptions and driver attribute keywords.

Safety

Callers need to make sure only one thread is iterating over data source information at a time. Method changes environment state. This method would be safe to call via an exclusive &mut reference, yet that would restrict usecases. E.g. requesting information would only be possible before connections borrow a reference.

Parameters

Use Environment::data_source_buffer_len to determine buffer lengths.

Trait Implementations

The raw underlying ODBC handle used to talk to the ODBC C API. The handle must be valid.

The type of the ODBC handle returned by as_handle. This is a method rather than a constant in order to make the type object safe. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.