E
eagle eyes joe
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
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