Skip to content

Commit af00afa

Browse files
Remove fragment constant/1 handling (#714)
1 parent ecd87ed commit af00afa

File tree

5 files changed

+2
-26
lines changed

5 files changed

+2
-26
lines changed

lib/ecto/adapters/myxql/connection.ex

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -770,14 +770,6 @@ if Code.ensure_loaded?(MyXQL) do
770770
quote_name(literal)
771771
end
772772

773-
defp expr({:constant, _, [literal]}, _sources, _query) when is_binary(literal) do
774-
[?', escape_string(literal), ?']
775-
end
776-
777-
defp expr({:constant, _, [literal]}, _sources, _query) when is_number(literal) do
778-
[to_string(literal)]
779-
end
780-
781773
defp expr({:splice, _, [{:^, _, [_, length]}]}, _sources, _query) do
782774
Enum.intersperse(List.duplicate(??, length), ?,)
783775
end

lib/ecto/adapters/postgres/connection.ex

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -995,14 +995,6 @@ if Code.ensure_loaded?(Postgrex) do
995995
quote_name(literal)
996996
end
997997

998-
defp expr({:constant, _, [literal]}, _sources, _query) when is_binary(literal) do
999-
[?', escape_string(literal), ?']
1000-
end
1001-
1002-
defp expr({:constant, _, [literal]}, _sources, _query) when is_number(literal) do
1003-
[to_string(literal)]
1004-
end
1005-
1006998
defp expr({:splice, _, [{:^, _, [idx, length]}]}, _sources, _query) do
1007999
Enum.map_join(1..length, ",", &"$#{idx + &1}")
10081000
end

lib/ecto/adapters/tds/connection.ex

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -830,14 +830,6 @@ if Code.ensure_loaded?(Tds) do
830830
quote_name(literal)
831831
end
832832

833-
defp expr({:constant, _, [literal]}, _sources, _query) when is_binary(literal) do
834-
[?', escape_string(literal), ?']
835-
end
836-
837-
defp expr({:constant, _, [literal]}, _sources, _query) when is_number(literal) do
838-
[to_string(literal)]
839-
end
840-
841833
defp expr({:splice, _, [{:^, _, [idx, length]}]}, _sources, _query) do
842834
list_param_to_args(idx, length)
843835
end

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"},
77
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
88
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
9-
"ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "3ab6a20b255fe2cee1fd9f6ae160c6fde772dce7", [branch: "master"]},
9+
"ecto": {:git, "https://github.com/elixir-ecto/ecto.git", "7224c12734f1a2ad4b87ba769db87dbc80be3468", [branch: "master"]},
1010
"ex_doc": {:hex, :ex_doc, "0.39.1", "e19d356a1ba1e8f8cfc79ce1c3f83884b6abfcb79329d435d4bbb3e97ccc286e", [:mix], [{:earmark_parser, "~> 1.4.44", [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", "8abf0ed3e3ca87c0847dfc4168ceab5bedfe881692f1b7c45f4a11b232806865"},
1111
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
1212
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},

test/ecto/adapters/tds_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ defmodule Ecto.Adapters.TdsTest do
698698
assert all(query) == ~s{SELECT TOP(1) s0.[x] FROM [schema] AS s0}
699699

700700
query = Schema |> select(fragment("?", constant(^"let's escape"))) |> plan()
701-
assert all(query) == ~s{SELECT 'let''s escape' FROM [schema] AS s0}
701+
assert all(query) == ~s{SELECT N'let''s escape' FROM [schema] AS s0}
702702

703703
query =
704704
Schema

0 commit comments

Comments
 (0)