class SQLite3::Database
def query( sql, bind_vars = [], *args )
with a block, +close+ will be invoked implicitly when the block
returned, or you could have problems with locks on the table. If called
You must be sure to call +close+ on the ResultSet instance that is
result = db.prepare( "select * from foo where a=?" ).execute( 5 )
# is the same as
result = db.query( "select * from foo where a=?", [5])
paramters to it, and calling execute:
This is a convenience method for creating a statement, binding
def query( sql, bind_vars = [], *args ) if bind_vars.nil? || !args.empty? if args.empty? bind_vars = [] else bind_vars = [bind_vars] + args end warn(<<-eowarn) if $VERBOSE ller[0]} is calling SQLite3::Database#query with nil or multiple bind params out using an array. Please switch to passing bind parameters as an array. ort for this will be removed in version 2.0.0. eowarn end result = prepare( sql ).execute( bind_vars ) if block_given? begin yield result ensure result.close end else return result end end