Skip to content

Commit

Permalink
Add "p1_" prefix to all modules and data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
zinid committed Sep 18, 2013
1 parent 42e8d4c commit 400382c
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 197 deletions.
2 changes: 1 addition & 1 deletion include/mysql.hrl → include/p1_mysql.hrl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%% MySQL result record:
-record(mysql_result,
-record(p1_mysql_result,
{fieldinfo=[],
rows=[],
affectedrows=0,
Expand Down
2 changes: 1 addition & 1 deletion src/p1_mysql.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{modules, []},
{registered, []},
{applications, [kernel, stdlib]},
{mod, {mysql_app,[]}}]}.
{mod, {p1_mysql_app,[]}}]}.

%% Local Variables:
%% mode: erlang
Expand Down
170 changes: 85 additions & 85 deletions src/mysql.erl → src/p1_mysql.erl

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/mysql_app.erl → src/p1_mysql_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%%% @end
%%% Created : 15 May 2013 by Evgeniy Khramtsov <ekhramtsov@process-one.net>
%%%-------------------------------------------------------------------
-module(mysql_app).
-module(p1_mysql_app).

-behaviour(application).

Expand All @@ -17,7 +17,7 @@
%%% Application callbacks
%%%===================================================================
start(_StartType, _StartArgs) ->
mysql_sup:start_link().
p1_mysql_sup:start_link().

stop(_State) ->
ok.
Expand Down
20 changes: 10 additions & 10 deletions src/mysql_auth.erl → src/p1_mysql_auth.erl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
%%%-------------------------------------------------------------------
%%% File : mysql_auth.erl
%%% File : p1_mysql_auth.erl
%%% Author : Fredrik Thulin <ft@it.su.se>
%%% Descrip.: MySQL client authentication functions.
%%% Created : 4 Aug 2005 by Fredrik Thulin <ft@it.su.se>
%%%
%%% Note : All MySQL code was written by Magnus Ahltorp, originally
%%% in the file mysql.erl - I just moved it here.
%%% in the file p1_mysql.erl - I just moved it here.
%%%
%%% Copyright (c) 2001-2004 Kungliga Tekniska Högskolan
%%% See the file COPYING
%%%
%%%-------------------------------------------------------------------
-module(mysql_auth).
-module(p1_mysql_auth).

%%--------------------------------------------------------------------
%% External exports (should only be used by the 'mysql_conn' module)
%% External exports (should only be used by the 'p1_mysql_conn' module)
%%--------------------------------------------------------------------
-export([
do_old_auth/7,
Expand Down Expand Up @@ -49,13 +49,13 @@
%% Salt1 = string(), salt 1 from server greeting
%% LogFun = undefined | function() of arity 3
%% Descrip.: Perform old-style MySQL authentication.
%% Returns : result of mysql_conn:do_recv/3
%% Returns : result of p1_mysql_conn:do_recv/3
%%--------------------------------------------------------------------
do_old_auth(Sock, RecvPid, SeqNum, User, Password, Salt1, LogFun) ->
Auth = password_old(Password, Salt1),
Packet2 = make_auth(User, Auth),
do_send(Sock, Packet2, SeqNum, LogFun),
mysql_conn:do_recv(LogFun, RecvPid, SeqNum).
p1_mysql_conn:do_recv(LogFun, RecvPid, SeqNum).

%%--------------------------------------------------------------------
%% Function: do_new_auth(Sock, RecvPid, SeqNum, User, Password, Salt1,
Expand All @@ -69,19 +69,19 @@ do_old_auth(Sock, RecvPid, SeqNum, User, Password, Salt1, LogFun) ->
%% Salt2 = string(), salt 2 from server greeting
%% LogFun = undefined | function() of arity 3
%% Descrip.: Perform MySQL authentication.
%% Returns : result of mysql_conn:do_recv/3
%% Returns : result of p1_mysql_conn:do_recv/3
%%--------------------------------------------------------------------
do_new_auth(Sock, RecvPid, SeqNum, User, Password, Salt1, Salt2, LogFun) ->
Auth = password_new(Password, Salt1 ++ Salt2),
Packet2 = make_new_auth(User, Auth, none),
do_send(Sock, Packet2, SeqNum, LogFun),
case mysql_conn:do_recv(LogFun, RecvPid, SeqNum) of
case p1_mysql_conn:do_recv(LogFun, RecvPid, SeqNum) of
{ok, Packet3, SeqNum2} ->
case Packet3 of
<<254:8>> ->
AuthOld = password_old(Password, Salt1),
do_send(Sock, <<AuthOld/binary, 0:8>>, SeqNum2 + 1, LogFun),
mysql_conn:do_recv(LogFun, RecvPid, SeqNum2 + 1);
p1_mysql_conn:do_recv(LogFun, RecvPid, SeqNum2 + 1);
_ ->
{ok, Packet3, SeqNum2}
end;
Expand Down Expand Up @@ -187,6 +187,6 @@ password_new(Password, Salt) ->


do_send(Sock, Packet, Num, LogFun) ->
mysql:log(LogFun, debug, "mysql_auth send packet ~p: ~p", [Num, Packet]),
p1_mysql:log(LogFun, debug, "p1_mysql_auth send packet ~p: ~p", [Num, Packet]),
Data = <<(size(Packet)):24/little, Num:8, Packet/binary>>,
gen_tcp:send(Sock, Data).
Loading

0 comments on commit 400382c

Please sign in to comment.