mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
* src/odbc/ejabberd_odbc.erl: log MySQL driver messages.
SVN Revision: 1652
This commit is contained in:
parent
6bd76ebfda
commit
7c736a5ea0
@ -1,3 +1,7 @@
|
||||
2008-10-13 Jerome Sautret <jerome.sautret@process-one.net>
|
||||
|
||||
* src/odbc/ejabberd_odbc.erl: log MySQL driver messages.
|
||||
|
||||
2008-10-13 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/web/ejabberd_web_admin.erl: When requesting page of
|
||||
|
@ -318,8 +318,7 @@ pgsql_item_to_odbc(_) ->
|
||||
%% part of init/1
|
||||
%% Open a database connection to MySQL
|
||||
mysql_connect(Server, Port, DB, Username, Password, StartInterval) ->
|
||||
NoLogFun = fun(_Level,_Format,_Argument) -> ok end,
|
||||
case mysql_conn:start(Server, Port, Username, Password, DB, NoLogFun) of
|
||||
case mysql_conn:start(Server, Port, Username, Password, DB, fun log/3) of
|
||||
{ok, Ref} ->
|
||||
erlang:monitor(process, Ref),
|
||||
mysql_conn:fetch(Ref, ["set names 'utf8';"], self()),
|
||||
@ -359,3 +358,14 @@ mysql_item_to_odbc(Columns, Recs) ->
|
||||
% perform a harmless query on all opened connexions to avoid connexion close.
|
||||
keep_alive(PID) ->
|
||||
gen_server:call(PID, {sql_query, ?KEEPALIVE_QUERY}, 60000).
|
||||
|
||||
% log function used by MySQL driver
|
||||
log(Level, Format, Args) ->
|
||||
case Level of
|
||||
debug ->
|
||||
?DEBUG(Format, Args);
|
||||
normal ->
|
||||
?INFO_MSG(Format, Args);
|
||||
error ->
|
||||
?ERROR_MSG(Format, Args)
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user