Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > ruby-sqlite 2.2.3 bug

Reply
Thread Tools

ruby-sqlite 2.2.3 bug

 
 
Jon A. Lambert
Guest
Posts: n/a
 
      03-17-2006
This is using sqlite-ruby (2.2.3)

-----------------------
require 'sqlite'
require 'pp'

class Foo
end
db = SQLite:atabase.open("test.sqlite")
begin
db.execute("drop table test;")
rescue
end
db.execute("create table test (id integer primary key, data object);")
db.type_translation = true
db.translator.add_translator("object") {|type, value|
db.class.decode value
}
db.execute("insert into test values (1, ?);", db.class.encode(Foo.new))
db.execute("select * from test;") do |row|
pp row
end
#db.type_translation = false <== uncomment to make work
pp db.execute("pragma table_info(test)") <======= bug here
db.table_info("test") do |row| <===== and here
pp row
end
----------------------

[1, #<Foo:0x2c35ee0>]
C:/apps/ruby/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3-mswin32/lib/sqlite/translator.rb:85:in
`type_name': undefined method `upcase' for nil:NilClass (NoMethodError)
from
C:/apps/ruby/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3-mswin32/lib/sqlite/translator.rb:77:in
`translate'
from
C:/apps/ruby/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3-mswin32/lib/sqlite/resultset.rb:136:in
`next'
from
C:/apps/ruby/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3-mswin32/lib/sqlite/resultset.rb:135:in
`next'
from
C:/apps/ruby/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3-mswin32/lib/sqlite/resultset.rb:161:in
`each'
from
C:/apps/ruby/lib/ruby/gems/1.8/gems/sqlite-ruby-2.2.3-mswin32/lib/sqlite/database.rb:199:in
`execute'
from C:/work/teensymud/trunk/testsql.rb:21

Switching type_translation off allows pragma to work.

Also example in documentation, shows 'db.decode' instead of
'db.class.decode'

--
J. Lambert



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
ASP.NET Login control bug or SQL 2005 bug? RedEye ASP .Net 2 12-13-2005 10:57 AM
Re: BUG? OR NOT A BUG? John ASP .Net 2 09-21-2005 10:31 AM
Bug Parade Bug 4953793 Michel Joly de Lotbiniere Java 4 12-02-2003 05:05 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM



Advertisments