25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +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"). -include("ejabberd_stacktrace.hrl").
-record(state, -record(state,
{db_ref :: undefined | pid(), {db_ref :: undefined | pid() | odbc:connection_reference(),
db_type = odbc :: pgsql | mysql | sqlite | odbc | mssql, db_type = odbc :: pgsql | mysql | sqlite | odbc | mssql,
db_version :: undefined | non_neg_integer() | {non_neg_integer(), atom(), non_neg_integer()}, db_version :: undefined | non_neg_integer() | {non_neg_integer(), atom(), non_neg_integer()},
reconnect_count = 0 :: non_neg_integer(), reconnect_count = 0 :: non_neg_integer(),
@ -1122,14 +1122,18 @@ mysql_to_odbc(ok) ->
mysql_item_to_odbc(Columns, Recs) -> mysql_item_to_odbc(Columns, Recs) ->
{selected, [element(2, Column) || Column <- Columns], Recs}. {selected, [element(2, Column) || Column <- Columns], Recs}.
to_odbc({selected, Columns, Recs}) -> to_odbc({selected, Columns, Rows}) ->
Rows = [lists:map( Rows2 = lists:map(
fun(I) when is_integer(I) -> fun(Row) ->
integer_to_binary(I); Row2 = if is_tuple(Row) -> tuple_to_list(Row);
(B) -> is_list(Row) -> Row
B end,
end, Row) || Row <- Recs], lists:map(
{selected, [list_to_binary(C) || C <- Columns], Rows}; 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) -> to_odbc({error, Reason}) when is_list(Reason) ->
{error, list_to_binary(Reason)}; {error, list_to_binary(Reason)};
to_odbc(Res) -> to_odbc(Res) ->