From: Hassan Schroeder Date: 2010-02-15T08:19:09+09:00 Subject: Re: Square brackets On Sun, Feb 14, 2010 at 2:00 PM, Andreu wrote: > What I really want is the numeric value alone without the > square brackets, quotes, and the like, as several queries are > 'chained' and this gets really annoying. > > Ruby 1.8.7 doesn't exibit that behaviour and work as expected. > Am I missing something ? ? Ruby 1.8.7 works exactly that way for me: >> rows = db.execute( "SELECT COUNT(*) FROM users" ) => [["3"]] >> rows[0] => ["3"] >> rows[0][0] => "3" >> rows[0][0].to_i => 3 (using ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]) I'm not sure why SQLite3 returns a count as a string, but aside from that -- you're retrieving a collection of rows, which are each typically a collection of fields. I'm not sure it would ever make sense to have it displayed differently, but at least it's easy to post-process :-) HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com twitter: @hassan