From: Petr Fischer Date: 2002-03-09T06:12:54+09:00 Subject: Re: ruby odbc question Try use ADO with WIN32OLE (why not? you know ADO interfaces if you using ADO from C++). I'am using ADO (WIN32OLE) for accessing InterBase and MS-SQL databases and this works very well. On 8 Mar 2002 08:29:38 -0800, andrew_queisser@hp.com (andrew queisser) wrote: > I've been playing with the Ruby/ODBC interface and I have a basic > question. This may be more of a general ODBC question but I'm hoping > people in this forum know what the best option is. > > I'll be retrieving a largish dataset (40000 rows) from an Oracle DB > via ODBC. My question is, basically, whether all the rows will be > retrieved at once when I execute the query or whether I'll get the > data in chunks as I scroll through the rows in the $q.each block? > > Should I be using ADO through WIN32OLE instead? ADO is what I use from > my C++ programs to do similar stuff. > > Thanks, > Andrew > > > The test program (which only selects a small subset) currently looks > something like this: > > require 'odbc' > > $c = ODBC.connect(database, username, password) > $q = $c.prepare("select pn_id,fx_id,pn_thatch_dm from table where > pn_id>'0002001001376200' and pn_id<'0002001001376210'") > $q.execute > $i=0 > $q.columns { |col| > print ( col.name, " --- ") > if col.name == "FX_ID" then > $fxIdCol = $i > end > $i = $i+1 > } > print "\n" > print ("fxid col is ", $fxIdCol, "\n") > > $q.each { |row| > row.each { |col| > print (col, " ") > } > print "\n" > } > print "\n" > $q.close > $c.disconnect