ExDgraph v0.2.0-alpha.1 ExDgraph.Protocol View Source

Implements callbacks required by DBConnection.

Each callback receives an open connection as a state.

Link to this section Summary

Functions

Callback for DBConnection.checkin/1

Callback for DBConnection.checkout/1

Callback for DBConnection.connect/1

Callback for DBConnection.disconnect/1

Callback for DBConnection.handle_begin/1

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

Callback for DBConnection.handle_commit/1

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

Callback for DBConnection.handle_execute/1

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

Handle a message received by the connection process when checked in. Return {:ok, state} to continue or {:disconnect, exception, state} to 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

Callback for DBConnection.handle_rollback/1

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

Callback for DBConnection.checkin/1

Callback for DBConnection.checkout/1

Callback for DBConnection.connect/1

Callback for DBConnection.disconnect/1

Link to this function handle_begin(arg1, state) View Source

Callback for DBConnection.handle_begin/1

Link to this function 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.

Link to this function handle_commit(arg1, state) View Source

Callback for DBConnection.handle_commit/1

Link to this function 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.

Link to this function 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.

Link to this function handle_execute(query, params, opts, state) View Source

Callback for DBConnection.handle_execute/1

Link to this function 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 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.

Link to this function 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.

Link to this function 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.

Link to this function handle_rollback(arg1, state) View Source

Callback for DBConnection.handle_rollback/1

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.