diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-09-20 14:15:27 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-09-20 14:46:35 +0900 |
commit | e29f02e1bd4d424f7b0294958251aa49e88d688e (patch) | |
tree | 14a00fda0cb1f947550c80f7120cc5694a2c0a96 /activerecord/test/cases | |
parent | 26aa1b58b0e9451d15a0ee32da3c004d44e5a356 (diff) | |
download | rails-e29f02e1bd4d424f7b0294958251aa49e88d688e.tar.gz rails-e29f02e1bd4d424f7b0294958251aa49e88d688e.tar.bz2 rails-e29f02e1bd4d424f7b0294958251aa49e88d688e.zip |
Refactor `table_exists?` in AbstractMysqlAdapter
`table_exists?` calls `tables` twice when passed `'dbname.tblname'` arg.
This change is that `table_exists?` execute only once query always and
extra args of `tables` is removed.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/schema_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/test_case.rb | 2 |
2 files changed, 1 insertions, 9 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/schema_test.rb b/activerecord/test/cases/adapters/mysql2/schema_test.rb index 880a2123d2..faf2acb9cb 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_test.rb @@ -36,14 +36,6 @@ module ActiveRecord assert(!@connection.table_exists?("#{@db_name}.zomg"), "table should not exist") end - def test_tables_quoting - @connection.tables(nil, "foo-bar", nil) - flunk - rescue => e - # assertion for *quoted* database properly - assert_match(/database 'foo-bar'/, e.inspect) - end - def test_dump_indexes index_a_name = 'index_key_tests_on_snack' index_b_name = 'index_key_tests_on_pizza' diff --git a/activerecord/test/cases/test_case.rb b/activerecord/test/cases/test_case.rb index f93e85f5e2..47e664f4e7 100644 --- a/activerecord/test/cases/test_case.rb +++ b/activerecord/test/cases/test_case.rb @@ -103,7 +103,7 @@ module ActiveRecord # ignored SQL, or better yet, use a different notification for the queries # instead examining the SQL content. oracle_ignored = [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im, /^\s*select .* from all_constraints/im, /^\s*select .* from all_tab_cols/im] - mysql_ignored = [/^SHOW TABLES/i, /^SHOW FULL FIELDS/, /^SHOW CREATE TABLE /i, /^SHOW VARIABLES /, /^\s*SELECT column_name\b.*\bFROM information_schema\.key_column_usage\b/im] + mysql_ignored = [/^SHOW FULL TABLES/i, /^SHOW FULL FIELDS/, /^SHOW CREATE TABLE /i, /^SHOW VARIABLES /, /^\s*SELECT (?:column_name|table_name)\b.*\bFROM information_schema\.(?:key_column_usage|tables)\b/im] postgresql_ignored = [/^\s*select\b.*\bfrom\b.*pg_namespace\b/im, /^\s*select tablename\b.*from pg_tables\b/im, /^\s*select\b.*\battname\b.*\bfrom\b.*\bpg_attribute\b/im, /^SHOW search_path/i] sqlite3_ignored = [/^\s*SELECT name\b.*\bFROM sqlite_master/im, /^\s*SELECT sql\b.*\bFROM sqlite_master/im] |