Method: SQLite3::Statement#bind_params
- Defined in:
- lib/sqlite3/statement.rb
#bind_params(*bind_vars) ⇒ Object
Binds the given variables to the corresponding placeholders in the SQL text.
See Database#execute for a description of the valid placeholder syntaxes.
Example:
stmt = db.prepare( "select * from table where a=? and b=?" )
stmt.bind_params( 15, "hello" )
See also #execute, #bind_param, Statement#bind_param, and Statement#bind_params.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/sqlite3/statement.rb', line 35 def bind_params( *bind_vars ) index = 1 bind_vars.flatten.each do |var| if Hash === var var.each { |key, val| bind_param key, val } else bind_param index, var index += 1 end end end |