lib/sequel_core/adapters/postgres.rb
def fetch_rows(sql)
        cols = []
        execute(sql) do |res|
          res.nfields.times do |fieldnum|
            cols << [fieldnum, PG_TYPES[res.ftype(fieldnum)], res.fname(fieldnum).to_sym]
          end
          @columns = cols.map{|c| c.at(2)}
          res.ntuples.times do |recnum|
            converted_rec = {}
            cols.each do |fieldnum, type_proc, fieldsym|
              value = res.getvalue(recnum, fieldnum)
              converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value
            end
            yield converted_rec
          end
        end
      end
# Yield all rows returned by executing the given SQL and converting
# the types.
Yield all rows returned by executing the given SQL and converting
the types.
Yield all rows returned by executing the given SQL and converting the types .
def fetch_rows(sql)
        cols = []
        execute(sql) do |res|
          res.nfields.times do |fieldnum|
            cols << [fieldnum, PG_TYPES[res.ftype(fieldnum)], res.fname(fieldnum).to_sym]
          end
          @columns = cols.map{|c| c.at(2)}
          res.ntuples.times do |recnum|
            converted_rec = {}
            cols.each do |fieldnum, type_proc, fieldsym|
              value = res.getvalue(recnum, fieldnum)
              converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value
            end
            yield converted_rec
          end
        end
      end
def fetch_rows ( sql ) cols = [ ] execute ( sql ) do | res | res . nfields . times do | fieldnum | cols << [ fieldnum , PG_TYPES [ res . ftype ( fieldnum ) ] , res . fname ( fieldnum ) . to_sym ] end @columns = cols . map { | c | c . at ( 2 ) } res . ntuples . times do | recnum | converted_rec = { } cols . each do | fieldnum , type_proc , fieldsym | value = res . getvalue ( recnum , fieldnum ) converted_rec [ fieldsym ] = ( value && type_proc ) ? type_proc . call ( value ) : value end yield converted_rec end end end
Yield all rows returned by executing the given SQL and converting
the types.
Yield all rows returned by executing the given SQL and converting the types .
sql