Method: SQLite3::Statement#execute
- Defined in:
- lib/sqlite3/statement.rb
#execute(*bind_vars) {|results| ... } ⇒ Object
Execute the statement. This creates a new ResultSet object for the statement’s virtual machine. If a block was given, the new ResultSet will be yielded to it; otherwise, the ResultSet will be returned.
Any parameters will be bound to the statement using #bind_params.
Example:
stmt = db.prepare( "select * from table" )
stmt.execute do |result|
...
end
See also #bind_params, #execute!.
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/sqlite3/statement.rb', line 78 def execute(*bind_vars) reset! if active? || done? bind_params(*bind_vars) unless bind_vars.empty? results = @connection.build_result_set self step if column_count == 0 yield results if block_given? results end |