summaryrefslogtreecommitdiff
path: root/src/ejd2sql.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2021-05-10 17:25:55 +0200
committerBadlop <badlop@process-one.net>2021-05-14 16:06:43 +0200
commitee3796b92569d42b430f11b43532d41b9c6eb911 (patch)
treea0f854e7ecf1f07c2e64a9cb855ed1df9487dd37 /src/ejd2sql.erl
parentTell io_lib:print to not care about line length, to avoid newlines in SQL export (diff)
When exporting for SQLite, use its specific escape options (#2576)
Diffstat (limited to 'src/ejd2sql.erl')
-rw-r--r--src/ejd2sql.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ejd2sql.erl b/src/ejd2sql.erl
index e98dd071..f5c87ffc 100644
--- a/src/ejd2sql.erl
+++ b/src/ejd2sql.erl
@@ -154,6 +154,7 @@ import_info(Mod) ->
%%% Internal functions
%%%----------------------------------------------------------------------
export(LServer, Table, IO, ConvertFun) ->
+ DbType = ejabberd_option:sql_type(LServer),
F = fun () ->
mnesia:read_lock_table(Table),
{_N, SQLs} =
@@ -163,7 +164,7 @@ export(LServer, Table, IO, ConvertFun) ->
[] ->
Acc;
SQL1 ->
- SQL = format_queries(SQL1),
+ SQL = format_queries(DbType, SQL1),
if N < (?MAX_RECORDS_PER_TRANSACTION) - 1 ->
{N + 1, [SQL | SQLs]};
true ->
@@ -368,10 +369,10 @@ format_error({error, eof}) ->
format_error({error, Posix}) ->
file:format_error(Posix).
-format_queries(SQLs) ->
+format_queries(DbType, SQLs) ->
lists:map(
fun(#sql_query{} = SQL) ->
- ejabberd_sql:sql_query_to_iolist(SQL);
+ ejabberd_sql:sql_query_to_iolist(DbType, SQL);
(SQL) ->
SQL
end, SQLs).