summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-01-22 14:58:21 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-01-22 14:58:21 +0400
commit4a10f7b46c9ebbd9af89f37f64df40981459b788 (patch)
treebac6a09c84cadfa7b79089a66ed4c224e0a0e3c5 /sql
parentf42a200e9e1e535dcf647237fcb4ccb65c04965d (diff)
downloadmariadb-git-4a10f7b46c9ebbd9af89f37f64df40981459b788.tar.gz
Bug#49501 Inefficient information_schema check (system collation), addon
removed wrongly introduced strlen calls sql/events.cc: removed wrongly introduced strlen calls sql/mysql_priv.h: removed wrongly introduced strlen calls sql/repl_failsafe.cc: removed wrongly introduced strlen calls sql/sql_db.cc: removed wrongly introduced strlen calls sql/sql_parse.cc: removed wrongly introduced strlen calls sql/sql_show.cc: removed wrongly introduced strlen calls
Diffstat (limited to 'sql')
-rw-r--r--sql/events.cc3
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/sql_db.cc2
-rw-r--r--sql/sql_parse.cc6
-rw-r--r--sql/sql_show.cc2
6 files changed, 13 insertions, 8 deletions
diff --git a/sql/events.cc b/sql/events.cc
index 790e6a61699..3273635666e 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -871,8 +871,7 @@ 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_schema_db(thd->lex->select_lex.db, // There is no events in I_S
- strlen(thd->lex->select_lex.db)) &&
+ if (!is_schema_db(thd->lex->select_lex.db) && // There is no events in I_S
check_access(thd, EVENT_ACL, thd->lex->select_lex.db, 0, 0, 0, 0))
DBUG_RETURN(1);
db= thd->lex->select_lex.db;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 76edbf1dea3..abc50cd8063 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1426,6 +1426,12 @@ inline bool is_schema_db(const char *name, size_t len)
INFORMATION_SCHEMA_NAME.str, name));
}
+inline bool is_schema_db(const char *name)
+{
+ return !my_strcasecmp(system_charset_info,
+ INFORMATION_SCHEMA_NAME.str, name);
+}
+
/* sql_prepare.cc */
void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length);
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index dda84ca8a37..c6a05e93bf4 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -905,7 +905,7 @@ bool load_master_data(THD* thd)
if (!rpl_filter->db_ok(db) ||
!rpl_filter->db_ok_with_wild_table(db) ||
!strcmp(db,"mysql") ||
- is_schema_db(db, strlen(db)))
+ is_schema_db(db))
{
*cur_table_res = 0;
continue;
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 22ecaa17a0c..a3f9b4baea4 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -618,7 +618,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 (is_schema_db(db, strlen(db)))
+ if (is_schema_db(db))
{
my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
DBUG_RETURN(-1);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 3c404a984bf..a2a1494141c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2852,7 +2852,7 @@ end_with_restore_list:
&first_table->grant.privilege, 0, 0,
test(first_table->schema_table)) ||
check_access(thd,INSERT_ACL | CREATE_ACL,select_lex->db,&priv,0,0,
- is_schema_db(select_lex->db, strlen(select_lex->db)))||
+ is_schema_db(select_lex->db))||
check_merge_table_access(thd, first_table->db,
(TABLE_LIST *)
create_info.merge_list.first))
@@ -3865,7 +3865,7 @@ end_with_restore_list:
first_table ? 0 : 1, 0,
first_table ? (bool) first_table->schema_table :
select_lex->db ?
- is_schema_db(select_lex->db, strlen(select_lex->db)) : 0))
+ is_schema_db(select_lex->db) : 0))
goto error;
if (thd->security_ctx->user) // If not replication
@@ -5304,7 +5304,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
if (check_access(thd, SELECT_ACL, dst_db_name,
&thd->col_access, FALSE, FALSE,
- is_schema_db(dst_db_name, strlen(dst_db_name))))
+ is_schema_db(dst_db_name)))
return TRUE;
if (!thd->col_access && check_grant_db(thd, dst_db_name))
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d4da29085b5..5ec40d4893c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -826,7 +826,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN(TRUE);
}
#endif
- if (is_schema_db(dbname, strlen(dbname)))
+ if (is_schema_db(dbname))
{
dbname= INFORMATION_SCHEMA_NAME.str;
create.default_table_charset= system_charset_info;