From 60c33be87c291e6008b1d0cb4e9397d928902408 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Tue, 17 Aug 2010 22:55:31 -0700 Subject: [PATCH] multiple variable assignments can done in a single query --- lib/active_record/connection_adapters/mysql2_adapter.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/active_record/connection_adapters/mysql2_adapter.rb index 96cf2d0..1b433ae 100644 --- a/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -606,12 +606,11 @@ module ActiveRecord def configure_connection @connection.query_options.merge!(:as => :array) - encoding = @config[:encoding] - execute("SET NAMES '#{encoding}'", :skip_logging) if encoding # By default, MySQL 'where id is null' selects the last inserted id. # Turn this off. http://dev.rubyonrails.org/ticket/6778 - execute("SET SQL_AUTO_IS_NULL=0", :skip_logging) + encoding = @config[:encoding] + execute("SET NAMES '#{encoding}', SQL_AUTO_IS_NULL=0", :skip_logging) if encoding end # Returns an array of record hashes with the column names as keys and