Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NULL handling in gen_storage_odbc #27

Merged
merged 3 commits into from
Aug 8, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ejabberd_c2s.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
7 changes: 7 additions & 0 deletions src/gen_storage_odbc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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) ++ "'";
Expand Down