Skip to content

Commit 1224931

Browse files
committed
chore: accept a counter option in prepare_query/3
1 parent a7f390f commit 1224931

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/ecto/adapter/queryable.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,14 @@ defmodule Ecto.Adapter.Queryable do
104104
def prepare_query(operation, repo_name_or_pid, queryable, opts \\ []) do
105105
%{adapter: adapter, cache: cache} = Ecto.Repo.Registry.lookup(repo_name_or_pid)
106106

107-
query_cache? = Keyword.get(opts, :query_cache, true)
107+
counter = Keyword.get(opts, :counter, 0)
108+
query_cache? = if counter != 0, do: false, else: Keyword.get(opts, :query_cache, true)
108109

109110
{_meta, prepared, _cast_params, dump_params} =
110111
queryable
111112
|> Ecto.Queryable.to_query()
112113
|> Ecto.Query.Planner.ensure_select(operation == :all)
113-
|> Ecto.Query.Planner.query(operation, cache, adapter, 0, query_cache?)
114+
|> Ecto.Query.Planner.query(operation, cache, adapter, counter, query_cache?)
114115

115116
{prepared, dump_params}
116117
end

0 commit comments

Comments
 (0)