MySQL 9.1.0
Source Code Documentation
temptable::Table Class Reference

#include <table.h>

Classes

struct  Index_entry
 Index entry for storing index pointer as well as allocated memory size. More...
 

Public Member Functions

 Table (TABLE *mysql_table, Block *shared_block, bool all_columns_are_fixed_size, size_t tmp_table_size_limit)
 
 Table (const Table &)=delete
 
Tableoperator= (const Table &)=delete
 
 Table (Table &&other)=delete
 
Tableoperator= (Table &&rhs)=delete
 
 ~Table ()
 
const TABLE_SHAREmysql_table_share () const
 
size_t mysql_row_length () const
 
size_t number_of_indexes () const
 
size_t number_of_columns () const
 
const Columnscolumns () const
 
size_t number_of_rows () const
 
const Indexindex (size_t i) const
 
const Columncolumn (size_t i) const
 
const Storagerows () const
 
void row (const Storage::Iterator &pos, unsigned char *mysql_row) const
 
Result insert (const unsigned char *mysql_row)
 Insert a new row in the table. More...
 
Result update (const unsigned char *mysql_row_old, const unsigned char *mysql_row_new, Storage::Element *target_row)
 Update a row in the table. More...
 
Result remove (const unsigned char *mysql_row_must_be, const Storage::Iterator &victim_position)
 
void truncate ()
 
Result disable_indexes ()
 
Result enable_indexes ()
 

Private Member Functions

bool indexed () const
 Check if the table is indexed. More...
 
template<class T >
void append_new_index (const KEY &mysql_index)
 Create index for given key and append it to indexes table. More...
 
void indexes_create ()
 Create the indexes in m_index_entries from m_mysql_table->key_info[]. More...
 
void indexes_destroy ()
 Destroy the indexes in m_index_entries. More...
 
bool is_index_update_needed (const unsigned char *mysql_row_old, const unsigned char *mysql_row_new) const
 
Result indexes_insert (Storage::Element *row)
 
Result indexes_remove (Storage::Element *row)
 

Private Attributes

TableResourceMonitor m_resource_monitor
 
Allocator< uint8_t > m_allocator
 Allocator for all members that need dynamic memory allocation. More...
 
Storage m_rows
 Rows of the table. More...
 
bool m_all_columns_are_fixed_size
 
bool m_indexes_are_enabled
 
uint32_t m_mysql_row_length
 
std::vector< Index_entry, Allocator< Index_entry > > m_index_entries
 
std::vector< Cursor, Allocator< Cursor > > m_insert_undo
 
Columns m_columns
 
TABLE_SHAREm_mysql_table_share
 

Constructor & Destructor Documentation

◆ Table() [1/3]

temptable::Table::Table ( TABLE mysql_table,
Block shared_block,
bool  all_columns_are_fixed_size,
size_t  tmp_table_size_limit 
)

◆ Table() [2/3]

temptable::Table::Table ( const Table )
delete

◆ Table() [3/3]

temptable::Table::Table ( Table &&  other)
delete

◆ ~Table()

temptable::Table::~Table ( )

Member Function Documentation

◆ append_new_index()

template<class T >
void temptable::Table::append_new_index ( const KEY mysql_index)
inlineprivate

Create index for given key and append it to indexes table.

Create index for given key and appends it to indexes table.

◆ column()

const Column & temptable::Table::column ( size_t  i) const
inline

◆ columns()

const Columns & temptable::Table::columns ( ) const
inline

◆ disable_indexes()

Result temptable::Table::disable_indexes ( )
inline

◆ enable_indexes()

Result temptable::Table::enable_indexes ( )
inline

◆ index()

const Index & temptable::Table::index ( size_t  i) const
inline

◆ indexed()

bool temptable::Table::indexed ( ) const
inlineprivate

Check if the table is indexed.

Return values
trueif there are any indexes defined and not disabled.
falsetable is not indexed.

◆ indexes_create()

void temptable::Table::indexes_create ( )
private

Create the indexes in m_index_entries from m_mysql_table->key_info[].

◆ indexes_destroy()

void temptable::Table::indexes_destroy ( )
private

Destroy the indexes in m_index_entries.

◆ indexes_insert()

Result temptable::Table::indexes_insert ( Storage::Element row)
private

◆ indexes_remove()

Result temptable::Table::indexes_remove ( Storage::Element row)
private

◆ insert()

Result temptable::Table::insert ( const unsigned char *  mysql_row)

Insert a new row in the table.

If something else than Result::OK is returned, then the state of the table and its indexes is unchanged by the call of this method (ie the method takes care to clean up any half completed work in case of an error and restore the table to its state before this method was called).

Returns
result code
Parameters
[in]mysql_rowThe contents of the new row to be inserted.

◆ is_index_update_needed()

bool temptable::Table::is_index_update_needed ( const unsigned char *  mysql_row_old,
const unsigned char *  mysql_row_new 
) const
private

◆ mysql_row_length()

size_t temptable::Table::mysql_row_length ( ) const
inline

◆ mysql_table_share()

const TABLE_SHARE * temptable::Table::mysql_table_share ( ) const
inline

◆ number_of_columns()

size_t temptable::Table::number_of_columns ( ) const
inline

◆ number_of_indexes()

size_t temptable::Table::number_of_indexes ( ) const
inline

◆ number_of_rows()

size_t temptable::Table::number_of_rows ( ) const
inline

◆ operator=() [1/2]

Table & temptable::Table::operator= ( const Table )
delete

◆ operator=() [2/2]

Table & temptable::Table::operator= ( Table &&  rhs)
delete

◆ remove()

Result temptable::Table::remove ( const unsigned char *  mysql_row_must_be,
const Storage::Iterator victim_position 
)

◆ row()

void temptable::Table::row ( const Storage::Iterator pos,
unsigned char *  mysql_row 
) const
inline

◆ rows()

const Storage & temptable::Table::rows ( ) const
inline

◆ truncate()

void temptable::Table::truncate ( void  )
inline

◆ update()

Result temptable::Table::update ( const unsigned char *  mysql_row_old,
const unsigned char *  mysql_row_new,
Storage::Element target_row 
)

Update a row in the table.

The semantics of this are enforced by the handler API. If something else than Result::OK is returned, then the state of the table and its indexes is unchanged by the call of this method (ie the method takes care to clean up any half completed work in case of an error and restore the table to its state before this method was called).

Returns
result code
Parameters
[in]mysql_row_oldThe contents of the old row to be updated. The row pointed to by `target_row` must equal this.
[in]mysql_row_newThe contents of the new row.
[in,out]target_rowPosition in the list of rows to update. The row pointed to by this must equal `mysql_row_old`.

Member Data Documentation

◆ m_all_columns_are_fixed_size

bool temptable::Table::m_all_columns_are_fixed_size
private

◆ m_allocator

Allocator<uint8_t> temptable::Table::m_allocator
private

Allocator for all members that need dynamic memory allocation.

◆ m_columns

Columns temptable::Table::m_columns
private

◆ m_index_entries

std::vector<Index_entry, Allocator<Index_entry> > temptable::Table::m_index_entries
private

◆ m_indexes_are_enabled

bool temptable::Table::m_indexes_are_enabled
private

◆ m_insert_undo

std::vector<Cursor, Allocator<Cursor> > temptable::Table::m_insert_undo
private

◆ m_mysql_row_length

uint32_t temptable::Table::m_mysql_row_length
private

◆ m_mysql_table_share

TABLE_SHARE* temptable::Table::m_mysql_table_share
private

◆ m_resource_monitor

TableResourceMonitor temptable::Table::m_resource_monitor
private

◆ m_rows

Storage temptable::Table::m_rows
private

Rows of the table.


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