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 ec3472a commit 347059c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions integration_test/myxql/prepare_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Ecto.Integration.PrepareTest do
use Ecto.Integration.Case, async: true
use Ecto.Integration.Case, async: false

alias Ecto.Integration.TestRepo
alias Ecto.Integration.Post
Expand All @@ -9,17 +9,22 @@ defmodule Ecto.Integration.PrepareTest do
two = TestRepo.insert!(%Post{title: "two"})

stmt_count_query = "SHOW GLOBAL STATUS LIKE '%prepared_stmt_count%'"
assert %{rows: [[orig_count]]} = TestRepo.query(stmt_count_query, [])

# Uncached
assert TestRepo.all(Post, prepare: :unnamed) == [one, two]
assert %{rows: [[0]]} = TestRepo.query(stmt_count_query, [])
%{rows: [[new_count]]} = TestRepo.query(stmt_count_query, [])
assert new_count == orig_count
assert TestRepo.all(Post, prepare: :named) == [one, two]
assert %{rows: [[1]]} = TestRepo.query(stmt_count_query, [])
assert %{rows: [[new_count]]} = TestRepo.query(stmt_count_query, [])
assert new_count == orig_count + 1

# Cached
assert TestRepo.all(Post, prepare: :unnamed) == [one, two]
assert %{rows: [[1]]} = TestRepo.query(stmt_count_query, [])
assert %{rows: [[new_count]]} = TestRepo.query(stmt_count_query, [])
assert new_count == orig_count + 1
assert TestRepo.all(Post, prepare: :named) == [one, two]
assert %{rows: [[1]]} = TestRepo.query(stmt_count_query, [])
assert %{rows: [[new_count]]} = TestRepo.query(stmt_count_query, [])
assert new_count == orig_count + 1
end
end

0 comments on commit 347059c

Please sign in to comment.