aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-20 14:54:33 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-20 14:54:33 -0800
commit3b36a912b940921a3f1e548e59fec74300749ebc (patch)
tree931d873f5e5e51bc748e06ea7e3bce6a7cbd18c2 /lib
parent5709718acd507e5c1c815ed84b016e6a28800a08 (diff)
downloadrails-3b36a912b940921a3f1e548e59fec74300749ebc.tar.gz
rails-3b36a912b940921a3f1e548e59fec74300749ebc.tar.bz2
rails-3b36a912b940921a3f1e548e59fec74300749ebc.zip
make our caching per connection pool, not per connection
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/visitors/to_sql.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 5efcbf009d..d959782620 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -7,22 +7,24 @@ module Arel
def initialize engine
@engine = engine
@connection = nil
+ @pool = nil
@last_column = nil
@quoted_tables = {}
@quoted_columns = {}
- @column_cache = Hash.new { |h,conn|
- h[conn] = Hash.new { |conn_h,column|
+ @column_cache = Hash.new { |h,pool|
+ h[pool] = Hash.new { |conn_h,column|
conn_h[column] = {}
}
}
- @table_exists = Hash.new { |h,conn|
- h[conn] = {}
+ @table_exists = Hash.new { |h,pool|
+ h[pool] = {}
}
end
def accept object
@last_column = nil
- @engine.connection_pool.with_connection do |conn|
+ @pool = @engine.connection_pool
+ @pool.with_connection do |conn|
@connection = conn
super
end
@@ -85,7 +87,7 @@ module Arel
end
def table_exists
- @table_exists[@connection]
+ @table_exists[@pool]
end
def column_for attr
@@ -105,7 +107,7 @@ module Arel
end
def column_cache
- @column_cache[@connection]
+ @column_cache[@pool]
end
def visit_Arel_Nodes_Values o