Package:  libdbd-sqlite3-ruby
Version:  0.1.1-1
Severity: important
Tags:     patch

SQLite3 DBD's Statement#finish method calls close on both the
sqlite3-ruby statement handle and result set.  However, all the
sqlite3-ruby result set close method does is call close on the same
statement handle.  This results in a redundant closing of the statement
handle which sqlite3-ruby forbids.

Hence, a variant of the following error results for any SQLite3
select/execute call:

/usr/lib/ruby/1.8/sqlite3/statement.rb:234:in `must_be_open!': cannot use a 
closed statement (SQLite3::Exception)
        from /usr/lib/ruby/1.8/sqlite3/statement.rb:76:in `close'
        from /usr/lib/ruby/1.8/sqlite3/resultset.rb:169:in `close'
        from /usr/lib/ruby/1.8/DBD/SQLite3/SQLite3.rb:206:in `finish'
        from /usr/lib/ruby/1.8/dbi.rb:634:in `finish'
        from ./foo.rb:13
        from /usr/lib/ruby/1.8/dbi.rb:430:in `connect'
        from /usr/lib/ruby/1.8/dbi.rb:215:in `connect'
        from ./foo.rb:10

Since closing the result set is redundant, the simple fix is eliminate
the call.  I've included a patch that does just that.
diff -uNr libdbi-ruby-0.1.1.orig/lib/dbd/SQLite3.rb 
libdbi-ruby-0.1.1/lib/dbd/SQLite3.rb
--- libdbi-ruby-0.1.1.orig/lib/dbd/SQLite3.rb   2007-01-04 17:10:28.000000000 
-0500
+++ libdbi-ruby-0.1.1/lib/dbd/SQLite3.rb        2007-01-04 17:15:29.908864655 
-0500
@@ -203,7 +203,6 @@
 
         def finish()
           @stmt.close
-          @result.close if @result
           @result = nil
           @rpc = nil
         end

Reply via email to