ruby-win32/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1-x86-mswin32/lib/sqlite3/database.rb
# Executes the given SQL statement, exactly as with #execute. However, the
# first row returned (either via the block, or in the returned array) is
# always the names of the columns. Subsequent rows correspond to the data
# from the result set.
#
# Thus, even if the query itself returns no rows, this method will always
# return at least one row--the names of the columns.
#
# See also #execute, #query, and #execute_batch for additional ways of
# executing statements.
Executes the given SQL statement, exactly as with #execute. However, the
first row returned (either via the block, or in the returned array) is
always the names of the columns. Subsequent rows correspond to the data
from the result set.

Thus, even if the query itself returns no rows, this method will always
return at least one row--the names of the columns.

See also #execute, #query, and #execute_batch for additional ways of
executing statements.
Executes the given SQL statement exactly as with #execute . However the first row returned ( either via the block or in the returned array ) is always the names of the columns . Subsequent rows correspond to the data from the result set . Thus even if the query itself returns no rows this method will always return at least one row -- the names of the columns . See also #execute #query and #execute_batch for additional ways of executing statements .
def execute2( sql, *bind_vars )
      prepare( sql ) do |stmt|
        result = stmt.execute( *bind_vars )
        if block_given?
          yield result.columns
          result.each { |row| yield row }
        else
          return result.inject( [ result.columns ] ) { |arr,row|
            arr << row; arr }
        end
      end
    end
def execute2 ( sql , * bind_vars ) prepare ( sql ) do | stmt | result = stmt . execute ( * bind_vars ) if block_given? yield result . columns result . each { | row | yield row } else return result . inject ( [ result . columns ] ) { | arr , row | arr << row ; arr } end end end
Executes the given SQL statement, exactly as with #execute.
Executes the given SQL statement exactly as with #execute .
sql
bind_vars