]> granicus.if.org Git - ejabberd/commitdiff
Add ejabberd_sql:abort/1 and ejabberd_sql:restart/1
authorAlexey Shchepin <alexey@process-one.net>
Fri, 31 Mar 2017 14:37:18 +0000 (17:37 +0300)
committerAlexey Shchepin <alexey@process-one.net>
Fri, 31 Mar 2017 14:37:24 +0000 (17:37 +0300)
src/ejabberd_sql.erl

index ab0601a6cdba5adfd97b387835400fad76aee847..b9dbbe7ce57756eddebc05d3b6307097174df18b 100644 (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 >>.