diff options
author | unknown <tsmith@maint1.mysql.com> | 2006-07-28 17:40:33 +0200 |
---|---|---|
committer | unknown <tsmith@maint1.mysql.com> | 2006-07-28 17:40:33 +0200 |
commit | b0b5fc60dc2bff9f3dd38cce234f4bc485113be6 (patch) | |
tree | 228497008190be26ce291b277a912c2ebf2ce5f5 /sql | |
parent | 05373cfe26538af7334b8a6719975c6c786cb4ef (diff) | |
parent | 155de81979811175ea84af79794dd2392d44d3b0 (diff) | |
download | mariadb-git-b0b5fc60dc2bff9f3dd38cce234f4bc485113be6.tar.gz |
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into maint1.mysql.com:/data/localhome/tsmith/bk/global-50
Diffstat (limited to 'sql')
-rw-r--r-- | sql/slave.cc | 8 | ||||
-rw-r--r-- | sql/sp.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 13 | ||||
-rw-r--r-- | sql/sql_parse.cc | 8 |
5 files changed, 23 insertions, 8 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index b284f4a6a16..90e95e812bd 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3717,15 +3717,12 @@ err: write_ignored_events_info_to_relay_log(thd, mi); thd->proc_info = "Waiting for slave mutex on exit"; pthread_mutex_lock(&mi->run_lock); - mi->slave_running = 0; - mi->io_thd = 0; /* Forget the relay log's format */ delete mi->rli.relay_log.description_event_for_queue; mi->rli.relay_log.description_event_for_queue= 0; // TODO: make rpl_status part of MASTER_INFO change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE); - mi->abort_slave = 0; // TODO: check if this is needed DBUG_ASSERT(thd->net.buff != 0); net_end(&thd->net); // destructor will not free it, because net.vio is 0 close_thread_tables(thd, 0); @@ -3733,8 +3730,11 @@ err: THD_CHECK_SENTRY(thd); delete thd; pthread_mutex_unlock(&LOCK_thread_count); - pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done + mi->abort_slave= 0; + mi->slave_running= 0; + mi->io_thd= 0; pthread_mutex_unlock(&mi->run_lock); + pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done #ifndef DBUG_OFF if (abort_slave_event_count && !events_till_abort) goto slave_begin; diff --git a/sql/sp.cc b/sql/sp.cc index 553465ebff8..a7078da2f50 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1846,7 +1846,6 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db, bool no_access_check, bool *dbchangedp) { int ret; - static char empty_c_string[1]= {0}; /* used for not defined db */ DBUG_ENTER("sp_use_new_db"); DBUG_PRINT("enter", ("newdb: %s", new_db.str)); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 87a515641de..4cb9cfc53c6 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -43,6 +43,7 @@ table name */ char internal_table_name[2]= "*"; +char empty_c_string[1]= {0}; /* used for not defined db */ const char * const THD::DEFAULT_WHERE= "field list"; diff --git a/sql/sql_class.h b/sql/sql_class.h index 5ed5e68adb9..5134efcfb32 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -41,6 +41,7 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN, CHECK_FIELD_ERROR_FOR_NULL }; extern char internal_table_name[2]; +extern char empty_c_string[1]; extern const char **errmesg; #define TC_LOG_PAGE_SIZE 8192 @@ -1983,11 +1984,21 @@ public: { db.str=0; } + /* + This constructor is used only for the case when we create a derived + table. A derived table has no name and doesn't belong to any database. + Later, if there was an alias specified for the table, it will be set + by add_table_to_list. + */ inline Table_ident(SELECT_LEX_UNIT *s) : sel(s) { /* We must have a table name here as this is used with add_table_to_list */ - db.str=0; table.str= internal_table_name; table.length=1; + db.str= empty_c_string; /* a subject to casedn_str */ + db.length= 0; + table.str= internal_table_name; + table.length=1; } + bool is_derived_table() const { return test(sel); } inline void change_db(char *db_name) { db.str= db_name; db.length= (uint) strlen(db_name); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e37bc7cc3f7..28ed3e25d57 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6118,8 +6118,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, if (!table) DBUG_RETURN(0); // End of memory alias_str= alias ? alias->str : table->table.str; - if (check_table_name(table->table.str,table->table.length) || - table->db.str && check_db_name(table->db.str)) + if (check_table_name(table->table.str, table->table.length)) { my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); DBUG_RETURN(0); @@ -6140,6 +6139,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, DBUG_RETURN(0); /* purecov: inspected */ if (table->db.str) { + if (table->is_derived_table() == FALSE && check_db_name(table->db.str)) + { + my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str); + DBUG_RETURN(0); + } ptr->db= table->db.str; ptr->db_length= table->db.length; } |