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.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/sqlite3/statement.rb', line 57 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 |