Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim authored May 18, 2024
1 parent cdbc0f3 commit 5110a78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/myxql/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ defmodule MyXQL.Client do
buffer? = Keyword.has_key?(socket_options, :buffer)
client = %__MODULE__{connection_id: nil, sock: nil}

case :gen_tcp.connect(address, port, @sock_opts ++ socket_options, connect_timeout) do
case :gen_tcp.connect(address, port, socket_options ++ @sock_opts, connect_timeout) do
{:ok, sock} when buffer? ->
{:ok, %{client | sock: {:gen_tcp, sock}}}

Expand Down
8 changes: 2 additions & 6 deletions test/myxql_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,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")
Expand All @@ -178,9 +176,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

Expand Down

0 comments on commit 5110a78

Please sign in to comment.