Skip to content

Commit 059a059

Browse files
committed
Document passing Repo.get_dynamic_repo(), closes #701
1 parent 271b544 commit 059a059

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/ecto/adapters/sql.ex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ defmodule Ecto.Adapters.SQL do
3939
4040
Generally speaking, you must invoke those functions directly from
4141
your repository, for example: `MyApp.Repo.query("SELECT true")`.
42+
4243
You can also invoke them directly from `Ecto.Adapters.SQL`, but
43-
keep in mind that in such cases features such as "dynamic repositories"
44-
won't be available.
44+
keep in mind that in such cases the "dynamic repository" functionality
45+
is not available by default. Instead, you must explicitly call
46+
`YouRepo.get_dynamic_repo()` and pass it as first argument.
4547
4648
## Migrations
4749
@@ -319,17 +321,20 @@ defmodule Ecto.Adapters.SQL do
319321
320322
If the query was successful, it will return an `:ok` tuple containing
321323
a map with at least two keys:
324+
322325
* `:num_rows` - the number of rows affected
323326
* `:rows` - the result set as a list. `nil` may be returned
324327
instead of the list if the command does not yield any row
325328
as result (but still yields the number of affected rows,
326329
like a `delete` command without returning would)
327330
328331
## Options
332+
329333
* `:log` - When false, does not log the query
330334
* `:timeout` - Execute request timeout, accepts: `:infinity` (default: `#{@timeout}`);
331335
332336
## Examples
337+
333338
iex> MyRepo.query("SELECT $1::integer + $2", [40, 2])
334339
{:ok, %{rows: [[42]], num_rows: 1}}
335340

0 commit comments

Comments
 (0)