[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

A Ruby function for assigning a query to an array?

Ryan Klein

8/6/2008 5:11:00 PM

I am wondering if anyone knows of a function for push a MySQL query
result to an array? Right now I have to loop through the result, not bad
but somewhat ugly and annoying for naming standards.

Regards,

Ryan

2 Answers

Glen Holcomb

8/6/2008 6:28:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Wed, Aug 6, 2008 at 11:11 AM, Ryan Klein <ryan@ryanklein.com> wrote:

> I am wondering if anyone knows of a function for push a MySQL query result
> to an array? Right now I have to loop through the result, not bad but
> somewhat ugly and annoying for naming standards.
>
> Regards,
>
> Ryan
>
>
I would suggest trying one of the many ORM libraries out there: Sequel,
DataMapper, ActiveRecord...

Usually they will give you your results in some array of hashes form.

--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)

Ryan Klein

8/6/2008 6:31:00 PM

0

Funny you should say that because the moment after I sent that out I got
an email from Jeremy Evans that was posting to the list about Sequel
2.4.0 release. I had a good laugh. Thanks for the suggestions though.

Regards,

Ryan

Glen Holcomb wrote:
> On Wed, Aug 6, 2008 at 11:11 AM, Ryan Klein <ryan@ryanklein.com> wrote:
>
>
>> I am wondering if anyone knows of a function for push a MySQL query result
>> to an array? Right now I have to loop through the result, not bad but
>> somewhat ugly and annoying for naming standards.
>>
>> Regards,
>>
>> Ryan
>>
>>
>>
> I would suggest trying one of the many ORM libraries out there: Sequel,
> DataMapper, ActiveRecord...
>
> Usually they will give you your results in some array of hashes form.
>
>