tds v1.0.6 Tds.Protocol View Source
Link to this section Summary
Functions
Checks in the state to the connection process. Return {:ok, state}
to allow the checkin or {:disconnect, exception, state}
to disconnect
Checkouts the state from the connection process. Return {:ok, state}
to allow the checkout or {:disconnect, exception, state}
to disconnect
Connect to the database. Return {:ok, state}
on success or
{:error, exception}
on failure
Disconnect from the database. Return :ok
Handle the beginning of a transaction. Return {:ok, result, state}
to
continue, {:error, exception, state}
to abort the transaction and
continue or {:disconnect, exception, state}
to abort the transaction
and disconnect
Close a query prepared by handle_prepare/3
with the database. Return
{:ok, result, state}
on success and to continue,
{:error, exception, state}
to return an error and continue, or
{:disconnect, exception, state}
to return an error and disconnect
Handle committing a transaction. Return {:ok, result, state}
on success and
to continue, {:error, exception, state}
to abort the transaction and
continue or {:disconnect, exception, state}
to abort the transaction
and disconnect
Execute a query prepared by handle_prepare/3
. Return
{:ok, result, state}
to return the result result
and continue,
{:error, exception, state}
to return an error and continue or
{:disconnect, exception, state}
to return an error and disconnect
Handle a message received by the connection process when checked in.
Return {:ok, state}
to continue or {:disconnect, exception,
state}
to disconnect
Prepare a query with the database. Return {:ok, query, state}
where
query
is a query to pass to execute/4
or close/3
,
{:error, exception, state}
to return an error and continue or
{:disconnect, exception, state}
to return an error and disconnect
Handle rolling back a transaction. Return {:ok, result, state}
on success
and to continue, {:error, exception, state}
to abort the transaction
and continue or {:disconnect, exception, state}
to abort the
transaction 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 Functions
Checks in the state to the connection process. Return {:ok, state}
to allow the checkin or {:disconnect, exception, state}
to disconnect.
This callback is called when the control of the state is passed back
to the connection process. It should reverse any changes made in
checkout/2
.
This callback is called in the connection process.
Callback implementation for DBConnection.checkin/1
.
Checkouts the state from the connection process. Return {:ok, state}
to allow the checkout or {:disconnect, exception, state}
to disconnect.
This callback is called when the control of the state is passed to
another process. checkin/1
is called with the new state when control
is returned to the connection process.
Messages are discarded, instead of being passed to handle_info/2
,
when the state is checked out.
This callback is called in the connection process.
Callback implementation for DBConnection.checkout/1
.
Connect to the database. Return {:ok, state}
on success or
{:error, exception}
on failure.
If an error is returned it will be logged and another connection attempt will be made after a backoff interval.
This callback is called in the connection process.
Callback implementation for DBConnection.connect/1
.
Disconnect from the database. Return :ok
.
The exception as first argument is the exception from a :disconnect
3-tuple returned by a previous callback.
If the state is controlled by a client and it exits or takes too long
to process a request the state will be last known state. In these
cases the exception will be a DBConnection.ConnectionError
.
This callback is called in the connection process.
Callback implementation for DBConnection.disconnect/2
.
Handle the beginning of a transaction. Return {:ok, result, state}
to
continue, {:error, exception, state}
to abort the transaction and
continue or {:disconnect, exception, state}
to abort the transaction
and disconnect.
This callback is called in the client process.
Callback implementation for DBConnection.handle_begin/2
.
Close a query prepared by handle_prepare/3
with the database. Return
{:ok, result, state}
on success and to continue,
{:error, exception, state}
to return an error and continue, or
{:disconnect, exception, state}
to return an error and disconnect.
This callback is called in the client process.
Callback implementation for DBConnection.handle_close/3
.
Handle committing a transaction. Return {:ok, result, state}
on success and
to continue, {:error, exception, state}
to abort the transaction and
continue or {:disconnect, exception, state}
to abort the transaction
and disconnect.
This callback is called in the client process.
Callback implementation for DBConnection.handle_commit/2
.
Execute a query prepared by handle_prepare/3
. Return
{:ok, result, state}
to return the result result
and continue,
{:error, exception, state}
to return an error and continue or
{:disconnect, exception, state}
to return an error and disconnect.
This callback is called in the client process.
Callback implementation for DBConnection.handle_execute/4
.
Handle a message received by the connection process when checked in.
Return {:ok, state}
to continue or {:disconnect, exception,
state}
to disconnect.
Messages received by the connection process when checked out will be logged and discared.
This callback is called in the connection process.
Callback implementation for DBConnection.handle_info/2
.
Prepare a query with the database. Return {:ok, query, state}
where
query
is a query to pass to execute/4
or close/3
,
{:error, exception, state}
to return an error and continue or
{:disconnect, exception, state}
to return an error and disconnect.
This callback is intended for cases where the state of a connection is needed to prepare a query and/or the query can be saved in the database to call later.
This callback is called in the client process.
Callback implementation for DBConnection.handle_prepare/3
.
Handle rolling back a transaction. Return {:ok, result, state}
on success
and to continue, {:error, exception, state}
to abort the transaction
and continue or {:disconnect, exception, state}
to abort the
transaction and disconnect.
A transaction will be rolled back if an exception occurs or
rollback/2
is called.
This callback is called in the client process.
Callback implementation for DBConnection.handle_rollback/2
.
ping(any) :: {:ok, any} | {:disconnect, Exception.t, any}
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_timeout
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
.