class Sequel::ODBC::Dataset

  1. lib/sequel/adapters/odbc.rb
Parent: ODBC

Methods

Public Instance

  1. fetch_rows

Constants

BOOL_FALSE = '0'.freeze  
BOOL_TRUE = '1'.freeze  
DatasetClass = self  
ODBC_DATE_FORMAT = "{d '%Y-%m-%d'}".freeze  
TIMESTAMP_FORMAT = "{ts '%Y-%m-%d %H:%M:%S'}".freeze  

Public Instance methods

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