diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-09-01 00:42:49 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-09-01 00:42:49 -0300 |
commit | ce0bd6856d955d350cb45b0ab40a4216549c4d41 (patch) | |
tree | acabb6e0698ef058f4af763d6c5cd0dadeac06c8 /activerecord | |
parent | ca32e61c2a0085f76976f23d434a306a1c764ed1 (diff) | |
parent | 0fa842487472517a13acffcd2558d592bfbed633 (diff) | |
download | rails-ce0bd6856d955d350cb45b0ab40a4216549c4d41.tar.gz rails-ce0bd6856d955d350cb45b0ab40a4216549c4d41.tar.bz2 rails-ce0bd6856d955d350cb45b0ab40a4216549c4d41.zip |
Merge pull request #21318 from yahonda/pr21108
Support MySQL 5.7.8 which enables show_compatibility_56=off
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index b3e55a0b90..c086111d41 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -727,8 +727,12 @@ module ActiveRecord # SHOW VARIABLES LIKE 'name' def show_variable(name) - variables = select_all("SHOW VARIABLES LIKE '#{name}'", 'SCHEMA') - variables.first['Value'] unless variables.empty? + begin + variables = select_all("select @@#{name} as 'Value'", 'SCHEMA') + variables.first['Value'] unless variables.empty? + rescue ActiveRecord::StatementInvalid => _e + nil + end end # Returns a table's primary key and belonging sequence. diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 2ae462d773..0738c59ddf 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -223,7 +223,7 @@ module ActiveRecord return @client_encoding if @client_encoding result = exec_query( - "SHOW VARIABLES WHERE Variable_name = 'character_set_client'", + "select @@character_set_client", 'SCHEMA') @client_encoding = ENCODINGS[result.rows.last.last] end |