From: Robert Citek Date: 2009-11-10T21:58:58+09:00 Subject: Re: errors when using sqlite3's query and prepare methods On Mon, Nov 9, 2009 at 9:15 PM, steve wrote: > Look carefully at the error messages.  In the case that works you are > applying a join.  If you look at the type of the object it is > SQLite3::ResultSet::ArrayWithTypesAndFields. This object responds to join. > > irb(main):011:0> db.execute( "select * from foobar" ) do |row| > irb(main):012:1*   puts row.join("\t") ; > irb(main):013:1*   puts row.class > irb(main):014:1> end > hello   1 > SQLite3::ResultSet::ArrayWithTypesAndFields > world   2 > SQLite3::ResultSet::ArrayWithTypesAndFields > => nil Adding the row.class was the trick, although I get different results from you: irb(main):014:0* db.execute( "select * from foobar" ) do |row| irb(main):015:1* puts row.join("\t") ; irb(main):016:1* puts row.class irb(main):017:1> end hello 1 Array world 2 Array => nil irb(main):022:0> db.query( "select * from foobar" ) do |row| irb(main):023:1* puts row.class irb(main):024:1> end SQLite3::ResultSet => nil irb(main):018:0> db.query( "select * from foobar" ).each do |row| irb(main):019:1* puts row.join("\t") ; irb(main):020:1* puts row.class irb(main):021:1> end hello 1 Array world 2 Array => nil In any case adding the .class method provided the clue for how to fix the bug. Thanks for your help, Steve. Regards, - Robert