[MacRuby] #1030: A potential SQLite3-Ruby bug
#1030: A potential SQLite3-Ruby bug ----------------------------------+----------------------------------------- Reporter: yasuimao@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- I encountered a potential bug with SQLite3-Ruby. I installed SQLite3-Ruby with macgem. The version of SQLite is the one on the system (3.6.12) and the version of SQLite3-Ruby is 1.3.2. I'm not sure if this is specific on my system or a bug. sqlite3 test.rb {{{ #!/usr/local/bin/macruby require "rubygems" require "sqlite3" sql = <<-SQL CREATE table test_table ( col1 integer, col2 integer, col3 integer ); SQL db = SQLite3::Database.new("test.db") db.transaction do db.execute("DROP TABLE test_table") if db.execute("SELECT tbl_name FROM sqlite_master WHERE type == 'table'").include?(["test_table"]) db.execute(sql) db.execute("INSERT into test_table (col1,col2,col3) values (?,?,?)",0,0,0) p db.execute("SELECT col1,col2,col3 FROM test_table") end }}} Results MacRuby 0.8 nightly {{{ #=> [[nil, 0, 0]] }}} Ruby 1.8.7 {{{ #=> [[0,0,0]] }}} If there are more than two items (into two columns) in this way, the first item to insert (not the first column on the table) is always nil. If values are in the command string using #{} or only one item is inserted, no issue. {{{ db.execute("INSERT into test_table (col1,col2,col3) values (0,0,0)") OR db.execute("INSERT into test_table (col1,col2,col3) values (#{0},#{0},#{0})") }}} Result - MacRuby 0.8 nightly, Ruby 1.8.7 {{{ #=> [[0,0,0]] }}} I'll see if I can attach this sample script file. -- Ticket URL: <http://www.macruby.org/trac/ticket/1030> MacRuby <http://macruby.org/>
#1030: A potential SQLite3-Ruby bug ----------------------------------+----------------------------------------- Reporter: yasuimao@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): In my environment, Ruby1.8, Ruby1.9 and MacRuby are same results. {{{ $ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] $ ruby test_sqlite3.rb [[nil, 0, 0]] $ ruby19 -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] $ ruby19 test_sqlite3.rb [[nil, 0, 0]] $ macruby test_sqlite3.rb [[nil, 0, 0]] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1030#comment:1> MacRuby <http://macruby.org/>
#1030: A potential SQLite3-Ruby bug ----------------------------------+----------------------------------------- Reporter: yasuimao@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: worksforme Keywords: | ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => worksforme Comment: Same for me. {{{ $ ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] $ ruby t.rb [[nil, 0, 0]] $ DYLD_LIBRARY_PATH=. ./macruby t.rb [[nil, 0, 0]] }}} Sorry, we can't reproduce the problem. -- Ticket URL: <http://www.macruby.org/trac/ticket/1030#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby