From: Jim Weirich Date: 2004-07-01T00:04:00+09:00 Subject: Re: [ANN] arrayfields-3.0.0 Ara.T.Howard said: > the reason i wrote this in the first place was that i was doing alot of > postgresql work and it was returning these huge result sets that i would > then > write code that looked like: > > if tuple[17] =~ pat or tuple[9].to_i < 42 > ... > end FYI, for those using the DBI libraries, this functionality is already available. >> db = DBI.connect "DBI:yada yada ..." => # >> row = db.select_one("SELECT z_route_num, z_step_num FROM s_route_step") => [710, 1] >> row['z_route_num'] => 710 >> row[0] => 710 >> row['z_step_num'] => 1 >> row[1] => 1 If you wish to use DBI::Row independently, here is a demo ... >> values = [0,1,2] => [0, 1, 2] >> names = %w(zero one two) => ["zero", "one", "two"] >> r = DBI::Row.new(names, values) => [0, 1, 2] >> r['one'] => 1 -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)