ExDgraph v0.2.0-beta.3 ExDgraph.Protocol View Source
Implements callbacks required by DBConnection.
Each callback receives an open connection as a state.
Link to this section Summary
Functions
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
Deallocate a cursor declared by handle_declare/4
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
Declare a cursor using a query prepared by handle_prepare/3
. Return
{:ok, cursor, state}
to start a cursor for a stream and continue,
{:error, exception, state}
to return an error and continue or
{:disconnect, exception, state}
to return an error and disconnect
Fetch the first result from a cursor declared by handle_declare/4
. Return
{:ok, result, state}
to return the result result
and continue,
{:deallocate, result, state}
to return the result result
and deallocate,
{:error, exception, state}
to return an error and close the cursor,
{:disconnect, exception, state}
to return an error and disconnect
Fetch the next result from a cursor declared by handle_declare/4
. Return
{:ok, result, state}
to return the result result
and continue,
{:deallocate, result, state}
to return the result result
and deallocate,
{:error, exception, state}
to return an error and close the cursor,
{:disconnect, exception, state}
to return an error and 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
Link to this section Functions
handle_close(_, _, state) View Source
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_deallocate(_, _, _, state) View Source
Deallocate a cursor declared by handle_declare/4
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_deallocate/4
.
handle_declare(_, _, _, state) View Source
Declare a cursor using a query prepared by handle_prepare/3
. Return
{:ok, cursor, state}
to start a cursor for a stream 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_declare/4
.
handle_first(_, _, _, state) View Source
Fetch the first result from a cursor declared by handle_declare/4
. Return
{:ok, result, state}
to return the result result
and continue,
{:deallocate, result, state}
to return the result result
and deallocate,
{:error, exception, state}
to return an error and close the cursor,
{:disconnect, exception, state}
to return an error and disconnect.
This callback is called in the client process.
Callback implementation for DBConnection.handle_first/4
.
handle_next(_, _, _, state) View Source
Fetch the next result from a cursor declared by handle_declare/4
. Return
{:ok, result, state}
to return the result result
and continue,
{:deallocate, result, state}
to return the result result
and deallocate,
{:error, exception, state}
to return an error and close the cursor,
{:disconnect, exception, state}
to return an error and disconnect.
This callback is called in the client process.
Callback implementation for DBConnection.handle_next/4
.
handle_prepare(_, _, state) View Source
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
.