Commit 1375821c authored by Alexander Nozdrin's avatar Alexander Nozdrin

Manual merge from mysql-trunk-merge.

Conflicts:
  - sql/events.cc
  - sql/mysql_priv.h
  - sql/repl_failsafe.cc
  - sql/sql_db.cc
  - sql/sql_parse.cc
  - sql/sql_show.cc
parents fa3f3bea ed79d2ec
...@@ -768,8 +768,7 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */) ...@@ -768,8 +768,7 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS) if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS)
{ {
DBUG_ASSERT(thd->lex->select_lex.db); DBUG_ASSERT(thd->lex->select_lex.db);
if (!is_infoschema_db(thd->lex->select_lex.db, // There is no events in I_S if (!is_infoschema_db(thd->lex->select_lex.db) && // There is no events in I_S
strlen(thd->lex->select_lex.db)) &&
check_access(thd, EVENT_ACL, thd->lex->select_lex.db, check_access(thd, EVENT_ACL, thd->lex->select_lex.db,
NULL, NULL, 0, 0)) NULL, NULL, 0, 0))
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -1446,6 +1446,12 @@ inline bool is_infoschema_db(const char *name, size_t len) ...@@ -1446,6 +1446,12 @@ inline bool is_infoschema_db(const char *name, size_t len)
INFORMATION_SCHEMA_NAME.str, name)); INFORMATION_SCHEMA_NAME.str, name));
} }
inline bool is_infoschema_db(const char *name)
{
return !my_strcasecmp(system_charset_info,
INFORMATION_SCHEMA_NAME.str, name);
}
void initialize_information_schema_acl(); void initialize_information_schema_acl();
/* sql_handler.cc */ /* sql_handler.cc */
......
...@@ -645,7 +645,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, ...@@ -645,7 +645,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
DBUG_ENTER("mysql_create_db"); DBUG_ENTER("mysql_create_db");
/* do not create 'information_schema' db */ /* do not create 'information_schema' db */
if (is_infoschema_db(db, strlen(db))) if (is_infoschema_db(db))
{ {
my_error(ER_DB_CREATE_EXISTS, MYF(0), db); my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -1220,8 +1220,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1220,8 +1220,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
table_list.alias= table_list.table_name= conv_name.str; table_list.alias= table_list.table_name= conv_name.str;
packet= arg_end + 1; packet= arg_end + 1;
if (!my_strcasecmp(system_charset_info, table_list.db, if (is_infoschema_db(table_list.db, table_list.db_length))
INFORMATION_SCHEMA_NAME.str))
{ {
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias); ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias);
if (schema_table) if (schema_table)
...@@ -6279,8 +6278,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -6279,8 +6278,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES); ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
ptr->derived= table->sel; ptr->derived= table->sel;
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db, if (!ptr->derived && is_infoschema_db(ptr->db, ptr->db_length))
INFORMATION_SCHEMA_NAME.str))
{ {
ST_SCHEMA_TABLE *schema_table; ST_SCHEMA_TABLE *schema_table;
if (ptr->updating && if (ptr->updating &&
......
...@@ -750,8 +750,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname, ...@@ -750,8 +750,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
#endif #endif
if (!my_strcasecmp(system_charset_info, dbname, if (is_infoschema_db(dbname))
INFORMATION_SCHEMA_NAME.str))
{ {
dbname= INFORMATION_SCHEMA_NAME.str; dbname= INFORMATION_SCHEMA_NAME.str;
create.default_table_charset= system_charset_info; create.default_table_charset= system_charset_info;
...@@ -2686,8 +2685,8 @@ int make_db_list(THD *thd, List<LEX_STRING> *files, ...@@ -2686,8 +2685,8 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
*/ */
if (lookup_field_vals->db_value.str) if (lookup_field_vals->db_value.str)
{ {
if (!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, if (is_infoschema_db(lookup_field_vals->db_value.str,
lookup_field_vals->db_value.str)) lookup_field_vals->db_value.length))
{ {
*with_i_schema= 1; *with_i_schema= 1;
if (files->push_back(i_s_name_copy)) if (files->push_back(i_s_name_copy))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment