diff options
author | Fredrik Gustafsson <[email protected]> | 2012-08-24 10:27:36 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2012-08-24 10:27:36 +0200 |
commit | 8175aaab8812723e4a77ea162e49cc0900b00fef (patch) | |
tree | 7f0d0b57c43998fdba8877ba9b2f21aa9924fbb3 /lib/odbc/src/odbc.erl | |
parent | 152a67153ad0c9e5ca39651b725bdf11b4be35d6 (diff) | |
parent | c6e01fe15d02dc704e5a9e77b59d2ee2db235976 (diff) | |
download | otp-8175aaab8812723e4a77ea162e49cc0900b00fef.tar.gz otp-8175aaab8812723e4a77ea162e49cc0900b00fef.tar.bz2 otp-8175aaab8812723e4a77ea162e49cc0900b00fef.zip |
Merge branch 'mz/odbc-support-param_query' into maint
Diffstat (limited to 'lib/odbc/src/odbc.erl')
-rw-r--r-- | lib/odbc/src/odbc.erl | 31 |
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. |