Commit ee7b8b77 authored by Alexander Nozdrin's avatar Alexander Nozdrin

Manual merge from mysql-trunk-merge.

Conflicts:
  - sql/event_data_objects.cc
  - sql/events.cc
  - sql/mysql_priv.h
  - sql/repl_failsafe.cc
  - sql/sql_parse.cc
  - sql/sql_show.cc
  - sql/sql_view.cc
  - sql/table.cc
parents 34e9b3c7 b60d59b9
...@@ -768,7 +768,8 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */) ...@@ -768,7 +768,8 @@ 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);
......
...@@ -1439,8 +1439,12 @@ bool get_schema_tables_result(JOIN *join, ...@@ -1439,8 +1439,12 @@ bool get_schema_tables_result(JOIN *join,
enum enum_schema_table_state executed_place); enum enum_schema_table_state executed_place);
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table); enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
#define is_infoschema_db(X) \ inline bool is_infoschema_db(const char *name, size_t len)
!my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X)) {
return (INFORMATION_SCHEMA_NAME.length == len &&
!my_strcasecmp(system_charset_info,
INFORMATION_SCHEMA_NAME.str, name));
}
void initialize_information_schema_acl(); void initialize_information_schema_acl();
......
...@@ -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 (!my_strcasecmp(system_charset_info, db, INFORMATION_SCHEMA_NAME.str)) if (is_infoschema_db(db, strlen(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);
...@@ -1600,8 +1600,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) ...@@ -1600,8 +1600,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
} }
} }
if (my_strcasecmp(system_charset_info, new_db_name->str, if (is_infoschema_db(new_db_name->str, new_db_name->length))
INFORMATION_SCHEMA_NAME.str) == 0)
{ {
/* Switch the current database to INFORMATION_SCHEMA. */ /* Switch the current database to INFORMATION_SCHEMA. */
......
...@@ -215,10 +215,7 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name) ...@@ -215,10 +215,7 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
DBUG_ASSERT(db != NULL); DBUG_ASSERT(db != NULL);
DBUG_ASSERT(name != NULL); DBUG_ASSERT(name != NULL);
if ((db->length == INFORMATION_SCHEMA_NAME.length) && if (is_infoschema_db(db->str, db->length))
(my_strcasecmp(system_charset_info,
INFORMATION_SCHEMA_NAME.str,
db->str) == 0))
return TABLE_CATEGORY_INFORMATION; return TABLE_CATEGORY_INFORMATION;
if ((db->length == PERFORMANCE_SCHEMA_DB_NAME.length) && if ((db->length == PERFORMANCE_SCHEMA_DB_NAME.length) &&
...@@ -3941,7 +3938,8 @@ const char *Natural_join_column::db_name() ...@@ -3941,7 +3938,8 @@ const char *Natural_join_column::db_name()
DBUG_ASSERT(!strcmp(table_ref->db, DBUG_ASSERT(!strcmp(table_ref->db,
table_ref->table->s->db.str) || table_ref->table->s->db.str) ||
(table_ref->schema_table && (table_ref->schema_table &&
is_infoschema_db(table_ref->table->s->db.str))); is_infoschema_db(table_ref->table->s->db.str,
table_ref->table->s->db.length)));
return table_ref->db; return table_ref->db;
} }
...@@ -4159,7 +4157,8 @@ const char *Field_iterator_table_ref::get_db_name() ...@@ -4159,7 +4157,8 @@ const char *Field_iterator_table_ref::get_db_name()
*/ */
DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str) || DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str) ||
(table_ref->schema_table && (table_ref->schema_table &&
is_infoschema_db(table_ref->table->s->db.str))); is_infoschema_db(table_ref->table->s->db.str,
table_ref->table->s->db.length)));
return table_ref->db; return table_ref->db;
} }
......
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