MssqlexV3 v3.0.3 MssqlexV3.Protocol View Source
Implementation of DBConnection
behaviour for MssqlexV3.ODBC
.
Handles translation of concepts to what ODBC expects and holds state for a connection.
This module is not called directly, but rather through
other MssqlexV3
modules or DBConnection
functions.
Link to this section Summary
Functions
Handle getting the transaction status. Return {:idle, state}
if outside a
transaction, {:transaction, state}
if inside a transaction,
{:error, state}
if inside an aborted transaction, or
{:disconnect, exception, state}
to error and disconnect
Called when the connection has been idle for a period of time. Return
{:ok, state}
to continue or {:disconnect, exception, state}
to
disconnect
Link to this section Types
state() :: %MssqlexV3.Protocol{ conn_opts: Keyword.t(), mssql: DBConnection.status(), pid: pid() }
Process state.
Includes:
:pid
: the pid of the ODBC process:mssql
: the transaction state. Can be:idle
(not in a transaction),:transaction
(in a transaction) or:auto_commit
(connection in autocommit mode):conn_opts
: the options used to set up the connection.
Link to this section Functions
handle_status(opts :: Keyword.t(), state :: any()) :: {:idle | :transaction | :error, new_state :: any()} | {:disconnect, Exception.t(), new_state :: any()}
Handle getting the transaction status. Return {:idle, state}
if outside a
transaction, {:transaction, state}
if inside a transaction,
{:error, state}
if inside an aborted transaction, or
{:disconnect, exception, state}
to error and disconnect.
If the callback returns a :disconnect
tuples then status/2
will return
:error
.
Callback implementation for DBConnection.handle_status/2
.
Called when the connection has been idle for a period of time. Return
{:ok, state}
to continue or {:disconnect, exception, state}
to
disconnect.
This callback is called if no callbacks have been called after the
idle timeout and a client process is not using the state. The idle
timeout can be configured by the :idle_interval
option. This function
can be called whether the connection is checked in or checked out.
This callback is called in the connection process.
Callback implementation for DBConnection.ping/1
.