diff --git a/lib/data_layer.ex b/lib/data_layer.ex index dbea911..9048f51 100644 --- a/lib/data_layer.ex +++ b/lib/data_layer.ex @@ -1363,7 +1363,12 @@ defmodule AshSqlite.DataLayer do case AshSql.Atomics.query_with_atomics( resource, - query, + AshSql.Bindings.default_bindings( + query, + resource, + AshSqlite.SqlImplementation, + changeset.context + ), changeset.filter, changeset.atomics, ecto_changeset.changes, diff --git a/lib/sql_implementation.ex b/lib/sql_implementation.ex index 11fd5e0..46a66cb 100644 --- a/lib/sql_implementation.ex +++ b/lib/sql_implementation.ex @@ -128,7 +128,7 @@ defmodule AshSqlite.SqlImplementation do def type_expr(expr, type) do case type do - {:parameterized, inner_type, constraints} -> + {:parameterized, {inner_type, constraints}} -> if inner_type.type(constraints) == :ci_string do Ecto.Query.dynamic(fragment("(? COLLATE NOCASE)", ^expr)) else diff --git a/mix.lock b/mix.lock index 7c7de0e..d598ae1 100644 --- a/mix.lock +++ b/mix.lock @@ -11,7 +11,7 @@ "ecto": {:hex, :ecto, "3.12.1", "626765f7066589de6fa09e0876a253ff60c3d00870dd3a1cd696e2ba67bfceea", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "df0045ab9d87be947228e05a8d153f3e06e0d05ab10c3b3cc557d2f7243d1940"}, "ecto_sql": {:hex, :ecto_sql, "3.12.0", "73cea17edfa54bde76ee8561b30d29ea08f630959685006d9c6e7d1e59113b7d", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dc9e4d206f274f3947e96142a8fdc5f69a2a6a9abb4649ef5c882323b6d512f0"}, "ecto_sqlite3": {:hex, :ecto_sqlite3, "0.17.0", "081c473dc662b42b8ce8f68c21fcf4a8dc52ce98ccc762cd6d45e583a7bdf445", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.11", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.11", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:exqlite, "~> 0.22", [hex: :exqlite, repo: "hexpm", optional: false]}], "hexpm", "68686c97accb1369012a957bf6da85d71db4b358529a4513695d78fce92b82f2"}, - "elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"}, + "elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ets": {:hex, :ets, "0.9.0", "79c6a6c205436780486f72d84230c6cba2f8a9920456750ddd1e47389107d5fd", [:mix], [], "hexpm", "2861fdfb04bcaeff370f1a5904eec864f0a56dcfebe5921ea9aadf2a481c822b"}, "ex_check": {:hex, :ex_check, "0.16.0", "07615bef493c5b8d12d5119de3914274277299c6483989e52b0f6b8358a26b5f", [:mix], [], "hexpm", "4d809b72a18d405514dda4809257d8e665ae7cf37a7aee3be6b74a34dec310f5"}, diff --git a/test/filter_test.exs b/test/filter_test.exs index 6fc8095..c623d49 100644 --- a/test/filter_test.exs +++ b/test/filter_test.exs @@ -371,6 +371,8 @@ defmodule AshSqlite.FilterTest do |> Ash.Changeset.for_create(:create, %{category: "bazbuz"}) |> Ash.create!() + Logger.configure(level: :debug) + assert [%{title: "match"}] = Post |> Ash.Query.filter(category == "fOoBaR")