Ecto.Adapters.SQL.Query behaviour

Specifies the behaviour to be implemented by the connection for handling all SQL queries.

Source

Callbacks

all/1

Specs:

Receives a query and must return a SELECT query.

Source
begin_transaction/0

Specs:

Command to begin transaction.

Source
commit/0

Specs:

Command to commit transaction.

Source
ddl_exists/1

Specs:

Receives a DDL object and returns a query that checks its existence.

Source
delete/3

Specs:

Returns a DELETE for the filters returning the given returning.

Source
delete_all/1

Specs:

Receives a query and must return a DELETE query.

Source
execute_ddl/1

Specs:

Receives a DDL command and returns a query that executes it.

Source
insert/3

Specs:

Returns an INSERT for the given fields in table returning the given returning.

Source
query/4

Specs:

  • query(pid, query :: binary, params :: list, opts :: Keyword.t) :: {:ok, %{rows: nil | [tuple], num_rows: non_neg_integer}} | {:error, Exception.t}

Executes the given query with params in connection.

In case of success, it must return an :ok tuple containing a map with at least two keys:

  • :num_rows - the number of rows affected

  • :rows - the result set as a list. nil may be returned instead of the list if the command does not yield any row as result (but still yields the number of affected rows, like a delete command without returning would)
Source
rollback/0

Specs:

Command to rollback transaction.

Source
rollback_to_savepoint/1

Specs:

Command to rollback to savepoint.

Source
savepoint/1

Specs:

Command to emit savepoint.

Source
update/4

Specs:

  • update(table :: String.t, fields :: [atom], filters :: [atom], returning :: [atom]) :: String.t

Returns an UPDATE for the given fields in table filtered by filters returning the given returning.

Source
update_all/1

Specs:

Receives a query and values to update and must return an UPDATE query.

Source