From: botp Date: 2010-11-15T17:45:47+09:00 Subject: Re: Mysql::Result .each_hash - unexpected result On Mon, Nov 15, 2010 at 2:36 AM, Andy Tolle wrote: > botp wrote in post #961345: > Can you say something about how an iterator can not "rewind"? Do you > mean I can't do nested iterators in ruby? nothing to do w ruby. just understanding file/db handling... eg, try, >items.each{|item| p item} ["1", "item01"] ["2", "item02"] ["3", "item03"] #=> # ok, let's try it again >items.each{|item|p item} #=> # see. it outputs nothing. the record pointer does not rewind. so let us rewind the pointer, >items.data_seek 0 #=> # and run it again >items.each{|item|p item} ["1", "item01"] ["2", "item02"] ["3", "item03"] #=> # btw, you can also try Sequel rubygem for very easy installing & handling of sql (and you wont encounter problem above). hth. kind regards -botp