From 149a1e16d492e8a313fb04686ae64accaeeda06e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 24 Feb 2015 18:27:26 -0800 Subject: cache quoted column names in SQLite3 we do this in other adapters, and it's a nice speed improvement --- activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') 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 #-- -- cgit v1.2.3