summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-01-28 00:10:37 +0300
committerAlexander Nozdrin <alik@sun.com>2010-01-28 00:10:37 +0300
commitee7b8b77613c8fcc9eb134fe528de9b9586365b6 (patch)
treebe09994bcfa8f4152e04932dbfeb0f933530ccb0
parent34e9b3c7ca9782318f8c7b9fd6743e82d5aa2ef1 (diff)
parentb60d59b958e276b966d44cb8cfd38fe9547da586 (diff)
downloadmariadb-git-ee7b8b77613c8fcc9eb134fe528de9b9586365b6.tar.gz
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
-rw-r--r--sql/events.cc3
-rw-r--r--sql/mysql_priv.h8
-rw-r--r--sql/sql_db.cc5
-rw-r--r--sql/table.cc11
4 files changed, 15 insertions, 12 deletions
diff --git a/sql/events.cc b/sql/events.cc
index ad98e257f79..b007d73833b 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -768,7 +768,8 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS)
{
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,
NULL, NULL, 0, 0))
DBUG_RETURN(1);
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 4d5490e8219..30bec7a6b54 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1439,8 +1439,12 @@ bool get_schema_tables_result(JOIN *join,
enum enum_schema_table_state executed_place);
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
-#define is_infoschema_db(X) \
- !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X))
+inline bool is_infoschema_db(const char *name, size_t len)
+{
+ return (INFORMATION_SCHEMA_NAME.length == len &&
+ !my_strcasecmp(system_charset_info,
+ INFORMATION_SCHEMA_NAME.str, name));
+}
void initialize_information_schema_acl();
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 9fef7114898..fe38afb0521 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -645,7 +645,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
DBUG_ENTER("mysql_create_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);
DBUG_RETURN(-1);
@@ -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,
- INFORMATION_SCHEMA_NAME.str) == 0)
+ if (is_infoschema_db(new_db_name->str, new_db_name->length))
{
/* Switch the current database to INFORMATION_SCHEMA. */
diff --git a/sql/table.cc b/sql/table.cc
index c0c365f4901..3e2e5adc2c7 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -215,10 +215,7 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
DBUG_ASSERT(db != NULL);
DBUG_ASSERT(name != NULL);
- if ((db->length == INFORMATION_SCHEMA_NAME.length) &&
- (my_strcasecmp(system_charset_info,
- INFORMATION_SCHEMA_NAME.str,
- db->str) == 0))
+ if (is_infoschema_db(db->str, db->length))
return TABLE_CATEGORY_INFORMATION;
if ((db->length == PERFORMANCE_SCHEMA_DB_NAME.length) &&
@@ -3941,7 +3938,8 @@ const char *Natural_join_column::db_name()
DBUG_ASSERT(!strcmp(table_ref->db,
table_ref->table->s->db.str) ||
(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;
}
@@ -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) ||
(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;
}