Ara.T.Howard wrote:
> On Mon, 12 Jul 2004, Ara.T.Howard wrote:
> 
>> i have a (important i think) feature request:
>>
>> first of all i love the new format (Arrays as tuples)!  the only 
>> problem is
>> that if you want to use arrayfields (or some such) there doesn't seem 
>> to be
>> an easy way to get at the actual fields!
> 
> 
> never mind me - i just read the source and see that you've set '@fields' 
> and
> so only a 'require "arrayfields" is needed.  i just got back from a week's
> vacation so sorry for the confusion!

Glad you saw that. I need to take an hour or two and write up some 
documentation, especially now that there are a few new features that 
need describing.

For those that don't quite follow what Ara found, you can get at the 
fields from an array by doing the following (even if you don't have 
'arrayfields' installed):

   results = db.execute "select * from some_table"
   p results.first.fields

The 'fields' property will be an array listing the columns that were 
selected, in the same order that they were returned. In other words, the 
results.first.fields[i] will name the value at results.first[i].

If you have required the 'arrayfields' module, then results.first can be 
treated (in some ways) as a hash, so you can give the name of a column 
and have the corresponding value returned.

-- 
Jamis Buck
jgb3 / email.byu.edu
http://www.jamisbuck.org/jamis

"I use octal until I get to 8, and then I switch to decimal."