Package: libsqlite3-ruby1.8 Version: 1.1.0-2 Severity: normal Tags: patch
When ruby is executed in verbose (warnings) mode, sqlite3-ruby generates excess warnings for nearly any operation. For example, this is generated during a typical execute call: /usr/lib/ruby/1.8/sqlite3/database.rb:439: warning: `&' interpreted as argument prefix /usr/lib/ruby/1.8/sqlite3/errors.rb:94: warning: (...) interpreted as grouped expression /usr/lib/ruby/1.8/sqlite3/statement.rb:157: warning: `*' interpreted as argument prefix /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:155: warning: instance variable @results not initialized /usr/lib/ruby/1.8/sqlite3/statement.rb:198: warning: instance variable @columns not initialized I've included a patch that eliminates these warnings. In addition, calling Database#transaction_active? before initiating a transaction also results in a warning as the @transaction_active variable has yet to be defined. This patch also initializes @transaction_active in Database#initialize to suppress this warning.
diff -uNr sqlite3-ruby-1.1.0.orig/lib/sqlite3/database.rb sqlite3-ruby-1.1.0/lib/sqlite3/database.rb --- sqlite3-ruby-1.1.0.orig/lib/sqlite3/database.rb 2005-02-07 12:14:56.000000000 -0500 +++ sqlite3-ruby-1.1.0/lib/sqlite3/database.rb 2007-01-04 17:51:55.071504394 -0500 @@ -115,6 +115,7 @@ @results_as_hash = options.fetch(:results_as_hash,false) @type_translation = options.fetch(:type_translation,false) @translator = nil + @transaction_active = false end # Return +true+ if the string is a valid (ie, parsable) SQL statement, and @@ -436,7 +437,7 @@ # begin if block proxy = AggregateDefinitionProxy.new - proxy.instance_eval &block + proxy.instance_eval( &block ) step ||= proxy.step_callback finalize ||= proxy.finalize_callback end diff -uNr sqlite3-ruby-1.1.0.orig/lib/sqlite3/errors.rb sqlite3-ruby-1.1.0/lib/sqlite3/errors.rb --- sqlite3-ruby-1.1.0.orig/lib/sqlite3/errors.rb 2005-02-07 22:40:20.000000000 -0500 +++ sqlite3-ruby-1.1.0/lib/sqlite3/errors.rb 2007-01-04 17:42:08.762949440 -0500 @@ -91,7 +91,7 @@ def check( result, db=nil, msg=nil ) unless result == Constants::ErrorCode::OK msg = ( msg ? msg + ": " : "" ) + db.errmsg if db - raise ( EXCEPTIONS[result] || SQLite3::Exception ), msg + raise(( EXCEPTIONS[result] || SQLite3::Exception ), msg) end end module_function :check diff -uNr sqlite3-ruby-1.1.0.orig/lib/sqlite3/statement.rb sqlite3-ruby-1.1.0/lib/sqlite3/statement.rb --- sqlite3-ruby-1.1.0.orig/lib/sqlite3/statement.rb 2005-02-07 12:01:20.000000000 -0500 +++ sqlite3-ruby-1.1.0/lib/sqlite3/statement.rb 2007-01-04 17:44:05.145194599 -0500 @@ -68,6 +68,7 @@ @closed = false result, @handle, @remainder = @driver.prepare( @db.handle, sql ) Error.check( result, @db ) + @columns = @results = nil end # Closes the statement by finalizing the underlying statement @@ -154,7 +155,7 @@ must_be_open! @driver.reset( @handle ) if @results - bind_params *bind_vars unless bind_vars.empty? + bind_params( *bind_vars ) unless bind_vars.empty? @results = ResultSet.new( @db, self ) if block_given?