aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-07-07 01:32:31 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-07-24 22:18:07 +0900
commite703de17d8bc078a0f395902b50f7080a4bba863 (patch)
tree79ccb6b144cebb09a6112c47cf42dcf22e003a0d /activerecord/lib/active_record/connection_adapters
parent56527bb737eb5e1d5531cafe99ce91d025565ead (diff)
downloadrails-e703de17d8bc078a0f395902b50f7080a4bba863.tar.gz
rails-e703de17d8bc078a0f395902b50f7080a4bba863.tar.bz2
rails-e703de17d8bc078a0f395902b50f7080a4bba863.zip
Decouple statement cache from connection adapter
`StatementCache` is hard-coded in `cacheable_query` and be passed `visitor` and `collector` from connection adapter. Simply it is enough to pass a collected value.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
index 74aae3a1e4..621f737a5e 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -18,11 +18,12 @@ module ActiveRecord
# This is used in the StatementCache object. It returns an object that
# can be used to query the database repeatedly.
- def cacheable_query(arel) # :nodoc:
+ def cacheable_query(klass, arel) # :nodoc:
+ collected = visitor.accept(arel.ast, collector)
if prepared_statements
- ActiveRecord::StatementCache.query visitor, arel.ast
+ klass.query(collected.value)
else
- ActiveRecord::StatementCache.partial_query visitor, arel.ast, collector
+ klass.partial_query(collected.value)
end
end