From 25ae81f133a1063a7234eb7515f50d9b2e82d1a5 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Mon, 16 Aug 2010 14:53:30 +0200 Subject: Bug#49907: ALTER TABLE ... TRUNCATE PARTITION does not wait for locks on the table Fixing the partitioning specifics after TRUNCATE TABLE in bug-42643 was fixed. Reorganize of code to decrease the size of the giant switch in mysql_execute_command, and to prepare for future parser reengineering. Moved code into Sql_statement objects. Updated patch according to davi's review comments. --- sql/sql_truncate.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sql/sql_truncate.h') diff --git a/sql/sql_truncate.h b/sql/sql_truncate.h index 11c07c7187c..b8b1d3da53d 100644 --- a/sql/sql_truncate.h +++ b/sql/sql_truncate.h @@ -20,4 +20,30 @@ struct TABLE_LIST; bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref); +/** + Truncate_statement represents the TRUNCATE statement. +*/ +class Truncate_statement : public Sql_statement +{ +public: + /** + Constructor, used to represent a ALTER TABLE statement. + @param lex the LEX structure for this statement. + */ + Truncate_statement(LEX *lex) + : Sql_statement(lex) + {} + + ~Truncate_statement() + {} + + /** + Execute a TRUNCATE statement at runtime. + @param thd the current thread. + @return false on success. + */ + bool execute(THD *thd); +}; + + #endif -- cgit v1.2.1