Skip to content

Commit

Permalink
Merge pull request #135 from whatyouhide/fix-elixir-1.4-warnings
Browse files Browse the repository at this point in the history
Fix a bunch of Elixir 1.4 warnings
  • Loading branch information
liveforeverx committed Sep 27, 2016
2 parents e4e2b5c + 37eeb4d commit a0aa98b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/mariaex/connection/ssl.ex
Expand Up @@ -7,9 +7,9 @@ defmodule Mariaex.Connection.Ssl do
{:ssl, ^sock, buffer} ->
{:ok, buffer}
{:ssl_closed, ^sock} ->
{:disconnect, {tag, "async_recv", :closed, buffer}}
{:disconnect, {tag(), "async_recv", :closed, buffer}}
{:ssl_error, ^sock, reason} ->
{:disconnect, {tag, "async_recv", reason, buffer}}
{:disconnect, {tag(), "async_recv", reason, buffer}}
after
timeout ->
{:ok, <<>>}
Expand Down
4 changes: 2 additions & 2 deletions lib/mariaex/connection/tcp.ex
Expand Up @@ -24,9 +24,9 @@ defmodule Mariaex.Connection.Tcp do
{:tcp, ^sock, buffer} ->
{:ok, buffer}
{:tcp_closed, ^sock} ->
{:disconnect, {tag, "async_recv", :closed, buffer}}
{:disconnect, {tag(), "async_recv", :closed, buffer}}
{:tcp_error, ^sock, reason} ->
{:disconnect, {tag, "async_recv", reason, buffer}}
{:disconnect, {tag(), "async_recv", reason, buffer}}
after
timeout ->
{:ok, <<>>}
Expand Down
4 changes: 2 additions & 2 deletions lib/mariaex/lru_cache.ex
Expand Up @@ -27,11 +27,11 @@ defmodule Mariaex.LruCache do

def insert({size, cache}, statement, data, cleanup) do
if :ets.info(cache, :size) > size, do: remove_oldest(cache, cleanup)
:ets.insert(cache, {statement, timestamp, data})
:ets.insert(cache, {statement, timestamp(), data})
end

def update({_, cache}, statement, data) do
:ets.insert(cache, {statement, timestamp, data})
:ets.insert(cache, {statement, timestamp(), data})
end

defp remove_oldest(cache, cleanup) do
Expand Down
18 changes: 9 additions & 9 deletions lib/mariaex/protocol.ex
Expand Up @@ -74,8 +74,8 @@ defmodule Mariaex.Protocol do
s = %__MODULE__{binary_as: binary_as,
state: :handshake,
ssl_conn_state: set_initial_ssl_conn_state(opts),
connection_id: self,
connection_ref: make_ref,
connection_id: self(),
connection_ref: make_ref(),
sock: {sock_mod, sock},
cache: Cache.new(),
lru_cache: LruCache.new(opts[:cache_size]),
Expand Down Expand Up @@ -213,7 +213,7 @@ defmodule Mariaex.Protocol do
DBConnection callback
"""
def disconnect(_, state = %{sock: {sock_mod, sock}}) do
msg_send(text_cmd(command: com_quit, statement: ""), state, 0)
msg_send(text_cmd(command: com_quit(), statement: ""), state, 0)
case msg_recv(state) do
{:ok, packet(msg: ok_resp())} ->
sock_mod.close(sock)
Expand Down Expand Up @@ -290,7 +290,7 @@ defmodule Mariaex.Protocol do
{id, types, parameter_types} ->
{:ok, %{query | binary_as: s.binary_as, statement_id: id, types: types, parameter_types: parameter_types, connection_ref: ref}, s}
nil ->
msg_send(text_cmd(command: com_stmt_prepare, statement: statement), s, 0)
msg_send(text_cmd(command: com_stmt_prepare(), statement: statement), s, 0)
prepare_recv(%{s | binary_as: s.binary_as, state: :prepare_send}, query)
end
end
Expand Down Expand Up @@ -375,7 +375,7 @@ defmodule Mariaex.Protocol do
send_text_query(state, statement) |> text_query_recv(query)
end
def handle_execute(%Query{type: :binary, statement_id: id, connection_ref: ref} = query, params, _opts, %{connection_ref: ref} = state) do
msg_send(stmt_execute(command: com_stmt_execute, parameters: params, statement_id: id, flags: 0, iteration_count: 1), state, 0)
msg_send(stmt_execute(command: com_stmt_execute(), parameters: params, statement_id: id, flags: 0, iteration_count: 1), state, 0)
binary_query_recv(%{state | state: :column_count}, query)
end
def handle_execute(%Query{type: :binary} = query, params, opts, state) do
Expand Down Expand Up @@ -623,13 +623,13 @@ defmodule Mariaex.Protocol do
DBConnection callback
"""
def ping(%{buffer: buffer} = state) when is_binary(buffer) do
msg_send(text_cmd(command: com_ping, statement: ""), state, 0)
msg_send(text_cmd(command: com_ping(), statement: ""), state, 0)
ping_recv(state, :ping)
end
def ping(state) do
case checkout(state) do
{:ok, state} ->
msg_send(text_cmd(command: com_ping, statement: ""), state, 0)
msg_send(text_cmd(command: com_ping(), statement: ""), state, 0)
{:ok, state} = ping_recv(state, :ping)
checkin(state)
disconnect ->
Expand All @@ -642,7 +642,7 @@ defmodule Mariaex.Protocol do
end

defp send_text_query(s, statement) do
msg_send(text_cmd(command: com_query, statement: statement), s, 0)
msg_send(text_cmd(command: com_query(), statement: statement), s, 0)
%{s | state: :column_count}
end

Expand All @@ -658,7 +658,7 @@ defmodule Mariaex.Protocol do
end

def close_statement(_statement, {id, _, _}, sock) do
msg_send(stmt_close(command: com_stmt_close, statement_id: id), sock, 0)
msg_send(stmt_close(command: com_stmt_close(), statement_id: id), sock, 0)
end

def close_statement(s = %{sock: sock, lru_cache: cache}, %{statement: statement}) do
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Expand Up @@ -5,12 +5,12 @@ defmodule Mariaex.Mixfile do
[app: :mariaex,
version: "0.7.8",
elixir: "~> 1.0",
deps: deps,
deps: deps(),
name: "Mariaex",
source_url: "https://github.com/liveforeverx/mariaex",
test_coverage: [tool: Coverex.Task, coveralls: true],
description: description,
package: package]
description: description(),
package: package()]
end

# Configuration for the OTP application
Expand Down

0 comments on commit a0aa98b

Please sign in to comment.