class Sequel::Mysql2::Dataset

Dataset class for MySQL datasets accessed via the native driver.

Constants

DatasetClass
PreparedStatementMethods
STREAMING_SUPPORTED

Public Instance Methods

fetch_rows(sql) { |h| ... } click to toggle source

Yield all rows matching this dataset.

# File lib/sequel/adapters/mysql2.rb, line 253
def fetch_rows(sql)
  execute(sql) do |r|
    self.columns = r.fields.map!{|c| output_identifier(c.to_s)}
    r.each(:cast_booleans=>convert_tinyint_to_bool?){|h| yield h}
  end
  self
end
paged_each(opts=OPTS, &block) click to toggle source

Use streaming to implement paging if Mysql2 supports it.

# File lib/sequel/adapters/mysql2.rb, line 262
def paged_each(opts=OPTS, &block)
  if STREAMING_SUPPORTED
    stream.each(&block)
  else
    super
  end
end
stream() click to toggle source

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).

# File lib/sequel/adapters/mysql2.rb, line 273
def stream
  clone(:stream=>true)
end