From e000147f6c15fbcb91d81388eabd5874efc02e5d Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Wed, 8 Jan 2025 22:55:45 -0500 Subject: [PATCH 1/5] Revert "Allow numbers in `literal/1` (#651)" This reverts commit 510cd901fa4ae74a8eebd60fffb3abcb49068462. --- lib/ecto/adapters/myxql/connection.ex | 6 +----- lib/ecto/adapters/postgres/connection.ex | 6 +----- lib/ecto/adapters/tds/connection.ex | 6 +----- mix.lock | 2 +- test/ecto/adapters/myxql_test.exs | 3 --- test/ecto/adapters/postgres_test.exs | 3 --- test/ecto/adapters/tds_test.exs | 3 --- 7 files changed, 4 insertions(+), 25 deletions(-) diff --git a/lib/ecto/adapters/myxql/connection.ex b/lib/ecto/adapters/myxql/connection.ex index af4bd0cf..980561ac 100644 --- a/lib/ecto/adapters/myxql/connection.ex +++ b/lib/ecto/adapters/myxql/connection.ex @@ -746,14 +746,10 @@ if Code.ensure_loaded?(MyXQL) do [?(, values_list(types, num_rows, query), ?)] end - defp expr({:literal, _, [literal]}, _sources, _query) when is_binary(literal) do + defp expr({:literal, _, [literal]}, _sources, _query) do quote_name(literal) end - defp expr({:literal, _, [literal]}, _sources, _query) when is_number(literal) do - [to_string(literal)] - end - defp expr({:splice, _, [{:^, _, [_, length]}]}, _sources, _query) do Enum.intersperse(List.duplicate(??, length), ?,) end diff --git a/lib/ecto/adapters/postgres/connection.ex b/lib/ecto/adapters/postgres/connection.ex index bbce337f..c583239f 100644 --- a/lib/ecto/adapters/postgres/connection.ex +++ b/lib/ecto/adapters/postgres/connection.ex @@ -987,14 +987,10 @@ if Code.ensure_loaded?(Postgrex) do [?(, values_list(types, idx + 1, num_rows), ?)] end - defp expr({:literal, _, [literal]}, _sources, _query) when is_binary(literal) do + defp expr({:literal, _, [literal]}, _sources, _query) do quote_name(literal) end - defp expr({:literal, _, [literal]}, _sources, _query) when is_number(literal) do - [to_string(literal)] - end - defp expr({:splice, _, [{:^, _, [idx, length]}]}, _sources, _query) do Enum.map_join(1..length, ",", &"$#{idx + &1}") end diff --git a/lib/ecto/adapters/tds/connection.ex b/lib/ecto/adapters/tds/connection.ex index 1f4a4555..8d1e0e9a 100644 --- a/lib/ecto/adapters/tds/connection.ex +++ b/lib/ecto/adapters/tds/connection.ex @@ -826,14 +826,10 @@ if Code.ensure_loaded?(Tds) do [?(, values_list(types, idx + 1, num_rows), ?)] end - defp expr({:literal, _, [literal]}, _sources, _query) when is_binary(literal) do + defp expr({:literal, _, [literal]}, _sources, _query) do quote_name(literal) end - defp expr({:literal, _, [literal]}, _sources, _query) when is_number(literal) do - [to_string(literal)] - end - defp expr({:splice, _, [{:^, _, [idx, length]}]}, _sources, _query) do list_param_to_args(idx, length) end diff --git a/mix.lock b/mix.lock index c2e00011..19e478f4 100644 --- a/mix.lock +++ b/mix.lock @@ -4,7 +4,7 @@ "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, - "ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "3ab8279b574b0162372c838441ce9ec1772a71e1", []}, + "ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "4990abda4c504133f89deed469582785166208f5", []}, "ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"}, "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, diff --git a/test/ecto/adapters/myxql_test.exs b/test/ecto/adapters/myxql_test.exs index 8f415962..1d0e9c0f 100644 --- a/test/ecto/adapters/myxql_test.exs +++ b/test/ecto/adapters/myxql_test.exs @@ -658,9 +658,6 @@ defmodule Ecto.Adapters.MyXQLTest do query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0.`x` COLLATE `es_ES` FROM `schema` AS s0} - query = Schema |> select([r], r.x) |> limit(fragment("?", literal(^1))) |> plan() - assert all(query) == ~s{SELECT s0.`x` FROM `schema` AS s0 LIMIT 1} - query = Schema |> select([r], r.x) diff --git a/test/ecto/adapters/postgres_test.exs b/test/ecto/adapters/postgres_test.exs index f82c9813..f37b6786 100644 --- a/test/ecto/adapters/postgres_test.exs +++ b/test/ecto/adapters/postgres_test.exs @@ -838,9 +838,6 @@ defmodule Ecto.Adapters.PostgresTest do query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} - query = Schema |> select([r], r.x) |> limit(fragment("?", literal(^1))) |> plan() - assert all(query) == ~s{SELECT s0."x" FROM "schema" AS s0 LIMIT 1} - query = Schema |> select([r], r.x) diff --git a/test/ecto/adapters/tds_test.exs b/test/ecto/adapters/tds_test.exs index 7a373f9b..a3563267 100644 --- a/test/ecto/adapters/tds_test.exs +++ b/test/ecto/adapters/tds_test.exs @@ -694,9 +694,6 @@ defmodule Ecto.Adapters.TdsTest do query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0.[x] COLLATE [es_ES] FROM [schema] AS s0} - query = Schema |> select([r], r.x) |> limit(fragment("?", literal(^1))) |> plan() - assert all(query) == ~s{SELECT TOP(1) s0.[x] FROM [schema] AS s0} - query = Schema |> select([r], r.x) From 93d8c681803e83a489389a443e2e33e5a7e144ba Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Wed, 8 Jan 2025 23:04:51 -0500 Subject: [PATCH 2/5] introduce_identifier_constant --- lib/ecto/adapters/myxql/connection.ex | 12 ++++++++++++ lib/ecto/adapters/postgres/connection.ex | 12 ++++++++++++ lib/ecto/adapters/tds/connection.ex | 12 ++++++++++++ mix.exs | 2 +- test/ecto/adapters/myxql_test.exs | 9 +++++++++ test/ecto/adapters/postgres_test.exs | 9 +++++++++ test/ecto/adapters/tds_test.exs | 9 +++++++++ 7 files changed, 64 insertions(+), 1 deletion(-) diff --git a/lib/ecto/adapters/myxql/connection.ex b/lib/ecto/adapters/myxql/connection.ex index 980561ac..f9158251 100644 --- a/lib/ecto/adapters/myxql/connection.ex +++ b/lib/ecto/adapters/myxql/connection.ex @@ -750,6 +750,18 @@ if Code.ensure_loaded?(MyXQL) do quote_name(literal) end + defp expr({:identifier, _, [literal]}, _sources, _query) do + quote_name(literal) + end + + defp expr({:constant, _, [literal]}, _sources, _query) when is_binary(literal) do + [?', escape_string(literal), ?'] + end + + defp expr({:constant, _, [literal]}, _sources, _query) when is_number(literal) do + [to_string(literal)] + end + defp expr({:splice, _, [{:^, _, [_, length]}]}, _sources, _query) do Enum.intersperse(List.duplicate(??, length), ?,) end diff --git a/lib/ecto/adapters/postgres/connection.ex b/lib/ecto/adapters/postgres/connection.ex index c583239f..c9f9ac56 100644 --- a/lib/ecto/adapters/postgres/connection.ex +++ b/lib/ecto/adapters/postgres/connection.ex @@ -991,6 +991,18 @@ if Code.ensure_loaded?(Postgrex) do quote_name(literal) end + defp expr({:identifier, _, [literal]}, _sources, _query) do + quote_name(literal) + end + + defp expr({:constant, _, [literal]}, _sources, _query) when is_binary(literal) do + [?', escape_string(literal), ?'] + end + + defp expr({:constant, _, [literal]}, _sources, _query) when is_number(literal) do + [to_string(literal)] + end + defp expr({:splice, _, [{:^, _, [idx, length]}]}, _sources, _query) do Enum.map_join(1..length, ",", &"$#{idx + &1}") end diff --git a/lib/ecto/adapters/tds/connection.ex b/lib/ecto/adapters/tds/connection.ex index 8d1e0e9a..23a95978 100644 --- a/lib/ecto/adapters/tds/connection.ex +++ b/lib/ecto/adapters/tds/connection.ex @@ -830,6 +830,18 @@ if Code.ensure_loaded?(Tds) do quote_name(literal) end + defp expr({:identifier, _, [literal]}, _sources, _query) do + quote_name(literal) + end + + defp expr({:constant, _, [literal]}, _sources, _query) when is_binary(literal) do + [?', escape_string(literal), ?'] + end + + defp expr({:constant, _, [literal]}, _sources, _query) when is_number(literal) do + [to_string(literal)] + end + defp expr({:splice, _, [{:^, _, [idx, length]}]}, _sources, _query) do list_param_to_args(idx, length) end diff --git a/mix.exs b/mix.exs index f7847df9..0f0c41ba 100644 --- a/mix.exs +++ b/mix.exs @@ -76,7 +76,7 @@ defmodule EctoSQL.MixProject do if path = System.get_env("ECTO_PATH") do {:ecto, path: path} else - {:ecto, github: "elixir-ecto/ecto"} + {:ecto, git: "https://github.com/greg-rychlewski/ecto.git", branch: "literals_take_2"} end end diff --git a/test/ecto/adapters/myxql_test.exs b/test/ecto/adapters/myxql_test.exs index 1d0e9c0f..d0bb825d 100644 --- a/test/ecto/adapters/myxql_test.exs +++ b/test/ecto/adapters/myxql_test.exs @@ -658,6 +658,15 @@ defmodule Ecto.Adapters.MyXQLTest do query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0.`x` COLLATE `es_ES` FROM `schema` AS s0} + query = Schema |> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES"))) |> plan() + assert all(query) == ~s{SELECT s0.`x` COLLATE `es_ES` FROM `schema` AS s0} + + query = Schema |> select([r], r.x) |> limit(fragment("?", constant(^1))) |> plan() + assert all(query) == ~s{SELECT s0.`x` FROM `schema` AS s0 LIMIT 1} + + query = Schema |> select(fragment("?", constant(^"let's escape"))) |> plan() + assert all(query) == ~s{SELECT 'let''s escape' FROM `schema` AS s0} + query = Schema |> select([r], r.x) diff --git a/test/ecto/adapters/postgres_test.exs b/test/ecto/adapters/postgres_test.exs index f37b6786..d25e27a2 100644 --- a/test/ecto/adapters/postgres_test.exs +++ b/test/ecto/adapters/postgres_test.exs @@ -838,6 +838,15 @@ defmodule Ecto.Adapters.PostgresTest do query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} + query = Schema |> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES"))) |> plan() + assert all(query) == ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} + + query = Schema |> select([r], r.x) |> limit(fragment("?", constant(^1))) |> plan() + assert all(query) == ~s{SELECT s0."x" FROM "schema" AS s0 LIMIT 1} + + query = Schema |> select(fragment("?", constant(^"let's escape"))) |> plan() + assert all(query) == ~s{SELECT 'let''s escape' FROM "schema" AS s0} + query = Schema |> select([r], r.x) diff --git a/test/ecto/adapters/tds_test.exs b/test/ecto/adapters/tds_test.exs index a3563267..f9c8030c 100644 --- a/test/ecto/adapters/tds_test.exs +++ b/test/ecto/adapters/tds_test.exs @@ -694,6 +694,15 @@ defmodule Ecto.Adapters.TdsTest do query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0.[x] COLLATE [es_ES] FROM [schema] AS s0} + query = Schema |> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES"))) |> plan() + assert all(query) == ~s{SELECT s0.[x] COLLATE [es_ES] FROM [schema] AS s0} + + query = Schema |> select([r], r.x) |> limit(fragment("?", constant(^1))) |> plan() + assert all(query) == ~s{SELECT TOP(1) s0.[x] FROM [schema] AS s0} + + query = Schema |> select(fragment("?", constant(^"let's escape"))) |> plan() + assert all(query) == ~s{SELECT 'let''s escape' FROM [schema] AS s0} + query = Schema |> select([r], r.x) From 6486675745d1e31e910de4076bfa3ab9ed04c77f Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Wed, 8 Jan 2025 23:05:17 -0500 Subject: [PATCH 3/5] point to ecto pr --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index 19e478f4..6c9e7433 100644 --- a/mix.lock +++ b/mix.lock @@ -4,7 +4,7 @@ "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, - "ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "4990abda4c504133f89deed469582785166208f5", []}, + "ecto": {:git, "https://github.com/greg-rychlewski/ecto.git", "c161ae3a4c6d0ed55ea7d076bc672b1a301546db", [branch: "literals_take_2"]}, "ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"}, "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, From 003de81a9189e5e879c81ab700433876c5225ac3 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Thu, 9 Jan 2025 04:59:34 -0500 Subject: [PATCH 4/5] review comment from ecto --- lib/ecto/adapters/myxql/connection.ex | 4 ---- lib/ecto/adapters/postgres/connection.ex | 4 ---- lib/ecto/adapters/tds/connection.ex | 4 ---- test/ecto/adapters/myxql_test.exs | 3 --- test/ecto/adapters/postgres_test.exs | 3 --- test/ecto/adapters/tds_test.exs | 3 --- 6 files changed, 21 deletions(-) diff --git a/lib/ecto/adapters/myxql/connection.ex b/lib/ecto/adapters/myxql/connection.ex index f9158251..61e2f40c 100644 --- a/lib/ecto/adapters/myxql/connection.ex +++ b/lib/ecto/adapters/myxql/connection.ex @@ -746,10 +746,6 @@ if Code.ensure_loaded?(MyXQL) do [?(, values_list(types, num_rows, query), ?)] end - defp expr({:literal, _, [literal]}, _sources, _query) do - quote_name(literal) - end - defp expr({:identifier, _, [literal]}, _sources, _query) do quote_name(literal) end diff --git a/lib/ecto/adapters/postgres/connection.ex b/lib/ecto/adapters/postgres/connection.ex index c9f9ac56..13cc10e5 100644 --- a/lib/ecto/adapters/postgres/connection.ex +++ b/lib/ecto/adapters/postgres/connection.ex @@ -987,10 +987,6 @@ if Code.ensure_loaded?(Postgrex) do [?(, values_list(types, idx + 1, num_rows), ?)] end - defp expr({:literal, _, [literal]}, _sources, _query) do - quote_name(literal) - end - defp expr({:identifier, _, [literal]}, _sources, _query) do quote_name(literal) end diff --git a/lib/ecto/adapters/tds/connection.ex b/lib/ecto/adapters/tds/connection.ex index 23a95978..deb6a897 100644 --- a/lib/ecto/adapters/tds/connection.ex +++ b/lib/ecto/adapters/tds/connection.ex @@ -826,10 +826,6 @@ if Code.ensure_loaded?(Tds) do [?(, values_list(types, idx + 1, num_rows), ?)] end - defp expr({:literal, _, [literal]}, _sources, _query) do - quote_name(literal) - end - defp expr({:identifier, _, [literal]}, _sources, _query) do quote_name(literal) end diff --git a/test/ecto/adapters/myxql_test.exs b/test/ecto/adapters/myxql_test.exs index d0bb825d..b8846454 100644 --- a/test/ecto/adapters/myxql_test.exs +++ b/test/ecto/adapters/myxql_test.exs @@ -655,9 +655,6 @@ defmodule Ecto.Adapters.MyXQLTest do query = Schema |> select([r], r.x) |> where([], fragment("? = \"query\\?\"", ^10)) |> plan() assert all(query) == ~s{SELECT s0.`x` FROM `schema` AS s0 WHERE (? = \"query?\")} - query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() - assert all(query) == ~s{SELECT s0.`x` COLLATE `es_ES` FROM `schema` AS s0} - query = Schema |> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0.`x` COLLATE `es_ES` FROM `schema` AS s0} diff --git a/test/ecto/adapters/postgres_test.exs b/test/ecto/adapters/postgres_test.exs index d25e27a2..9bb21a61 100644 --- a/test/ecto/adapters/postgres_test.exs +++ b/test/ecto/adapters/postgres_test.exs @@ -835,9 +835,6 @@ defmodule Ecto.Adapters.PostgresTest do query = Schema |> select([r], fragment("downcase(?)", r.x)) |> plan() assert all(query) == ~s{SELECT downcase(s0."x") FROM "schema" AS s0} - query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() - assert all(query) == ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} - query = Schema |> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0."x" COLLATE "es_ES" FROM "schema" AS s0} diff --git a/test/ecto/adapters/tds_test.exs b/test/ecto/adapters/tds_test.exs index f9c8030c..c7f402bc 100644 --- a/test/ecto/adapters/tds_test.exs +++ b/test/ecto/adapters/tds_test.exs @@ -691,9 +691,6 @@ defmodule Ecto.Adapters.TdsTest do query = Schema |> select([r], fragment("lower(?)", r.x)) |> plan() assert all(query) == ~s{SELECT lower(s0.[x]) FROM [schema] AS s0} - query = Schema |> select([r], fragment("? COLLATE ?", r.x, literal(^"es_ES"))) |> plan() - assert all(query) == ~s{SELECT s0.[x] COLLATE [es_ES] FROM [schema] AS s0} - query = Schema |> select([r], fragment("? COLLATE ?", r.x, identifier(^"es_ES"))) |> plan() assert all(query) == ~s{SELECT s0.[x] COLLATE [es_ES] FROM [schema] AS s0} From 8298e8464219e35de6edf7ae1f70bf657a3d7a44 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Thu, 9 Jan 2025 08:59:05 -0500 Subject: [PATCH 5/5] point to ecto repo --- mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 0f0c41ba..f7847df9 100644 --- a/mix.exs +++ b/mix.exs @@ -76,7 +76,7 @@ defmodule EctoSQL.MixProject do if path = System.get_env("ECTO_PATH") do {:ecto, path: path} else - {:ecto, git: "https://github.com/greg-rychlewski/ecto.git", branch: "literals_take_2"} + {:ecto, github: "elixir-ecto/ecto"} end end diff --git a/mix.lock b/mix.lock index 6c9e7433..e41ac79d 100644 --- a/mix.lock +++ b/mix.lock @@ -4,7 +4,7 @@ "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, - "ecto": {:git, "https://github.com/greg-rychlewski/ecto.git", "c161ae3a4c6d0ed55ea7d076bc672b1a301546db", [branch: "literals_take_2"]}, + "ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "b02e921b7d2a2a4d5a73fe0ead6500a6bec9d207", []}, "ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"}, "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},