25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Make sure SQLite always returns binaries

This commit is contained in:
Evgeniy Khramtsov 2015-04-08 14:38:04 +03:00
parent 5a820aca40
commit 2a3a2d9804

View File

@ -513,8 +513,14 @@ sqlite_to_odbc(ok) ->
{updated, sqlite3:changes(?SQLITE_DB)};
sqlite_to_odbc({rowid, _}) ->
{updated, sqlite3:changes(?SQLITE_DB)};
sqlite_to_odbc([{columns, Columns}, {rows, Rows}]) ->
{selected, [list_to_binary(C) || C <- Columns], [tuple_to_list(Row) || Row <- Rows]};
sqlite_to_odbc([{columns, Columns}, {rows, TRows}]) ->
Rows = [lists:map(
fun(I) when is_integer(I) ->
jlib:integer_to_binary(I);
(B) ->
B
end, tuple_to_list(Row)) || Row <- TRows],
{selected, [list_to_binary(C) || C <- Columns], Rows};
sqlite_to_odbc({error, _Code, Reason}) ->
{error, Reason};
sqlite_to_odbc(_) ->