View Source Tds.Protocol (Tds v2.3.5)
Implements DBConnection behaviour for TDS protocol.
Summary
Functions
Callback implementation for DBConnection.checkout/1
.
Callback implementation for DBConnection.connect/1
.
Callback implementation for DBConnection.disconnect/2
.
Callback implementation for DBConnection.handle_begin/2
.
Callback implementation for DBConnection.handle_close/3
.
Callback implementation for DBConnection.handle_commit/2
.
Callback implementation for DBConnection.handle_deallocate/4
.
Callback implementation for DBConnection.handle_declare/4
.
Callback implementation for DBConnection.handle_execute/4
.
Callback implementation for DBConnection.handle_fetch/4
.
Callback implementation for DBConnection.handle_prepare/3
.
Callback implementation for DBConnection.handle_rollback/2
.
Callback implementation for DBConnection.handle_status/2
.
Callback implementation for DBConnection.ping/1
.
Types
@type env() :: %{ trans: <<_::8>>, savepoint: non_neg_integer(), collation: Tds.Protocol.Collation.t(), packetsize: integer() }
@type packet_data() :: binary()
@type sock() :: {:gen_tcp | :ssl, :gen_tcp.socket() | :ssl.sslsocket()}
@type state() :: :ready | :prelogin | :login | :prepare | :executing
@type transaction() :: nil | :started | :successful | :failed
Functions
@spec checkin(state :: t()) :: {:ok, new_state :: t()} | {:disconnect, Exception.t(), new_state :: t()}
@spec checkout(state :: t()) :: {:ok, new_state :: any()} | {:disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.checkout/1
.
@spec connect(opts :: Keyword.t()) :: {:ok, state :: t()} | {:error, Exception.t()}
Callback implementation for DBConnection.connect/1
.
@spec disconnect(err :: Exception.t() | String.t(), state :: t()) :: :ok
Callback implementation for DBConnection.disconnect/2
.
@spec handle_begin(Keyword.t(), t()) :: {:ok, Tds.Result.t(), new_state :: t()} | {DBConnection.status(), new_state :: t()} | {:disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_begin/2
.
@spec handle_close(Tds.Query.t(), nil | keyword() | map(), t()) :: {:ok, Tds.Result.t(), new_state :: t()} | {:error | :disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_close/3
.
@spec handle_commit(Keyword.t(), t()) :: {:ok, Tds.Result.t(), new_state :: t()} | {DBConnection.status(), new_state :: t()} | {:disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_commit/2
.
@spec handle_deallocate( query :: Tds.Query.t(), cursor :: any(), opts :: Keyword.t(), state :: t() ) :: {:ok, Tds.Result.t(), new_state :: t()} | {:error | :disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_deallocate/4
.
@spec handle_declare( Tds.Query.t(), params :: any(), opts :: Keyword.t(), state :: t() ) :: {:ok, Tds.Query.t(), cursor :: any(), new_state :: t()} | {:error | :disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_declare/4
.
@spec handle_execute(Tds.Query.t(), DBConnection.params(), Keyword.t(), t()) :: {:ok, Tds.Query.t(), Tds.Result.t(), new_state :: t()} | {:error | :disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_execute/4
.
@spec handle_fetch( Tds.Query.t(), cursor :: any(), opts :: Keyword.t(), state :: t() ) :: {:cont | :halt, Tds.Result.t(), new_state :: t()} | {:error | :disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_fetch/4
.
@spec handle_prepare(Tds.Query.t(), Keyword.t(), t()) :: {:ok, Tds.Query.t(), new_state :: t()} | {:error | :disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_prepare/3
.
@spec handle_rollback(Keyword.t(), t()) :: {:ok, Tds.Result.t(), new_state :: t()} | {:idle, new_state :: t()} | {:disconnect, Exception.t(), new_state :: t()}
Callback implementation for DBConnection.handle_rollback/2
.
@spec handle_status(Keyword.t(), t()) :: {:idle | :transaction | :error, t()} | {:disconnect, Exception.t(), t()}
Callback implementation for DBConnection.handle_status/2
.
@spec ping(t()) :: {:ok, t()} | {:disconnect, Exception.t(), t()}
Callback implementation for DBConnection.ping/1
.