diff options
author | Aaron Patterson <tenderlove@github.com> | 2019-02-25 11:33:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 11:33:38 -0800 |
commit | ec30b842670fb1addcfc5b387dba0e749b743906 (patch) | |
tree | c6a982261f7a7736d37d1a1f8c904cad1d8308ee /activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb | |
parent | 4e105988bda79799b0fb7b51a32422ec20c7cb7d (diff) | |
parent | b7eeb142afc332e04f902e9b630d9e44dbe4c55b (diff) | |
download | rails-ec30b842670fb1addcfc5b387dba0e749b743906.tar.gz rails-ec30b842670fb1addcfc5b387dba0e749b743906.tar.bz2 rails-ec30b842670fb1addcfc5b387dba0e749b743906.zip |
Merge pull request #35402 from alimi/update-ar-read-regex
Support read queries with leading characters while preventing writes
Diffstat (limited to 'activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb index ed3f669331..a5b53f76b4 100644 --- a/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb +++ b/activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rb @@ -204,6 +204,14 @@ class Mysql2AdapterTest < ActiveRecord::Mysql2TestCase end end + def test_doesnt_error_when_a_read_query_with_leading_chars_is_called_while_preventing_writes + @conn.execute("INSERT INTO `engines` (`car_id`) VALUES ('138853948594')") + + @conn.while_preventing_writes do + assert_equal 1, @conn.execute("(\n( SELECT `engines`.* FROM `engines` WHERE `engines`.`car_id` = '138853948594' ) )").entries.count + end + end + private def with_example_table(definition = "id int auto_increment primary key, number int, data varchar(255)", &block) |