Method: SQLite3::Database#execute_batch
- Defined in:
- lib/sqlite3/database.rb
#execute_batch(sql, *bind_vars) ⇒ Object
Executes all SQL statements in the given string. By contrast, the other means of executing queries will only execute the first statement in the string, ignoring all subsequent statements. This will execute each one in turn. The same bind parameters, if given, will be applied to each statement.
This always returns nil, making it unsuitable for queries that return rows.
222 223 224 225 226 227 228 229 230 231 |
# File 'lib/sqlite3/database.rb', line 222 def execute_batch( sql, *bind_vars ) sql = sql.strip until sql.empty? do prepare( sql ) do |stmt| stmt.execute( *bind_vars ) sql = stmt.remainder.strip end end nil end |