[erlang-questions] Is it a Bug? odbc:param_query when using in_or_out() in Params list

Akos kutvolgyi akos.kutvolgyi@REDACTED
Tue Oct 28 14:28:45 CET 2008

Hello All

The documentation says the following about Params in the param_query section

Params = [{odbc_data_type(), [value()]}] |[{odbc_data_type(), 
in_or_out(), [value()]}]

So the Params List's element could be a tuple with three elements.

in odbc.erl

param_query(ConnectionReference, SQLQuery, Params, infinity)
  when pid(ConnectionReference), list(SQLQuery), list(Params) ->
    [{_, Values} | _] = Params,     This line may cause badmatch :(
    NoRows = length(Values),
    NewParams = lists:map(fun fix_params/1, Params),
    ODBCCmd = [?PARAM_QUERY, term_to_binary({SQLQuery ++ [?STR_TERMINATOR],
                         NoRows, NewParams})],
    call(ConnectionReference, {param_query, ODBCCmd}, infinity);

Instead of that line we should use
[H|_T] = Params,
Values =
    case H of
        {_,_,Vals} -> Vals;
        {_,Vals} -> Vals;

Or I mistaking something :S

Ákos Kútvölgyi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081028/251e00b0/attachment.htm>

More information about the erlang-questions mailing list