My Project
|
00001 #ifndef SQL_TRUNCATE_INCLUDED 00002 #define SQL_TRUNCATE_INCLUDED 00003 /* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; version 2 of the License. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00017 00018 class THD; 00019 struct TABLE_LIST; 00020 00024 class Sql_cmd_truncate_table : public Sql_cmd 00025 { 00026 private: 00027 /* Set if a lock must be downgraded after truncate is done. */ 00028 MDL_ticket *m_ticket_downgrade; 00029 00030 public: 00034 Sql_cmd_truncate_table() 00035 {} 00036 00037 virtual ~Sql_cmd_truncate_table() 00038 {} 00039 00045 bool execute(THD *thd); 00046 00047 virtual enum_sql_command sql_command_code() const 00048 { 00049 return SQLCOM_TRUNCATE; 00050 } 00051 00052 protected: 00053 enum truncate_result{ 00054 TRUNCATE_OK=0, 00055 TRUNCATE_FAILED_BUT_BINLOG, 00056 TRUNCATE_FAILED_SKIP_BINLOG 00057 }; 00058 00060 bool lock_table(THD *, TABLE_LIST *, bool *); 00061 00063 enum truncate_result handler_truncate(THD *, TABLE_LIST *, bool); 00064 00070 bool truncate_table(THD *, TABLE_LIST *); 00071 }; 00072 00073 #endif