Hello,
I am in my first days of Ruby, so I may have done something stupid, but my
search did not uncover it.
It seems to me that the SQLite3 wrapper doesn't return correct results when
results_as_hash is true. I get spurious entries in the hash.
Here is a redux of my problem:
require 'rubygems'
require 'sqlite3'
#File.delete "test.db"
db = SQLite3::Database.new("test.db");
db.results_as_hash=true
db.execute("create table repertoire (Name TEXT,Firstname TEXT,Telephone
TEXT)")
db.execute("insert into repertoire (Name, Firstname, Telephone) values
('Doe', 'John', '555-123-4567')")
p db.execute('select * from repertoire;')
The results is indeed a hash, but with spurious entries:
[{"Name"=>"Doe", 0=>"Doe", 1=>"John", 2=>"555-123-4567",
"Telephone"=>"555-123-4567", "Firstname"=>"John"}]
I am running Ruby:
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
Under MacOS X Leopard 10.5.6
With SQLite3 3.4.0
Executing the query with the sqlite3 command line tool returns the expected
result:
$ sqlite3 test.db
SQLite version 3.4.0
Enter ".help" for instructions
select * from repertoire;
Doe>John>555-123-4567
Any confirmation/workaround/fix?
Many thanks.
Jean-Denis