Skip to content

Commit

Permalink
Merge pull request #3 from ferigis/ferigis.2.accept_query_as_iodata
Browse files Browse the repository at this point in the history
Ferigis.2.accept query as iodata
  • Loading branch information
zinid authored Nov 4, 2016
2 parents 8e7e0a8 + e6d3033 commit 9547139
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/p1_mysql_conn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ fetch(Pid, Query, From) ->
fetch(Pid, Query, From, Timeout) ->
squery(Pid, Query, From, [{timeout, Timeout}]).

squery(Pid, Query, From, Options) when is_pid(Pid), is_list(Query) ->
squery(Pid, Query, From, Options) when is_pid(Pid),
(is_list(Query) or is_binary(Query)) ->
Self = self(),
Timeout = get_option(timeout, Options, ?DEFAULT_STANDALONE_TIMEOUT),
TRef = erlang:start_timer(Timeout, self(), timeout),
Expand Down Expand Up @@ -666,7 +667,7 @@ do_query(State, Query, Options) when is_record(State, state) ->
).

do_query(Sock, RecvPid, LogFun, Query, Version, Options) when is_pid(RecvPid),
is_list(Query) ->
(is_list(Query) or is_binary(Query)) ->
Packet = list_to_binary([?MYSQL_QUERY_OP, Query]),
case do_send(Sock, Packet, 0, LogFun) of
ok ->
Expand Down

0 comments on commit 9547139

Please sign in to comment.