384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
# File 'lib/sequel/adapters/ibmdb.rb', line 384
def fetch_rows(sql)
execute(sql) do |stmt|
columns = []
convert = convert_smallint_to_bool
cps = db.conversion_procs
stmt.num_fields.times do |i|
k = stmt.field_name i
key = output_identifier(k)
type = stmt.field_type(i).downcase.to_sym
type = :boolean if type == :int && convert && stmt.field_precision(i) < 8
type = :blob if type == :clob && db.use_clob_as_blob
columns << [key, cps[type]]
end
cols = columns.map{|c| c[0]}
self.columns = cols
while res = stmt.fetch_array
row = {}
res.zip(columns).each do |v, (k, pr)|
row[k] = ((pr ? pr.call(v) : v) if v)
end
yield row
end
end
self
end
|