Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-rychlewski committed Jan 3, 2025
1 parent 0441860 commit a501347
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions integration_test/myxql/prepare_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ defmodule Ecto.Integration.PrepareTest do
alias Ecto.Integration.Post

test "prepare option" do
one = TestRepo.insert!(%Post{title: "one"})
two = TestRepo.insert!(%Post{title: "two"})
TestRepo.insert!(%Post{title: "one"})

stmt_count_query = "SHOW GLOBAL STATUS LIKE '%prepared_stmt_count%'"
assert %{rows: [[_, orig_count]]} = TestRepo.query!(stmt_count_query, [])
Expand All @@ -17,20 +16,20 @@ defmodule Ecto.Integration.PrepareTest do
query = from p in Post, select: fragment("'mxql test prepare option'")

# Uncached
assert TestRepo.all(query, prepare: :unnamed) == [one, two]
assert TestRepo.all(query, prepare: :unnamed) == ["mxql test prepare option"]
%{rows: [[_, new_count]]} = TestRepo.query!(stmt_count_query, [])
assert String.to_integer(new_count) == orig_count

assert TestRepo.all(query, prepare: :named) == [one, two]
assert TestRepo.all(query, prepare: :named) == ["mxql test prepare option"]
assert %{rows: [[_, new_count]]} = TestRepo.query!(stmt_count_query, [])
assert String.to_integer(new_count) == orig_count + 1

# Cached
assert TestRepo.all(query, prepare: :unnamed) == [one, two]
assert TestRepo.all(query, prepare: :unnamed) == ["mxql test prepare option"]
assert %{rows: [[_, new_count]]} = TestRepo.query!(stmt_count_query, [])
assert String.to_integer(new_count) == orig_count + 1

assert TestRepo.all(query, prepare: :named) == [one, two]
assert TestRepo.all(query, prepare: :named) == ["mxql test prepare option"]
assert %{rows: [[_, new_count]]} = TestRepo.query!(stmt_count_query, [])
assert String.to_integer(new_count) == orig_count + 1
end
Expand Down

0 comments on commit a501347

Please sign in to comment.