ODBC 2.0.0 Comments

Rudolph van Graan rvg@REDACTED
Sun Jul 25 11:54:57 CEST 2004


Hi all,

I've just been busy testing some of the new functions in ODBC 2.0.0.  
The first thing I noticed is that the multiple result set queries don't  
quite work:

If I do a select *  I get three rows back: (This is correct)

9> odbc:sql_query(R,"select * from subscriberstat").
{selected,["MSISDN","lastinvoke","invokecount","firstinvoke"],
           [{"27833907767","2004-07-24 22:56:26",0,"2004-07-24  
22:56:26"},
            {"27829057494","2004-07-24 22:56:53",0,"2004-07-24  
22:56:53"},
            {"27829057496","2004-07-24 22:56:57",0,"2004-07-24  
22:56:57"}]}

if I now run the same query twice, this happens:

10> odbc:sql_query(R,"select * from subscriberstat ; select * from  
subscriberstat").
[{selected,["MSISDN","lastinvoke","invokecount","firstinvoke"],
            [{"27833907767","2004-07-24 22:56:26",0,"2004-07-24  
22:56:26"},
             {"27829057494","2004-07-24 22:56:53",0,"2004-07-24  
22:56:53"},
             {"27829057496","2004-07-24 22:56:57",0,"2004-07-24  
22:56:57"}]},
  {selected,["MSISDN","lastinvoke","invokecount","firstinvoke"],[]}]

In this case, the second result set is empty, where it should have been  
the same as the first.

Another thing I noticed is that the documentation for param_query seems  
to be incomplete:

%%---------------------------------------------------------------------- 
----
%% param_query(ConnectionReference, SQLQuery, Params, <TimeOut>) ->
%%                             ok | {error, Reason}
%%
%% Description: Executes a parameterized update/delete/insert-query.
%%---------------------------------------------------------------------- 
----
param_query(ConnectionReference, SQLQuery, Params) ->

What is the format of Params? I cannot seem to get it working:

11> odbc:param_query(R,"select * from subscriberstat where msisdn =  
?",["27829057496"]).

I got a
** {stopped,{'EXIT',<0.24.0>,
                     {{badmatch,["27829057496"]},
                      [{odbc,param_query,4},
                       {erl_eval,do_apply,5},
                       {shell,eval_loop,2}]}}}

Obviously  I am not feeding it the params correctly.

Any ideas (The documentation on erlang.org still shows version 1.0.8 of  
ODBC)

Thank you very much,

Rudolph van Graan




More information about the erlang-questions mailing list