class Sequel::Mysql2::Dataset

  1. lib/sequel/adapters/mysql2.rb
Parent: Mysql2

Dataset class for MySQL datasets accessed via the native driver.

Methods

Public Instance

  1. fetch_rows
  2. stream

Constants

DatasetClass = self  

Public Instance methods

fetch_rows (sql)

Yield all rows matching this dataset.

[show source]
# File lib/sequel/adapters/mysql2.rb, line 151
def fetch_rows(sql)
  execute(sql) do |r|
    @columns = if identifier_output_method
      r.fields.map!{|c| output_identifier(c.to_s)}
    else
      r.fields
    end
    r.each(:cast_booleans=>convert_tinyint_to_bool?){|h| yield h}
  end
  self
end
stream ()

Return a clone of the dataset that will stream rows when iterating over the result set, so it can handle large datasets that won’t fit in memory (Requires mysql 0.3.12 to have an effect).

[show source]
# File lib/sequel/adapters/mysql2.rb, line 166
def stream
  clone(:stream=>true)
end