Ecto.Adapters.SQL.Query behaviour
Specifies the behaviour to be implemented by the connection for handling all SQL queries.
Callbacks
Specs:
- all(Ecto.Query.t) :: String.t
Receives a query and must return a SELECT query.
Specs:
- begin_transaction :: String.t
Command to begin transaction.
Specs:
- commit :: String.t
Command to commit transaction.
Specs:
- ddl_exists(Ecto.Adapter.Migration.ddl_object) :: String.t
Receives a DDL object and returns a query that checks its existence.
Specs:
Returns a DELETE for the filters
returning the given returning
.
Specs:
- delete_all(Ecto.Query.t) :: String.t
Receives a query and must return a DELETE query.
Specs:
- execute_ddl(Ecto.Adapter.Migration.command) :: String.t
Receives a DDL command and returns a query that executes it.
Specs:
Returns an INSERT for the given fields
in table
returning
the given returning
.
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 adelete
command without returning would)
Specs:
- rollback :: String.t
Command to rollback transaction.
Specs:
Command to rollback to savepoint.
Specs:
Command to emit savepoint.
Specs:
Returns an UPDATE for the given fields
in table
filtered by
filters
returning the given returning
.
Specs:
- update_all(Ecto.Query.t) :: String.t
Receives a query and values to update and must return an UPDATE query.