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

Merge pull request #27 from gcapital/master

NULL handling in gen_storage_odbc
This commit is contained in:
badlop 2012-08-08 04:55:30 -07:00
commit 9fe0eff75e
2 changed files with 8 additions and 1 deletions

View File

@ -1645,7 +1645,7 @@ send_text(StateData, Text) when StateData#state.xml_socket ->
(StateData#state.sockmod):send_xml(StateData#state.socket,
{xmlstreamraw, Text1});
send_text(StateData, Text) ->
?DEBUG("Send XML on stream = ~s", [Text]),
?DEBUG("Send XML on stream = ~s", [iolist_to_binary(Text)]),
(StateData#state.sockmod):send(StateData#state.socket, Text).
send_element(StateData, #xmlel{ns = ?NS_XMPP, name = 'stream'} = El) ->

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) ++ "'";