No, this corresponds to the way Mysql C API works. Use Mysql::Result#row_seek to return to the beginning of the result set. You shouldn't treat Mysql::Result as a in-memory Enumerable object, because there are usually resources allocated on the server for each Mysql::Result instance. Cheers, Kent. On Sep 25, 2004, at 8:59 PM, eagle eyes joe wrote: > Greetings: > > You can only read a Mysql::Result object once because > each_key deletes the values as it reads them. This is unexpected and > I > think it should be fixed. > > This little program shows what I mean: > > > [Abba:/tmp] josephal% cat resulttest > #!/usr/bin/ruby > > require 'mysql' > > m = Mysql.new("localhost", "root", "", "Development") > > r = m.query("select * from processedfiles limit 5") > > r.each_hash { |row| print "#{row['name']}\n" } > > print "---------------------------------------\n" > > r.each_hash { |row| print "#{row['name']}\n" } > > print "------------------- -\nthis is the end\n" > > > [Abba:/tmp] josephal% resulttest > AD030220 > AD030221 > AD030228 > AD030307 > AD000428 > --------------------------------------- > ------------------- - > this is the end > [Abba:/tmp] josephal% >