diff options
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index 5ae777fe817..2e5e87fd232 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef SQL_CLASS_INCLUDED #define SQL_CLASS_INCLUDED @@ -1661,6 +1661,7 @@ public: Protects THD data accessed from other threads: - thd->query and thd->query_length (used by SHOW ENGINE INNODB STATUS and SHOW PROCESSLIST + - thd->db and thd->db_length (used in SHOW PROCESSLIST) - thd->mysys_var (used by KILL statement and shutdown). Is locked when THD is deleted. */ @@ -3051,6 +3052,7 @@ public: bool set_db(const char *new_db, size_t new_db_len) { bool result; + mysql_mutex_lock(&LOCK_thd_data); /* Do not reallocate memory if current chunk is big enough. */ if (db && new_db && db_length >= new_db_len) memcpy(db, new_db, new_db_len+1); @@ -3064,6 +3066,7 @@ public: } db_length= db ? new_db_len : 0; result= new_db && !db; + mysql_mutex_unlock(&LOCK_thd_data); #ifdef HAVE_PSI_THREAD_INTERFACE if (result) PSI_CALL(set_thread_db)(new_db, new_db_len); @@ -3084,11 +3087,16 @@ public: */ void reset_db(char *new_db, size_t new_db_len) { - db= new_db; - db_length= new_db_len; + if (new_db != db || new_db_len != db_length) + { + mysql_mutex_lock(&LOCK_thd_data); + db= new_db; + db_length= new_db_len; + mysql_mutex_unlock(&LOCK_thd_data); #ifdef HAVE_PSI_THREAD_INTERFACE - PSI_CALL(set_thread_db)(new_db, new_db_len); + PSI_CALL(set_thread_db)(new_db, new_db_len); #endif + } } /* Copy the current database to the argument. Use the current arena to @@ -4477,6 +4485,11 @@ inline bool add_order_to_list(THD *thd, Item *item, bool asc) return thd->lex->current_select->add_order_to_list(thd, item, asc); } +inline bool add_gorder_to_list(THD *thd, Item *item, bool asc) +{ + return thd->lex->current_select->add_gorder_to_list(thd, item, asc); +} + inline bool add_group_to_list(THD *thd, Item *item, bool asc) { return thd->lex->current_select->add_group_to_list(thd, item, asc); |