25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Fix dialyzer warnings in ejabberd_sql in R27

This commit is contained in:
Paweł Chmielowski 2024-02-22 16:12:04 +01:00
parent a09f222b4c
commit 1b5a9c1a1f

View File

@ -72,7 +72,7 @@
-include("ejabberd_stacktrace.hrl").
-record(state,
{db_ref :: undefined | pid(),
{db_ref :: undefined | pid() | odbc:connection_reference(),
db_type = odbc :: pgsql | mysql | sqlite | odbc | mssql,
db_version :: undefined | non_neg_integer() | {non_neg_integer(), atom(), non_neg_integer()},
reconnect_count = 0 :: non_neg_integer(),
@ -1122,14 +1122,18 @@ mysql_to_odbc(ok) ->
mysql_item_to_odbc(Columns, Recs) ->
{selected, [element(2, Column) || Column <- Columns], Recs}.
to_odbc({selected, Columns, Recs}) ->
Rows = [lists:map(
fun(I) when is_integer(I) ->
integer_to_binary(I);
(B) ->
B
end, Row) || Row <- Recs],
{selected, [list_to_binary(C) || C <- Columns], Rows};
to_odbc({selected, Columns, Rows}) ->
Rows2 = lists:map(
fun(Row) ->
Row2 = if is_tuple(Row) -> tuple_to_list(Row);
is_list(Row) -> Row
end,
lists:map(
fun(I) when is_integer(I) -> integer_to_binary(I);
(B) -> B
end, Row2)
end, Rows),
{selected, [list_to_binary(C) || C <- Columns], Rows2};
to_odbc({error, Reason}) when is_list(Reason) ->
{error, list_to_binary(Reason)};
to_odbc(Res) ->