[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[sqlite3] ResultSet#to_a is not idempotent

Joel VanderWerf

6/14/2008 5:19:00 PM


I asked this on the rubyforge sqlite list, but it's very quiet there, so
I'll risk asking it here...

Calling #to_a on a ResultSet seems to clear the result, so that the next
time #to_a returns an empty array. Is this intended?

$ cat test.rb
require 'sqlite3'

db = SQLite3::Database.new( "./test.sqlite" )
db.type_translation = true

db.execute <<END
create table if not exists t (
x real
)
END

db.execute "insert into t values (1)"

qry = db.prepare "select * from t"

res = qry.execute

p res.to_a
p res.to_a

$ ruby test.rb
[[1.0]]
[]


--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407