class Sequel::ODBC::Dataset

Constants

BOOL_FALSE
BOOL_TRUE
DatasetClass
ODBC_DATE_FORMAT
TIMESTAMP_FORMAT

Public Instance Methods

fetch_rows(sql) { |hash| ... } click to toggle source
# File lib/sequel/adapters/odbc.rb, line 108
def fetch_rows(sql)
  execute(sql) do |s|
    i = -1
    cols = s.columns(true).map{|c| [output_identifier(c.name), c.type, i+=1]}
    columns = cols.map{|c| c[0]}
    self.columns = columns
    if rows = s.fetch_all
      rows.each do |row|
        hash = {}
        cols.each{|n,t,j| hash[n] = convert_odbc_value(row[j], t)}
        yield hash
      end
    end
  end
  self
end