Struct odbc_safe::Connection
[−]
[src]
pub struct Connection<'env, S = Unconnected> { /* fields omitted */ }
A Connection
is used to query and manipulate a data source.
- The state of the connection
- The current connection-level diagnostics
- The handles of statements and descriptors currently allocated on the connection
- The current settings of each connection attribute
Methods
impl<'env, Any> Connection<'env, Any>
[src]
fn into_raw(self) -> SQLHDBC
Consumes the Connection
, returning the wrapped raw SQLHDBC
Leaks the Connection Handle. This is usually done in order to pass ownership from Rust to
another language. After calling this method, the caller is responsible for invoking
SQLFreeHandle
.
fn as_raw(&self) -> SQLHDBC
Provides access to the raw ODBC Connection Handle
unsafe fn from_raw(raw: SQLHDBC) -> Self
May only be invoked with a valid Statement Handle which has been allocated using
SQLAllocHandle
. Special care must be taken that the Connection Handle passed is in a
State which matches the type.
impl<'env> Connection<'env, Unconnected>
[src]
fn with_parent<V>(parent: &'env Environment<V>) -> Return<Self> where
V: Version,
V: Version,
Allocates a new Connection
. A Connection
may not outlive its parent Environment
.
fn connect<DSN: ?Sized, U: ?Sized, P: ?Sized>(
self,
data_source_name: &DSN,
user: &U,
pwd: &P
) -> Return<Connection<'env, Connected>, Connection<'env, Unconnected>> where
DSN: SqlStr,
U: SqlStr,
P: SqlStr,
self,
data_source_name: &DSN,
user: &U,
pwd: &P
) -> Return<Connection<'env, Connected>, Connection<'env, Unconnected>> where
DSN: SqlStr,
U: SqlStr,
P: SqlStr,
Establishes connections to a driver and a data source. The connection handle references storage of all information about the connection to the data source, including status, transaction state, and error information.
State transition
On success this method changes the Connection handles state from Allocated
to Connected
. Since this state change is expressed in the type system, the method consumes self. And
returns a new instance in the result type.
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
- Authenticatien string (typically the password).
impl<'env> Connection<'env, Connected>
[src]
fn disconnect(
self
) -> Return<Connection<'env, Unconnected>, Connection<'env, Connected>>
self
) -> Return<Connection<'env, Unconnected>, Connection<'env, Connected>>
When an application has finished using a data source, it calls disconnect
. disconnect
disconnects the driver from the data source.
Trait Implementations
impl<'env, S: Debug> Debug for Connection<'env, S>
[src]
impl<'env, S> Diagnostics for Connection<'env, S>
[src]
fn diagnostics(
&self,
rec_number: SQLSMALLINT,
message_text: &mut [SQLCHAR]
) -> ReturnOption<DiagResult>
&self,
rec_number: SQLSMALLINT,
message_text: &mut [SQLCHAR]
) -> ReturnOption<DiagResult>
Returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information. Read more