diff options
author | unknown <kroki/tomash@moonlight.home> | 2007-03-09 13:17:46 +0300 |
---|---|---|
committer | unknown <kroki/tomash@moonlight.home> | 2007-03-09 13:17:46 +0300 |
commit | b311d870523b6c1bae7e3a49e9d04d2c30bef5b2 (patch) | |
tree | 6197d95ef12f5c0b810b541f1b32c7955b0b1d7b /sql/table.cc | |
parent | 1b198eeb6893b4095c70df224eafb2c823f8970f (diff) | |
parent | 0ea47f3ed46011263d696f9852190c6a2edf4772 (diff) | |
download | mariadb-git-b311d870523b6c1bae7e3a49e9d04d2c30bef5b2.tar.gz |
Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1
into moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1-bug9953
mysql-test/r/sp-error.result:
Auto merged
mysql-test/r/view.result:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/lock.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_help.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/table.cc:
Auto merged
sql/tztime.cc:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
sql/sql_yacc.yy:
SCCS merged
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/sql/table.cc b/sql/table.cc index 560f53bae26..9112f691e4d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -245,6 +245,50 @@ void free_table_share(TABLE_SHARE *share) } +/** + Return TRUE if a table name matches one of the system table names. + Currently these are: + + help_category, help_keyword, help_relation, help_topic, + proc, + time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, + time_zone_transition_type + + This function trades accuracy for speed, so may return false + positives. Presumably mysql.* database is for internal purposes only + and should not contain user tables. +*/ + +inline bool is_system_table_name(const char *name, uint length) +{ + CHARSET_INFO *ci= system_charset_info; + + return ( + /* mysql.proc table */ + length == 4 && + my_tolower(ci, name[0]) == 'p' && + my_tolower(ci, name[1]) == 'r' && + my_tolower(ci, name[2]) == 'o' && + my_tolower(ci, name[3]) == 'c' || + + length > 4 && + ( + /* one of mysql.help* tables */ + my_tolower(ci, name[0]) == 'h' && + my_tolower(ci, name[1]) == 'e' && + my_tolower(ci, name[2]) == 'l' && + my_tolower(ci, name[3]) == 'p' || + + /* one of mysql.time_zone* tables */ + my_tolower(ci, name[0]) == 't' && + my_tolower(ci, name[1]) == 'i' && + my_tolower(ci, name[2]) == 'm' && + my_tolower(ci, name[3]) == 'e' + ) + ); +} + + /* Read table definition from a binary / text based .frm file @@ -365,11 +409,9 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) allow to lock such tables for writing with any other tables (even with other system tables) and some privilege tables need this. */ - if (!(lower_case_table_names ? - my_strcasecmp(system_charset_info, share->table_name.str, "proc") : - strcmp(share->table_name.str, "proc"))) - share->system_table= 1; - else + share->system_table= is_system_table_name(share->table_name.str, + share->table_name.length); + if (!share->system_table) { share->log_table= check_if_log_table(share->db.length, share->db.str, share->table_name.length, |