Method: Sequel::ODBC::Dataset#fetch_rows

Defined in:
lib/sequel/adapters/odbc.rb

#fetch_rows(sql) ⇒ Object


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/sequel/adapters/odbc.rb', line 89

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
    s.each do |row|
      hash = {}
      cols.each do |n,t,j|
        v = row[j]
        # We can assume v is not false, so this shouldn't convert false to nil.
        hash[n] = (convert_odbc_value(v, t) if v)
      end
      yield hash
    end
  end
  self
end