25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +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_to_result(Row, [], Result) ->
{Row, lists:reverse(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) -> row_to_result([Field | Row], [Type | Types], Result) ->
case Type of case Type of
int -> int ->
@ -649,6 +652,10 @@ format(I) when is_integer(I) ->
%% escaping not needed %% escaping not needed
integer_to_list(I); integer_to_list(I);
format(undefined) ->
"NULL";
format(A) when is_atom(A) -> format(A) when is_atom(A) ->
%% escaping usually not needed, watch atom() usage %% escaping usually not needed, watch atom() usage
"'" ++ atom_to_list(A) ++ "'"; "'" ++ atom_to_list(A) ++ "'";