method
select
rails latest stable - Class:
ActiveRecord::ConnectionAdapters::OracleAdapter
select(sql, name = nil)private
No documentation available.
# File activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 492
def select(sql, name = nil)
cursor = execute(sql, name)
cols = cursor.get_col_names.map { |x| oracle_downcase(x) }
rows = []
while row = cursor.fetch
hash = Hash.new
cols.each_with_index do |col, i|
hash[col] =
case row[i]
when OCI8::LOB
name == 'Writable Large Object' ? row[i]: row[i].read
when OraDate
(row[i].hour == 0 and row[i].minute == 0 and row[i].second == 0) ?
row[i].to_date : row[i].to_time
else row[i]
end unless col == 'raw_rnum_'
end
rows << hash
end
rows
ensure
cursor.close if cursor
end