diff options
author | Paul Nikitochkin <paul.nikitochkin@gmail.com> | 2014-04-29 01:39:47 +0300 |
---|---|---|
committer | Paul Nikitochkin <paul.nikitochkin@gmail.com> | 2014-04-30 22:56:27 +0300 |
commit | 7e8b06282354da82518f96e0aab38f04788237fa (patch) | |
tree | dbfffe78014f2a4ec5baa17b98c5a09d6b2f5795 /activerecord/test/cases/adapters/mysql | |
parent | fd924371126a50789d31582b9efa074fd47a803e (diff) | |
download | rails-7e8b06282354da82518f96e0aab38f04788237fa.tar.gz rails-7e8b06282354da82518f96e0aab38f04788237fa.tar.bz2 rails-7e8b06282354da82518f96e0aab38f04788237fa.zip |
Stringify variables names for mysql connections
For mysql2/mysql adapters, `sql_mode` variable name set in `database.yml`
as string, was ignored and `sql_mode` was set to use strict mode.
Fixes #14895
Diffstat (limited to 'activerecord/test/cases/adapters/mysql')
-rw-r--r-- | activerecord/test/cases/adapters/mysql/connection_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/mysql/connection_test.rb b/activerecord/test/cases/adapters/mysql/connection_test.rb index 412efa22ff..4c90d06732 100644 --- a/activerecord/test/cases/adapters/mysql/connection_test.rb +++ b/activerecord/test/cases/adapters/mysql/connection_test.rb @@ -151,6 +151,14 @@ class MysqlConnectionTest < ActiveRecord::TestCase end end + def test_mysql_sql_mode_variable_overides_strict_mode + run_without_connection do |orig_connection| + ActiveRecord::Base.establish_connection(orig_connection.deep_merge(variables: { 'sql_mode' => 'ansi' })) + result = ActiveRecord::Base.connection.exec_query 'SELECT @@SESSION.sql_mode' + assert_not_equal [['STRICT_ALL_TABLES']], result.rows + end + end + def test_mysql_set_session_variable_to_default run_without_connection do |orig_connection| ActiveRecord::Base.establish_connection(orig_connection.deep_merge({:variables => {:default_week_format => :default}})) |