diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-27 14:40:32 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-27 14:40:32 -0700 |
commit | 4b536f75914fa42ebb3036fe13e08f5b0446deb2 (patch) | |
tree | 70d8ac476d38d57421a7a68728c84a70dd000533 /activerecord/lib | |
parent | 2a9b3abe193c7d8048b65fb40fba8f4bec697b3f (diff) | |
parent | ed1a0672abb4d6e8aba3f6db7d90970f98a5f8c2 (diff) | |
download | rails-4b536f75914fa42ebb3036fe13e08f5b0446deb2.tar.gz rails-4b536f75914fa42ebb3036fe13e08f5b0446deb2.tar.bz2 rails-4b536f75914fa42ebb3036fe13e08f5b0446deb2.zip |
Merge pull request #1365 from gnufied/sqlite3
close statment only if its not closed
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 8e7c936bf8..ee138236c8 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -102,7 +102,7 @@ module ActiveRecord # Clears the prepared statements cache. def clear_cache! - @statements.values.each { |hash| hash[:stmt].close } + @statements.values.each { |hash| !hash[:stmt].closed? && hash[:stmt].close } @statements.clear end diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d88e2693b6..e852f50d86 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -12,7 +12,7 @@ module ActiveRecord # These are explicitly delegated to improve performance (avoids method_missing) delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a - delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key, :to => :klass + delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key, :connection, :column_hash,:to => :klass attr_reader :table, :klass, :loaded attr_accessor :extensions, :default_scoped |