From a1fc15885f48d980a1c9223c3c8bdba19d3a3ee7 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Sat, 6 Jul 2024 18:30:26 -0400 Subject: [PATCH 1/5] Update myxql_test.exs --- test/myxql_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/myxql_test.exs b/test/myxql_test.exs index c8e78d0..9fc3a84 100644 --- a/test/myxql_test.exs +++ b/test/myxql_test.exs @@ -142,17 +142,17 @@ 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", [], 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", [], 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", [], query_type: :binary_then_text, log: log) assert_receive %DBConnection.LogEntry{query: %MyXQL.Query{}} end From a559fd58c85d7d4944777ec11cde92147f9f0873 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Sat, 6 Jul 2024 18:36:47 -0400 Subject: [PATCH 2/5] Update myxql_test.exs --- test/myxql_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/myxql_test.exs b/test/myxql_test.exs index 9fc3a84..b7ebf54 100644 --- a/test/myxql_test.exs +++ b/test/myxql_test.exs @@ -142,17 +142,17 @@ defmodule MyXQLTest do log = &send(self, &1) assert {:ok, %MyXQL.Result{}} = - MyXQL.query(c.conn, "PREPARE", [], query_type: :text, log: log) + MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT VALUES (?)';", [], query_type: :text, log: log) assert_receive %DBConnection.LogEntry{query: %MyXQL.TextQuery{}} assert {:error, %MyXQL.Error{mysql: %{code: 1295}}} = - MyXQL.query(c.conn, "PREPARE", [], query_type: :binary, log: log) + MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT VALUES (?)'", [], query_type: :binary, log: log) assert_receive %DBConnection.LogEntry{query: %MyXQL.Query{}} assert {:ok, %MyXQL.Result{}} = - MyXQL.query(c.conn, "PREPARE", [], query_type: :binary_then_text, log: log) + MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT VALUES (?)'", [], query_type: :binary_then_text, log: log) assert_receive %DBConnection.LogEntry{query: %MyXQL.Query{}} end From 90a190338caf53395adef3c480f00043d0b6a020 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Sat, 6 Jul 2024 18:40:58 -0400 Subject: [PATCH 3/5] Update myxql_test.exs --- test/myxql_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/myxql_test.exs b/test/myxql_test.exs index b7ebf54..4e1cdca 100644 --- a/test/myxql_test.exs +++ b/test/myxql_test.exs @@ -142,17 +142,17 @@ defmodule MyXQLTest do log = &send(self, &1) assert {:ok, %MyXQL.Result{}} = - MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT VALUES (?)';", [], 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, "PREPARE prepared_stmt FROM 'SELECT VALUES (?)'", [], 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, "PREPARE prepared_stmt FROM 'SELECT VALUES (?)'", [], 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 From c0187a766cb6efb7a1d80ae6440123139dcfd836 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Sat, 6 Jul 2024 18:43:42 -0400 Subject: [PATCH 4/5] format --- test/myxql_test.exs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/myxql_test.exs b/test/myxql_test.exs index 4e1cdca..075ce70 100644 --- a/test/myxql_test.exs +++ b/test/myxql_test.exs @@ -142,17 +142,26 @@ defmodule MyXQLTest do log = &send(self, &1) assert {:ok, %MyXQL.Result{}} = - MyXQL.query(c.conn, "PREPARE prepared_stmt FROM 'SELECT 1';", [], 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, "PREPARE prepared_stmt FROM 'SELECT 1';", [], 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, "PREPARE prepared_stmt FROM 'SELECT 1';", [], 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 @@ -167,9 +176,7 @@ defmodule MyXQLTest do test "#{@protocol}: query with multiple rows", c do %MyXQL.Result{num_rows: 2} = - MyXQL.query!(c.conn, "INSERT INTO integers VALUES (10), (20)", [], - query_type: @protocol - ) + MyXQL.query!(c.conn, "INSERT INTO integers VALUES (10), (20)", [], query_type: @protocol) assert {:ok, %MyXQL.Result{columns: ["x"], rows: [[10], [20]]}} = MyXQL.query(c.conn, "SELECT * FROM integers") @@ -181,9 +188,7 @@ defmodule MyXQLTest do values = Enum.map_join(1..num, ", ", &"(#{&1})") result = - MyXQL.query!(c.conn, "INSERT INTO integers VALUES " <> values, [], - query_type: @protocol - ) + MyXQL.query!(c.conn, "INSERT INTO integers VALUES " <> values, [], query_type: @protocol) assert result.num_rows == num From 4755ee931669a04c0ccaba0dc7a9232c7850f980 Mon Sep 17 00:00:00 2001 From: Greg Rychlewski Date: Sat, 6 Jul 2024 18:46:30 -0400 Subject: [PATCH 5/5] format --- test/myxql_test.exs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/myxql_test.exs b/test/myxql_test.exs index 075ce70..bfb3238 100644 --- a/test/myxql_test.exs +++ b/test/myxql_test.exs @@ -176,7 +176,9 @@ defmodule MyXQLTest do test "#{@protocol}: query with multiple rows", c do %MyXQL.Result{num_rows: 2} = - MyXQL.query!(c.conn, "INSERT INTO integers VALUES (10), (20)", [], query_type: @protocol) + MyXQL.query!(c.conn, "INSERT INTO integers VALUES (10), (20)", [], + query_type: @protocol + ) assert {:ok, %MyXQL.Result{columns: ["x"], rows: [[10], [20]]}} = MyXQL.query(c.conn, "SELECT * FROM integers") @@ -188,7 +190,9 @@ defmodule MyXQLTest do values = Enum.map_join(1..num, ", ", &"(#{&1})") result = - MyXQL.query!(c.conn, "INSERT INTO integers VALUES " <> values, [], query_type: @protocol) + MyXQL.query!(c.conn, "INSERT INTO integers VALUES " <> values, [], + query_type: @protocol + ) assert result.num_rows == num