mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Perf: fields in pg gem causes an allocation, cache it
This commit is contained in:
parent
e453aa91bb
commit
32b233c953
1 changed files with 3 additions and 2 deletions
|
@ -139,7 +139,8 @@ module ActiveRecord
|
|||
exec_cache(sql, binds)
|
||||
|
||||
types = {}
|
||||
result.fields.each_with_index do |fname, i|
|
||||
fields = result.fields
|
||||
fields.each_with_index do |fname, i|
|
||||
ftype = result.ftype i
|
||||
fmod = result.fmod i
|
||||
types[fname] = OID::TYPE_MAP.fetch(ftype, fmod) { |oid, mod|
|
||||
|
@ -148,7 +149,7 @@ module ActiveRecord
|
|||
}
|
||||
end
|
||||
|
||||
ret = ActiveRecord::Result.new(result.fields, result.values, types)
|
||||
ret = ActiveRecord::Result.new(fields, result.values, types)
|
||||
result.clear
|
||||
return ret
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue