aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/src/odbc.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2012-08-24 12:06:20 +0200
committerLukas Larsson <[email protected]>2012-08-24 12:06:20 +0200
commit7bb7e63fbada714655f0860a2d1daacbdc0d4712 (patch)
treecb79a560f4a73095d7c3ff40efc3fc94b10c3cb1 /lib/odbc/src/odbc.erl
parent0176b2a78f0257d88d9532803770eb0405beacb0 (diff)
parent0342137176c653c51cc3a78781888cfca8568650 (diff)
downloadotp-7bb7e63fbada714655f0860a2d1daacbdc0d4712.tar.gz
otp-7bb7e63fbada714655f0860a2d1daacbdc0d4712.tar.bz2
otp-7bb7e63fbada714655f0860a2d1daacbdc0d4712.zip
Merge branch 'maint'
* maint: Configure now assumed normal doubles Bumped version nr bumped revision make list_suffix/1 and list_prefix/1 handle erl_parse() cons sequences modernized and cleaned up edoc documentation removed obsolete @spec annotations and fixed some -spec and -type annotations preserve line numbers when reverting representation updated author e-mail removed CVS keywords from source files Revise the autoconf tests for double middle endianness. Add test for floating-point output to float_SUITE. Unbreak floating point on middle-endian machines. Add support for NULL value in odbc:param_query Conflicts: xcomp/README.md
Diffstat (limited to 'lib/odbc/src/odbc.erl')
-rw-r--r--lib/odbc/src/odbc.erl31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/odbc/src/odbc.erl b/lib/odbc/src/odbc.erl
index 9f7b06dcf1..9633b85cb2 100644
--- a/lib/odbc/src/odbc.erl
+++ b/lib/odbc/src/odbc.erl
@@ -755,7 +755,10 @@ handle_info({'DOWN', _Ref, _Type, _Process, shutdown}, State) ->
handle_info({'DOWN', _Ref, _Type, Process, Reason}, State) ->
{stop, {stopped, {'EXIT', Process, Reason}},
State#state{reply_to = undefined}};
-
+
+handle_info({tcp_closed, Socket}, State = #state{odbc_socket=Socket,
+ state = disconnecting}) ->
+ {stop, normal, State};
%---------------------------------------------------------------------------
%% Catch all - throws away unknown messages (This could happen by "accident"
%% so we do not want to crash, but we make a log entry as it is an
@@ -942,9 +945,11 @@ fix_params({sql_bit, InOut, Values}) ->
fix_params({'sql_timestamp', InOut, Values}) ->
NewValues =
case (catch
- lists:map(fun({{Year,Month,Day},{Hour,Minute,Second}}) ->
- {Year,Month,Day,Hour,Minute,Second}
- end, Values)) of
+ lists:map(
+ fun({{Year,Month,Day},{Hour,Minute,Second}}) ->
+ {Year,Month,Day,Hour,Minute,Second};
+ (null) -> null
+ end, Values)) of
Result ->
Result
end,
@@ -960,15 +965,15 @@ fix_inout(out) ->
fix_inout(inout) ->
?INOUT.
-string_terminate([Value| _ ] = Values) when is_list(Value)->
- case (catch
- lists:map(fun(Str) -> Str ++ [?STR_TERMINATOR] end, Values)) of
- Result ->
- Result
- end;
-string_terminate([Value| _ ] = Values) when is_binary(Value)->
- case (catch
- lists:map(fun(B) -> <<B/binary,0:16>> end, Values)) of
+string_terminate(Values) ->
+ case (catch lists:map(fun string_terminate_value/1, Values)) of
Result ->
Result
end.
+
+string_terminate_value(String) when is_list(String) ->
+ String ++ [?STR_TERMINATOR];
+string_terminate_value(Binary) when is_binary(Binary) ->
+ <<Binary/binary,0:16>>;
+string_terminate_value(null) ->
+ null.