MySQL 9.0.0
Source Code Documentation
|
#include "sql/sql_truncate.h"
#include <stddef.h>
#include <sys/types.h>
#include "lex_string.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_sys.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld.h"
#include "mysqld_error.h"
#include "scope_guard.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/dd/cache/dictionary_client.h"
#include "sql/dd/dd_schema.h"
#include "sql/dd/dd_table.h"
#include "sql/dd/properties.h"
#include "sql/dd/types/abstract_table.h"
#include "sql/dd/types/table.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/lock.h"
#include "sql/mdl.h"
#include "sql/query_options.h"
#include "sql/sql_audit.h"
#include "sql/sql_backup_lock.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_show.h"
#include "sql/sql_table.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/transaction.h"
#include "sql/transaction_info.h"
#include "sql_string.h"
#include "thr_lock.h"
Namespaces | |
namespace | dd |
The version of the current data dictionary table definitions. | |
Enumerations | |
enum class | Truncate_result { OK = 0 , FAILED_BUT_BINLOG , FAILED_SKIP_BINLOG , FAILED_OPEN } |
Functions | |
static const char * | fk_info_str (const THD *thd, const dd::Foreign_key_parent *fk_p) |
Generate a foreign key description suitable for a error message. More... | |
static bool | fk_truncate_illegal_if_parent (THD *thd, Table_ref *table_list, dd::Table *table_def) |
Check and emit a fatal error if the table which is going to be affected by TRUNCATE TABLE is a parent table in some non-self- referencing foreign key. More... | |
static Truncate_result | handler_truncate_base (THD *thd, Table_ref *table_ref, dd::Table *table_def) |
Open and truncate a locked base table. More... | |
static Truncate_result | handler_truncate_temporary (THD *thd, Table_ref *table_ref) |
Open and truncate a locked temporary table. More... | |
|
strong |
|
static |
Generate a foreign key description suitable for a error message.
thd | Thread context. |
fk_p | Object describing foreign key in parent table. |
|
static |
Check and emit a fatal error if the table which is going to be affected by TRUNCATE TABLE is a parent table in some non-self- referencing foreign key.
thd | Thread context. |
table_list | Table list element for the table. |
table_def | dd::Table describing the table. |
false | This table is not parent in a non-self-referencing foreign key. Statement can proceed. |
true | This table is parent in a non-self-referencing foreign key, error was emitted. |
|
static |
Open and truncate a locked base table.
thd | Thread context. |
table_ref | Table list element for the table to be truncated. |
table_def | Dictionary table object. |
Truncate_result::OK | Truncate was successful and statement can be safely binlogged. |
Truncate_result::FAILED_BUT_BINLOG | Truncate failed but still go ahead with binlogging as in case of non transactional tables partial truncation is possible. |
Truncate_result::FAILED_SKIP_BINLOG | Truncate was not successful hence do not binlog the statement. |
Truncate_result::FAILED_OPEN | Truncate failed to open table, do not binlog the statement. |
|
static |
Open and truncate a locked temporary table.
thd | Thread context. |
table_ref | Table list element for the table to be truncated. |
Truncate_result::OK | Truncate was successful and statement can be safely binlogged. |
Truncate_result::FAILED_BUT_BINLOG | Truncate failed but still go ahead with binlogging as in case of non transactional tables partial truncation is possible. |
Truncate_result::FAILED_SKIP_BINLOG | Truncate was not successful hence do not binlog the statement. |
Truncate_result::FAILED_OPEN | Truncate failed to open table, do not binlog the statement. |