Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain/4 docs #456

Merged
merged 4 commits into from
Nov 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions lib/ecto/adapters/sql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -311,24 +311,27 @@ defmodule Ecto.Adapters.SQL do

Adapter | Supported opts
---------------- | --------------
Postgrex | `analyze`, `verbose`, `costs`, `settings`, `buffers`, `timing`, `summary`
MyXQL | None
Postgrex | `analyze`, `verbose`, `costs`, `settings`, `buffers`, `timing`, `summary`, `format`
MyXQL | `format`

_Postgrex_: Check [PostgreSQL doc](https://www.postgresql.org/docs/current/sql-explain.html)
for version compatibility.
All options except `format` are boolean valued and default to `false`.

Also note that:
The allowed `format` values are `:map`, `:yaml`, and `:text`:
* `:map` is the deserialized JSON encoding.
* `:yaml` and `:text` return the result as a string.

* Currently `:map`, `:yaml`, and `:text` format options are supported
for PostgreSQL. Only `map` and `text` are supported for MyXQL.
* `:map` is the deserialized JSON encoding.
* `:yaml` and `text` return the result as a string;
The built-in adapters support the following formats:
* Postgrex: `:map`, `:yaml` and `:text`
* MyXQL: `:map` and `:text`

* Any other value passed to `opts` will be forwarded to the underlying
adapter query function, including Repo shared options such as `:timeout`;
Any other value passed to `opts` will be forwarded to the underlying adapter query function, including
shared Repo options such as `:timeout`. Non built-in adapters may have specific behaviour and you should
consult their documentation for more details.

* Non built-in adapters may have specific behavior and you should consult
their own documentation.
For version compatiblity, please check your database's documentation:

* _Postgrex_: [PostgreSQL doc](https://www.postgresql.org/docs/current/sql-explain.html).
* _MyXQL_: [MySQL doc](https://dev.mysql.com/doc/refman/8.0/en/explain.html).

"""
@spec explain(pid() | Ecto.Repo.t | Ecto.Adapter.adapter_meta,
Expand Down