Class | Sequel::Mysql2::Dataset
In: | lib/sequel/adapters/mysql2.rb
Parent: | Sequel::Dataset

Dataset class for MySQL datasets accessed via the native driver.

### Methods

fetch_rows

### Included Modules

Sequel::MySQL::DatasetMethods Sequel::MySQL::PreparedStatements::DatasetMethods

### Constants

DatasetClass | = | self

### Public Instance methods

fetch_rows(sql) {|h| ...}

Yield all rows matching this dataset.

[Source]

         # File lib/sequel/adapters/mysql2.rb, line 147
    147:       def fetch_rows(sql)
    148:         execute(sql) do |r|
    149:           if identifier_output_method
    150:             cols = r.fields
    151:             @columns = cols2 = cols.map{|c| output_identifier(c.to_s)}
    152:             cs = cols.zip(cols2)
    153:             r.each do |row|
    154:               h = {}
    155:               cs.each do |a, b|
    156:                 h[b] = row[a]
    157:               end
    158:               yield h
    159:             end
    160:           else
    161:             @columns = r.fields
    162:             r.each{|h| yield h}
    163:           end
    164:         end
    165:         self
    166:       end

[Validate]