diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-02-24 18:27:26 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-02-24 18:28:00 -0800 |
commit | 149a1e16d492e8a313fb04686ae64accaeeda06e (patch) | |
tree | 6255e47ff836e2e1964af8966c0f58f23b3a507e /activerecord/lib/active_record | |
parent | 4cd0da5c9a27a4bc99a79d1295d80a2bfb667885 (diff) | |
download | rails-149a1e16d492e8a313fb04686ae64accaeeda06e.tar.gz rails-149a1e16d492e8a313fb04686ae64accaeeda06e.tar.bz2 rails-149a1e16d492e8a313fb04686ae64accaeeda06e.zip |
cache quoted column names in SQLite3
we do this in other adapters, and it's a nice speed improvement
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 400b586c95..7e184dd510 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -121,6 +121,7 @@ module ActiveRecord @config = config @visitor = Arel::Visitors::SQLite.new self + @quoted_column_names = {} if self.class.type_cast_config_to_boolean(config.fetch(:prepared_statements) { true }) @prepared_statements = true @@ -240,7 +241,7 @@ module ActiveRecord end def quote_column_name(name) #:nodoc: - %Q("#{name.to_s.gsub('"', '""')}") + @quoted_column_names[name] ||= %Q("#{name.to_s.gsub('"', '""')}") end #-- |