aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-11-11 03:38:49 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-11-11 03:38:49 -0800
commit1c6d6b637e5477ab476916ac86b5af57d7f4a706 (patch)
treec85fe3cda343b0525407ecf9ea399d3ccae28e0f
parent7352efa6f87536af2bc22bef3f005ddfb793acc3 (diff)
parent27c5800c9cf8c19c3deb8bb6ebc1186d0f865d69 (diff)
downloadrails-1c6d6b637e5477ab476916ac86b5af57d7f4a706.tar.gz
rails-1c6d6b637e5477ab476916ac86b5af57d7f4a706.tar.bz2
rails-1c6d6b637e5477ab476916ac86b5af57d7f4a706.zip
Merge pull request #3609 from noefroidevaux/issue_3595
Prevent multiple SHOW TABLES calls when a table don't exists in database...
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index 77a5fe1efb..92dfb844db 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -123,14 +123,14 @@ module ActiveRecord
# A cached lookup for table existence.
def table_exists?(name)
- return true if @tables.key? name
+ return @tables[name] if @tables.key? name
with_connection do |conn|
conn.tables.each { |table| @tables[table] = true }
- @tables[name] = true if !@tables.key?(name) && conn.table_exists?(name)
+ @tables[name] = !@tables.key?(name) && conn.table_exists?(name)
end
- @tables.key? name
+ @tables[name]
end
# Clears out internal caches: