mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
When exporting for SQLite, use its specific escape options (#2576)
This commit is contained in:
parent
8e08703833
commit
ee3796b925
@ -39,6 +39,7 @@
|
||||
restart/1,
|
||||
use_new_schema/0,
|
||||
sql_query_to_iolist/1,
|
||||
sql_query_to_iolist/2,
|
||||
escape/1,
|
||||
standard_escape/1,
|
||||
escape_like/1,
|
||||
@ -832,6 +833,11 @@ sql_query_format_res(Res, _SQLQuery) ->
|
||||
sql_query_to_iolist(SQLQuery) ->
|
||||
generic_sql_query_format(SQLQuery).
|
||||
|
||||
sql_query_to_iolist(sqlite, SQLQuery) ->
|
||||
sqlite_sql_query_format(SQLQuery);
|
||||
sql_query_to_iolist(_DbType, SQLQuery) ->
|
||||
generic_sql_query_format(SQLQuery).
|
||||
|
||||
sql_begin() ->
|
||||
sql_query_internal(
|
||||
[{mssql, [<<"begin transaction;">>]},
|
||||
|
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user