diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-13 10:37:43 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-26 13:44:09 -0700 |
commit | d6b16bbaf705237f68980c4b0bd3b407225d8aa0 (patch) | |
tree | dc94cb3daa88394d9e2117f70a95f58e0d99234b /activerecord/lib | |
parent | 77b1193ac148aec3fd08fd21b26827428a1449bb (diff) | |
download | rails-d6b16bbaf705237f68980c4b0bd3b407225d8aa0.tar.gz rails-d6b16bbaf705237f68980c4b0bd3b407225d8aa0.tar.bz2 rails-d6b16bbaf705237f68980c4b0bd3b407225d8aa0.zip |
one more mysql test left!
Diffstat (limited to 'activerecord/lib')
3 files changed, 10 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 492a807ff5..825b86f068 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -718,7 +718,7 @@ module ActiveRecord #:nodoc: # end # end def reset_column_information - connection.reset! + connection.clear_cache! undefine_attribute_methods @column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @inheritance_column = nil @arel_engine = @relation = @arel_table = nil diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index a36a182a9e..6f014bf9f1 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -142,6 +142,13 @@ module ActiveRecord # this should be overridden by concrete adapters end + ### + # Clear any caching the database adapter may be doing, for example + # clearing the prepared statement cache. This is database specific. + def clear_cache! + # this should be overridden by concrete adapters + end + # Returns true if its required to reload the connection between requests for development mode. # This is not the case for Ruby/MySQL and it's not necessary for any adapters except SQLite. def requires_reloading? diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 0c58c57390..97f595af66 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -80,13 +80,12 @@ module ActiveRecord def disconnect! super - @statements.clear + clear_cache! @connection.close rescue nil end - def reset! + def clear_cache! @statements.clear - super end def supports_count_distinct? #:nodoc: |