mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Merge pull request #273 from gamenet/master
odb_queries patch return value of functions update and update_t in case of sql insert
This commit is contained in:
commit
0917209711
@ -296,8 +296,9 @@ get_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
||||
|
||||
store_packet(From, To, Packet) ->
|
||||
Type = xml:get_tag_attr_s(<<"type">>, Packet),
|
||||
BodyElem = xml:get_path_s(Packet,[{elem, <<"body">>}]),
|
||||
if (Type /= <<"error">>) and (Type /= <<"groupchat">>)
|
||||
and (Type /= <<"headline">>) ->
|
||||
and (Type /= <<"headline">>) and (<<>> /= BodyElem) ->
|
||||
case has_no_storage_hint(Packet) of
|
||||
false ->
|
||||
case check_event(From, To, Packet) of
|
||||
|
@ -97,10 +97,14 @@ update_t(Table, Fields, Vals, Where) ->
|
||||
of
|
||||
{updated, 1} -> ok;
|
||||
_ ->
|
||||
ejabberd_odbc:sql_query_t([<<"insert into ">>, Table,
|
||||
Res = ejabberd_odbc:sql_query_t([<<"insert into ">>, Table,
|
||||
<<"(">>, join(Fields, <<", ">>),
|
||||
<<") values ('">>, join(Vals, <<"', '">>),
|
||||
<<"');">>])
|
||||
<<"');">>]),
|
||||
case Res of
|
||||
{updated,1} -> ok;
|
||||
_ -> Res
|
||||
end
|
||||
end.
|
||||
|
||||
update(LServer, Table, Fields, Vals, Where) ->
|
||||
@ -115,10 +119,14 @@ update(LServer, Table, Fields, Vals, Where) ->
|
||||
of
|
||||
{updated, 1} -> ok;
|
||||
_ ->
|
||||
ejabberd_odbc:sql_query(LServer,
|
||||
Res = ejabberd_odbc:sql_query(LServer,
|
||||
[<<"insert into ">>, Table, <<"(">>,
|
||||
join(Fields, <<", ">>), <<") values ('">>,
|
||||
join(Vals, <<"', '">>), <<"');">>])
|
||||
join(Vals, <<"', '">>), <<"');">>]),
|
||||
case Res of
|
||||
{updated,1} -> ok;
|
||||
_ -> Res
|
||||
end
|
||||
end.
|
||||
|
||||
%% F can be either a fun or a list of queries
|
||||
|
Loading…
Reference in New Issue
Block a user