class SQLite3::Database

def execute_batch( sql, bind_vars = [], *args )

executing statements.
See also #execute_batch2 for additional ways of

rows.
This always returns +nil+, making it unsuitable for queries that return

statement.
in turn. The same bind parameters, if given, will be applied to each
string, ignoring all subsequent statements. This will execute each one
means of executing queries will only execute the first statement in the
Executes all SQL statements in the given string. By contrast, the other
def execute_batch( sql, bind_vars = [], *args )
  # FIXME: remove this stuff later
  unless [Array, Hash].include?(bind_vars.class)
    bind_vars = [bind_vars]
    warn(<<-eowarn) if $VERBOSE
ller[0]} is calling SQLite3::Database#execute_batch with bind parameters
 are not a list of a hash.  Please switch to passing bind parameters as an
y or hash. Support for this behavior will be removed in version 2.0.0.
    eowarn
  end
  # FIXME: remove this stuff later
  if bind_vars.nil? || !args.empty?
    if args.empty?
      bind_vars = []
    else
      bind_vars = [nil] + args
    end
    warn(<<-eowarn) if $VERBOSE
ller[0]} is calling SQLite3::Database#execute_batch with nil or multiple bind params
out using an array.  Please switch to passing bind parameters as an array.
ort for this behavior will be removed in version 2.0.0.
    eowarn
  end
  sql = sql.strip
  until sql.empty? do
    prepare( sql ) do |stmt|
      unless stmt.closed?
        # FIXME: this should probably use sqlite3's api for batch execution
        # This implementation requires stepping over the results.
        if bind_vars.length == stmt.bind_parameter_count
          stmt.bind_params(bind_vars)
        end
        stmt.step
      end
      sql = stmt.remainder.strip
    end
  end
  # FIXME: we should not return `nil` as a success return value
  nil
end