Add ejabberd_sql:abort/1 and ejabberd_sql:restart/1

This commit is contained in:
Alexey Shchepin 2017-03-31 17:37:18 +03:00
parent f449df161a
commit 316da00345
1 changed files with 8 additions and 0 deletions

View File

@ -39,6 +39,8 @@
sql_query_t/1,
sql_transaction/2,
sql_bloc/2,
abort/1,
restart/1,
sql_query_to_iolist/1,
escape/1,
standard_escape/1,
@ -190,6 +192,12 @@ sql_query_t(Query) ->
_ -> QRes
end.
abort(Reason) ->
exit(Reason).
restart(Reason) ->
throw({aborted, Reason}).
%% Escape character that will confuse an SQL engine
escape(S) ->
<< <<(sql_queries:escape(Char))/binary>> || <<Char>> <= S >>.