diff options
| author | kevg <claprix@yandex.ru> | 2016-12-23 17:05:57 +0300 | 
|---|---|---|
| committer | Aleksey Midenkov <midenok@gmail.com> | 2017-05-05 20:36:24 +0300 | 
| commit | c9e4ac4b7221ab58097ce16e91eb1b885f2a3485 (patch) | |
| tree | 383f3101b7dd19810ccfca6a4ba1227adebfbd3d /sql/sql_truncate.cc | |
| parent | 4c37011582b4581bb122293ba30a6956b573483c (diff) | |
| download | mariadb-git-c9e4ac4b7221ab58097ce16e91eb1b885f2a3485.tar.gz | |
0.6: truncate history feature [closes #96]
Diffstat (limited to 'sql/sql_truncate.cc')
| -rw-r--r-- | sql/sql_truncate.cc | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index daa295d768e..4faad5b4711 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -26,7 +26,8 @@  #include "sql_truncate.h"  #include "wsrep_mysqld.h"  #include "sql_show.h"    //append_identifier() - +#include "sql_select.h" +#include "sql_delete.h"  /**    Append a list of field names to a string. @@ -480,7 +481,6 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)    DBUG_RETURN(error);  } -  /**    Execute a TRUNCATE statement at runtime. @@ -495,6 +495,11 @@ bool Sql_cmd_truncate_table::execute(THD *thd)    TABLE_LIST *first_table= thd->lex->select_lex.table_list.first;    DBUG_ENTER("Sql_cmd_truncate_table::execute"); +  bool truncate_history= thd->lex->current_select->vers_conditions.type != +                         FOR_SYSTEM_TIME_UNSPECIFIED; +  if (truncate_history) +    DBUG_RETURN(mysql_delete(thd, first_table, NULL, NULL, -1, 0, NULL)); +    if (check_one_table_access(thd, DROP_ACL, first_table))      DBUG_RETURN(res); | 
