MYSQL Result Hash Problem

Hi,

Is there any way to iterate through MySQL Result Hash multiple times ?

Current Problem: After One iteration, second iteration no records.

Need your help at the earliest.

Regards,
Sudheendra

On 23 August 2010 08:28, Sudheendra P. [email protected]
wrote:

Hi,

Is there any way to iterate through MySQL Result Hash multiple times ?

Current Problem: After One iteration, second iteration no records.

If you post the code you’re having a problem with, then maybe we can
make some suggestions.

Ideally, the smallest sample of the code that exhibits the problem
you’re experiencing so the model query and the loop should suffice.

Michael P. wrote:

On 23 August 2010 08:28, Sudheendra P. [email protected]
wrote:

Hi,

Is there any way to iterate through MySQL Result Hash multiple times ?

Current Problem: After One iteration, second iteration no records.

If you post the code you’re having a problem with, then maybe we can
make some suggestions.

Ideally, the smallest sample of the code that exhibits the problem
you’re experiencing so the model query and the loop should suffice.

Here goes the code

journal_details = conn.dbconnection.query(
“SELECT value,prop_key from Journal_Details
INNER JOIN journals on journals.id = journal_details.id
WHERE journalized_id = ‘#{issue_id}’ and
Date(created_on)=‘#{date}’ ORDER By journals.id”
)

#The above is the query which results few records

journal_details.each_hash do |journal_details_record|

Do some processing

end

journal_details.each_hash do |journal_details_record|

I need to do reuse the query here so that i can do some other

processing.

But this loop will not come inside

I am thinking if there is any EOF kind of thing has been reached.

And i do not know how to reset the pointer to point first record

end

Also I have tried with each method instead of each_hash. Same problem
continues.

Thank in advance for your help