diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-20 14:54:33 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-20 14:54:33 -0800 |
commit | 3b36a912b940921a3f1e548e59fec74300749ebc (patch) | |
tree | 931d873f5e5e51bc748e06ea7e3bce6a7cbd18c2 /lib/arel/visitors | |
parent | 5709718acd507e5c1c815ed84b016e6a28800a08 (diff) | |
download | rails-3b36a912b940921a3f1e548e59fec74300749ebc.tar.gz rails-3b36a912b940921a3f1e548e59fec74300749ebc.tar.bz2 rails-3b36a912b940921a3f1e548e59fec74300749ebc.zip |
make our caching per connection pool, not per connection
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 16 |
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 |