MySQL 8.4.2
Source Code Documentation
innobase_truncate< Table > Class Template Reference

Class to handle TRUNCATE for one InnoDB table or one partition. More...

#include <ha_innodb.h>

Public Member Functions

 innobase_truncate (THD *thd, const char *name, TABLE *form, Table *dd_table, bool keep_autoinc, bool table_truncate)
 Constructor. More...
 
 ~innobase_truncate ()
 Destructor. More...
 
int open_table (dict_table_t *&innodb_table)
 Open the table/partition to be truncated. More...
 
int exec ()
 Do the truncate of the table/partition. More...
 

Private Member Functions

int prepare ()
 Prepare for truncate. More...
 
int truncate ()
 Do the real truncation. More...
 
int rename_tablespace ()
 Rename tablespace file name. More...
 
void cleanup ()
 Cleanup. More...
 
int load_fk ()
 Reload the FK related information. More...
 

Private Attributes

THDm_thd
 THD object. More...
 
const char * m_name
 Normalized table name. More...
 
Table * m_dd_table
 dd::Table or dd::Partition More...
 
trx_tm_trx
 Transaction attached to current thd. More...
 
dict_table_tm_table
 InnoDB table object for the table/partition. More...
 
TABLEm_form
 Table format. More...
 
HA_CREATE_INFO m_create_info
 Create information. More...
 
bool m_file_per_table
 True if this table/partition is file per table. More...
 
bool m_keep_autoinc
 True if the original autoinc counter should be kept. More...
 
bool m_table_truncate
 For a prtition table, this is true if full table is truncated. More...
 
uint32_t m_flags
 flags of the table to be truncated, which should not change More...
 
uint32_t m_flags2
 flags2 of the table to be truncated, which should not change More...
 

Detailed Description

template<typename Table>
class innobase_truncate< Table >

Class to handle TRUNCATE for one InnoDB table or one partition.

Constructor & Destructor Documentation

◆ innobase_truncate()

template<typename Table >
innobase_truncate< Table >::innobase_truncate ( THD thd,
const char *  name,
TABLE form,
Table *  dd_table,
bool  keep_autoinc,
bool  table_truncate 
)
inline

Constructor.

Parameters
[in]thdTHD object
[in]namenormalized table name
[in]formTable format; columns and index information
[in]dd_tabledd::Table or dd::Partition
[in]keep_autoinctrue to remember original autoinc counter
[in]table_truncatetrue if this is full table truncate

◆ ~innobase_truncate()

template<typename Table >
template innobase_truncate< Table >::~innobase_truncate ( )

Destructor.

Member Function Documentation

◆ cleanup()

template<typename Table >
void innobase_truncate< Table >::cleanup ( void  )
private

Cleanup.

◆ exec()

template<typename Table >
template int innobase_truncate< Table >::exec ( )

Do the truncate of the table/partition.

Returns
error number or 0 on success

◆ load_fk()

template<typename Table >
int innobase_truncate< Table >::load_fk
private

Reload the FK related information.

Returns
error number or 0 on success

◆ open_table()

template<typename Table >
template int innobase_truncate< Table >::open_table ( dict_table_t *&  innodb_table)

Open the table/partition to be truncated.

Parameters
[out]innodb_tableInnoDB table object opened
Returns
error number or 0 on success

◆ prepare()

template<typename Table >
int innobase_truncate< Table >::prepare
private

Prepare for truncate.

Returns
error number or 0 on success

◆ rename_tablespace()

template<typename Table >
int innobase_truncate< Table >::rename_tablespace
private

Rename tablespace file name.

Returns
error number or 0 on success

◆ truncate()

template<typename Table >
int innobase_truncate< Table >::truncate
private

Do the real truncation.

Returns
error number or 0 on success

Member Data Documentation

◆ m_create_info

template<typename Table >
HA_CREATE_INFO innobase_truncate< Table >::m_create_info
private

Create information.

◆ m_dd_table

template<typename Table >
Table* innobase_truncate< Table >::m_dd_table
private

dd::Table or dd::Partition

◆ m_file_per_table

template<typename Table >
bool innobase_truncate< Table >::m_file_per_table
private

True if this table/partition is file per table.

◆ m_flags

template<typename Table >
uint32_t innobase_truncate< Table >::m_flags
private

flags of the table to be truncated, which should not change

◆ m_flags2

template<typename Table >
uint32_t innobase_truncate< Table >::m_flags2
private

flags2 of the table to be truncated, which should not change

◆ m_form

template<typename Table >
TABLE* innobase_truncate< Table >::m_form
private

Table format.

◆ m_keep_autoinc

template<typename Table >
bool innobase_truncate< Table >::m_keep_autoinc
private

True if the original autoinc counter should be kept.

It's specified by caller, however if the table has no AUTOINC column, it would be reset to false internally

◆ m_name

template<typename Table >
const char* innobase_truncate< Table >::m_name
private

Normalized table name.

◆ m_table

template<typename Table >
dict_table_t* innobase_truncate< Table >::m_table
private

InnoDB table object for the table/partition.

◆ m_table_truncate

template<typename Table >
bool innobase_truncate< Table >::m_table_truncate
private

For a prtition table, this is true if full table is truncated.

If only a partition is truncated, it is set to false.

◆ m_thd

template<typename Table >
THD* innobase_truncate< Table >::m_thd
private

THD object.

◆ m_trx

template<typename Table >
trx_t* innobase_truncate< Table >::m_trx
private

Transaction attached to current thd.


The documentation for this class was generated from the following files: