On Feb 15, 2010, at 10:25 AM, Andreu wrote:

> Hassan and Brian, thanks for your answer.
> This is the code I'm using:
>
> tbls = db.execute("SELECT name FROM sqlite_master
>                   WHERE type='table' ORDER BY name")
> tbls.each do |tnam|
> ... some code
> end
>
> When using Ruby 1.8.7 I get the expected table names
> as TAB1 TAB2 etc, but with 1.9.1 I get [["TAB1"]["TAB2"]] etc
> and the 'some code' line does not execute because the table
> name includes the square brackets and quotes.
> I have done several test, even with sqlite-ruby and amalgalite
> and I'm pretty sure something has changed in Ruby, as changing
> only the Ruby version changes the value format returned.
> I guess will need to use the to_i func as suggested, and wait
> for better times...
>
> Thanks for your time, Andreu.
>


That's because the behavior of Array#to_s changed in 1.9. It used to  
be like Array#join, but now is more like Array#inspect.

You can try changing from an implicit call to to_s "#{tnam}" to an  
explicit call to join "#{tnam.join}"

-Rob


Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com