mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
* src/odbc/ejabberd_odbc.erl: Load-balance ODBC requests between
several connections * src/odbc/ejabberd_odbc_sup.erl: Supervisor for ODBC connections * src/mod_muc/mod_muc_room.erl: Added missed type='form' attribute in room configuration response (thanks to Badlop) SVN Revision: 295
This commit is contained in:
parent
50bef3787a
commit
3416cbe63a
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2004-12-30 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/odbc/ejabberd_odbc.erl: Load-balance ODBC requests between
|
||||
several connections
|
||||
|
||||
* src/odbc/ejabberd_odbc_sup.erl: Supervisor for ODBC connections
|
||||
|
||||
* src/mod_muc/mod_muc_room.erl: Added missed type='form' attribute
|
||||
in room configuration response (thanks to Badlop)
|
||||
|
||||
2004-12-19 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_roster_odbc.erl: Roster support via ODBC (not completed)
|
||||
|
@ -1970,7 +1970,10 @@ get_config(Lang, StateData) ->
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "You need an x:data capable client to configure room")}]},
|
||||
{xmlelement, "x", [{"xmlns", ?NS_XDATA}], Res}], StateData}.
|
||||
{xmlelement, "x", [{"xmlns", ?NS_XDATA},
|
||||
{"type", "form"}],
|
||||
Res}],
|
||||
StateData}.
|
||||
|
||||
|
||||
|
||||
|
@ -31,13 +31,14 @@
|
||||
%%% API
|
||||
%%%----------------------------------------------------------------------
|
||||
start() ->
|
||||
gen_server:start({local, ejabberd_odbc}, ejabberd_odbc, [], []).
|
||||
gen_server:start(ejabberd_odbc, [], []).
|
||||
|
||||
start_link() ->
|
||||
gen_server:start_link({local, ejabberd_odbc}, ejabberd_odbc, [], []).
|
||||
gen_server:start_link(ejabberd_odbc, [], []).
|
||||
|
||||
sql_query(Query) ->
|
||||
gen_server:call(ejabberd_odbc, {sql_query, Query}, 60000).
|
||||
gen_server:call(ejabberd_odbc_sup:get_random_pid(),
|
||||
{sql_query, Query}, 60000).
|
||||
|
||||
escape(S) ->
|
||||
[case C of
|
||||
|
46
src/odbc/ejabberd_odbc_sup.erl
Normal file
46
src/odbc/ejabberd_odbc_sup.erl
Normal file
@ -0,0 +1,46 @@
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% File : ejabberd_odbc_sup.erl
|
||||
%%% Author : Alexey Shchepin <alexey@sevcom.net>
|
||||
%%% Purpose : ODBC connections supervisor
|
||||
%%% Created : 22 Dec 2004 by Alexey Shchepin <alexey@sevcom.net>
|
||||
%%% Id : $Id$
|
||||
%%%----------------------------------------------------------------------
|
||||
|
||||
-module(ejabberd_odbc_sup).
|
||||
-author('alexey@sevcom.net').
|
||||
-vsn('$Revision$ ').
|
||||
|
||||
-export([start_link/0,
|
||||
init/1,
|
||||
get_pids/0,
|
||||
get_random_pid/0
|
||||
]).
|
||||
|
||||
-include("ejabberd.hrl").
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||
|
||||
init(_) ->
|
||||
% TODO
|
||||
N = 10,
|
||||
{ok, {{one_for_one, 10, 1},
|
||||
lists:map(
|
||||
fun(I) ->
|
||||
{I,
|
||||
{ejabberd_odbc, start_link, []},
|
||||
transient,
|
||||
brutal_kill,
|
||||
worker,
|
||||
[?MODULE]}
|
||||
end, lists:seq(1, N))}}.
|
||||
|
||||
get_pids() ->
|
||||
[Child ||
|
||||
{_Id, Child, _Type, _Modules} <- supervisor:which_children(?MODULE),
|
||||
Child /= undefined].
|
||||
|
||||
get_random_pid() ->
|
||||
Pids = get_pids(),
|
||||
lists:nth(erlang:phash(now(), length(Pids)), Pids).
|
||||
|
Loading…
Reference in New Issue
Block a user