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

Handle NULL<->undefined correctly in gen_storage_odbc

This commit is contained in:
Brendon Hogger 2012-02-21 06:30:30 +08:00
parent b4c2a3b85f
commit 118b006cac

View File

@ -423,6 +423,9 @@ rows_to_result(#tabdef{record_name = RecordName,
row_to_result(Row, [], Result) ->
{Row, lists:reverse(Result)};
row_to_result([null | Row], [_ | Types], Result) ->
row_to_result(Row, Types, [undefined | Result]);
row_to_result([Field | Row], [Type | Types], Result) ->
case Type of
int ->
@ -649,6 +652,10 @@ format(I) when is_integer(I) ->
%% escaping not needed
integer_to_list(I);
format(undefined) ->
"NULL";
format(A) when is_atom(A) ->
%% escaping usually not needed, watch atom() usage
"'" ++ atom_to_list(A) ++ "'";