From: gregarican Date: 2006-11-15T23:35:07+09:00 Subject: Re: Assoc method on large array I didn't let the DB do the selection because I was querying different databases residing on different servers and combining the results in a way that I didn't feel like jumping through SQL hoops for. Since I like coding in Ruby better than coding in SQL I figured I'd let Ruby do the heavy lifting. Looking at it, a Hash object would be better suited for some of this work. Next time I will utilize this type of object. As Mr. Gray suggested I ran resultSet.class and resultSet.first.class and got Array and DBI::Row respectively. Guess that's why I couldn't run the assoc method on a DBI::Row object! That makes perfect sense now. I thought that the DBI rows returned were piped into arrays. Guess not :-) Robert Klemme wrote: > On 15.11.2006 14:49, gregarican wrote: > > I figured out this one glitch. Pilot error on my part. Some values of > > this array element were floats while others were strings. I had to > > convert the string values to floats for the comparison sort block to > > factor everything correctly. That is taken care of. But I still never > > found a way around invoking the Array's assoc method on an SQL result > > set. But piping the set into a new array isn't the end of the world. It > > works and my script does now as well. Thanks for the feedback though! > > Why don't you let the DB do the selection? Why don't you use a Hash? > How did you verify that it's an Array of Arrays? Did you just look at > the output of inspect or did you actually invoke #class? > > I am not sure that you actually found a good solution here. > > Kind regards > > robert