提交 d99db6b8 编写于 作者: S Sean Griffin

Merge pull request #18856 from al2o3cr/issue_17897

Match table names exactly on MySQL
......@@ -482,8 +482,16 @@ def collation
show_variable 'collation_database'
end
def tables(name = nil) # :nodoc:
select_values("SHOW FULL TABLES", 'SCHEMA')
def tables(name = nil, database = nil, like = nil) #:nodoc:
database ||= current_database
sql = "SELECT table_name FROM information_schema.tables "
sql << "WHERE table_schema = #{quote(database)}"
sql << " AND table_name = #{quote(like)}" if like
execute_and_free(sql, 'SCHEMA') do |result|
result.collect(&:first)
end
end
alias data_sources tables
......
......@@ -103,7 +103,7 @@ def clear_log; self.log = []; self.log_all = []; end
# 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 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]
mysql_ignored = [/^SHOW FULL TABLES/i, /^SHOW FULL FIELDS/, /^SHOW CREATE TABLE /i, /^SHOW VARIABLES /, /^SELECT DATABASE\(\) as db$/, /^SELECT table_name FROM information_schema\.tables/]
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]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册