File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
lib/active_record/connection_adapters Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -810,7 +810,7 @@ def configure_connection
810810 # Make MySQL reject illegal values rather than truncating or blanking them, see
811811 # http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables
812812 # If the user has provided another value for sql_mode, don't replace it.
813- if @config . has_key? ( :strict ) && ! variables . has_key? ( 'sql_mode' )
813+ unless [ ':default' , :default ] . include? ( @config [ :strict ] ) || variables . has_key? ( 'sql_mode' )
814814 variables [ 'sql_mode' ] = strict_mode? ? 'STRICT_ALL_TABLES' : ''
815815 end
816816
Original file line number Diff line number Diff line change @@ -147,9 +147,9 @@ def test_mysql_strict_mode_disabled
147147 end
148148 end
149149
150- def test_mysql_strict_mode_unspecified
150+ def test_mysql_strict_mode_specified_default
151151 run_without_connection do |orig_connection |
152- ActiveRecord ::Base . establish_connection ( orig_connection . reject { | key , _ | key == :strict } )
152+ ActiveRecord ::Base . establish_connection ( orig_connection . merge ( { strict : :default } ) )
153153 global_sql_mode = ActiveRecord ::Base . connection . exec_query "SELECT @@GLOBAL.sql_mode"
154154 session_sql_mode = ActiveRecord ::Base . connection . exec_query "SELECT @@SESSION.sql_mode"
155155 assert_equal global_sql_mode . rows , session_sql_mode . rows
Original file line number Diff line number Diff line change @@ -86,9 +86,9 @@ def test_mysql_strict_mode_disabled
8686 end
8787 end
8888
89- def test_mysql_strict_mode_unspecified
89+ def test_mysql_strict_mode_specified_default
9090 run_without_connection do |orig_connection |
91- ActiveRecord ::Base . establish_connection ( orig_connection . reject { | key , _ | key == :strict } )
91+ ActiveRecord ::Base . establish_connection ( orig_connection . merge ( { strict : :default } ) )
9292 global_sql_mode = ActiveRecord ::Base . connection . exec_query "SELECT @@GLOBAL.sql_mode"
9393 session_sql_mode = ActiveRecord ::Base . connection . exec_query "SELECT @@SESSION.sql_mode"
9494 assert_equal global_sql_mode . rows , session_sql_mode . rows
You can’t perform that action at this time.
0 commit comments