class Sequel::DataObjects::Dataset

  1. lib/sequel/adapters/do.rb
Parent: DataObjects

Methods

Public Instance

  1. fetch_rows

Constants

DatasetClass = self  

Public Instance methods

fetch_rows (sql)

Execute the SQL on the database and yield the rows as hashes with symbol keys.

[show source]
# File lib/sequel/adapters/do.rb, line 155
def fetch_rows(sql)
  execute(sql) do |reader|
    cols = @columns = reader.fields.map{|f| output_identifier(f)}
    while(reader.next!) do
      h = {}
      cols.zip(reader.values).each{|k, v| h[k] = v}
      yield h
    end
  end
  self
end