Skip to content

Commit

Permalink
Make non preparable statement test compatible with future mariadb ver…
Browse files Browse the repository at this point in the history
…sions (#191)
  • Loading branch information
greg-rychlewski authored Jul 6, 2024
1 parent 7fd16ec commit 7d875e2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/myxql_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,26 @@ defmodule MyXQLTest do
log = &send(self, &1)

assert {:ok, %MyXQL.Result{}} =
MyXQL.query(c.conn, "BEGIN", [], query_type: :text, log: log)
MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT 1';", [],
query_type: :text,
log: log
)

assert_receive %DBConnection.LogEntry{query: %MyXQL.TextQuery{}}

assert {:error, %MyXQL.Error{mysql: %{code: 1295}}} =
MyXQL.query(c.conn, "BEGIN", [], query_type: :binary, log: log)
MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT 1';", [],
query_type: :binary,
log: log
)

assert_receive %DBConnection.LogEntry{query: %MyXQL.Query{}}

assert {:ok, %MyXQL.Result{}} =
MyXQL.query(c.conn, "BEGIN", [], query_type: :binary_then_text, log: log)
MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT 1';", [],
query_type: :binary_then_text,
log: log
)

assert_receive %DBConnection.LogEntry{query: %MyXQL.Query{}}
end
Expand Down

0 comments on commit 7d875e2

Please sign in to comment.