Skip to content

Commit 31a576b

Browse files
Bump exqlite dep to 0.5.8 (#24)
* Bump exqlite dep to 0.5.8 * Do not specify table in returning clause only Co-authored-by: Kevin Lang <me@gnalck.com>
1 parent 106247f commit 31a576b

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

lib/ecto/adapters/sqlite3/connection.ex

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,24 @@ defmodule Ecto.Adapters.SQLite3.Connection do
11281128
'?'
11291129
end
11301130

1131+
# workaround for the fact that SQLite3 as of 3.35.4 does not support specifying table
1132+
# in the returning clause. when a later release adds the ability, this code can be deleted
1133+
def expr(
1134+
{{:., _, [{:parent_as, _, [{:&, _, [_idx]}]}, field]}, _, []},
1135+
_sources,
1136+
%{returning: true}
1137+
)
1138+
when is_atom(field) do
1139+
quote_name(field)
1140+
end
1141+
1142+
# workaround for the fact that SQLite3 as of 3.35.4 does not support specifying table
1143+
# in the returning clause. when a later release adds the ability, this code can be deleted
1144+
def expr({{:., _, [{:&, _, [_idx]}, field]}, _, []}, _sources, %{returning: true})
1145+
when is_atom(field) do
1146+
quote_name(field)
1147+
end
1148+
11311149
def expr(
11321150
{{:., _, [{:parent_as, _, [{:&, _, [idx]}]}, field]}, _, []},
11331151
_sources,
@@ -1609,7 +1627,7 @@ defmodule Ecto.Adapters.SQLite3.Connection do
16091627

16101628
defp returning(%{select: %{fields: fields}} = query, sources) do
16111629
[
1612-
" RETURNING " | select_fields(fields, sources, query)
1630+
" RETURNING " | select_fields(fields, sources, Map.put(query, :returning, true))
16131631
]
16141632
end
16151633

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ecto_sql": {:hex, :ecto_sql, "3.6.0", "5cb277b086618a644f2c5450316202a885716bb7726b9f13b74cb0708bea3a8f", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.6.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3486d6e29ee4a0e7a381390c9c289bfbbaf5dc1971e269c579799d2300e5bd5"},
1111
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
1212
"ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"},
13-
"exqlite": {:hex, :exqlite, "0.5.6", "37e947c5aba201effa3a21dbb8c369f5d0faf97e98a305d8a6797bb7498ef9f0", [:make, :mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0743df317db1e2edd8346991158aaf07441d29c303badee5c6ebcf9a6ab97009"},
13+
"exqlite": {:hex, :exqlite, "0.5.8", "b1942f9f51b27608917ec2f035e69f7ff6d846eccff5157e27c90c14a5d1a168", [:make, :mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "5bed331bf406c27c7dae42040b835f1371018595a9dc218f9b92927e8a7c47c5"},
1414
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
1515
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
1616
"makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"},

test/ecto/adapters/sqlite3/connection_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
13181318
UPDATE posts AS p0 \
13191319
SET title = 'bar' \
13201320
WHERE (p0.title = ?) \
1321-
RETURNING p0.content\
1321+
RETURNING content\
13221322
"""
13231323
end
13241324

@@ -1350,7 +1350,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
13501350
"""
13511351
UPDATE posts AS p0 \
13521352
SET title = 'foo' \
1353-
RETURNING p0.id, p0.title, p0.content\
1353+
RETURNING id, title, content\
13541354
"""
13551355

13561356
query =
@@ -1364,7 +1364,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
13641364
UPDATE schema AS s0 \
13651365
SET x = ? \
13661366
WHERE (s0.x = ?) \
1367-
RETURNING s0.x = ?\
1367+
RETURNING x = ?\
13681368
"""
13691369
end
13701370

@@ -1391,7 +1391,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
13911391
assert delete_all(query) ==
13921392
"""
13931393
DELETE FROM schema AS s0 \
1394-
WHERE (s0.x = 123) RETURNING s0.x\
1394+
WHERE (s0.x = 123) RETURNING x\
13951395
"""
13961396
end
13971397

@@ -1401,7 +1401,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
14011401
assert delete_all(query) ==
14021402
"""
14031403
DELETE FROM posts AS p0 \
1404-
RETURNING p0.id, p0.title, p0.content\
1404+
RETURNING id, title, content\
14051405
"""
14061406
end
14071407

0 commit comments

Comments
 (0)