MySQL 8.0.39
Source Code Documentation
temptable::Column Class Reference

A column class that describes the metadata of a column. More...

#include <column.h>

Public Member Functions

 Column (const unsigned char *mysql_row, const TABLE &mysql_table TEMPTABLE_UNUSED_NODBUG, const Field &mysql_field)
 Constructor. More...
 
bool read_is_null (const unsigned char *mysql_row) const
 Check if a particular cell is NULL. More...
 
void write_is_null (bool is_null, unsigned char *mysql_row, size_t mysql_row_length) const
 Write the information that cell is NULL or not. More...
 
uint32_t read_user_data_length (const unsigned char *mysql_row) const
 In MySQL write_row() format - the length of the actual user data of a cell in a given row. More...
 
void write_user_data_length (uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length) const
 Write the length of user data stored in a cell. More...
 
const unsigned char * get_user_data_ptr (const unsigned char *mysql_row) const
 Return pointer to user data in MySQL row. More...
 
void read_user_data (unsigned char *data, uint32_t data_length, const unsigned char *mysql_row, size_t mysql_row_length) const
 Reads user data stored in a cell. More...
 
void write_user_data (bool is_null, const unsigned char *data, uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length) const
 Write user data stored in a cell. More...
 

Private Member Functions

bool is_nullable () const
 Check if the cells in this column can be NULL. More...
 
bool is_blob () const
 Check this column stores blobs. More...
 
bool is_fixed_size () const
 Check if different cells that belong to this column can have different size (eg VARCHAR). More...
 
void read_std_user_data (unsigned char *data, uint32_t data_length, const unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
 Reads user data stored in a cell. More...
 
void write_std_user_data (const unsigned char *data, uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
 Write user data stored in a cell. More...
 
void read_blob_user_data (unsigned char *data, uint32_t data_length, const unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
 Reads user data stored in a cell for columns stored as BLOBs. More...
 
void write_blob_user_data (const unsigned char *data, uint32_t data_length, unsigned char *mysql_row, size_t mysql_row_length TEMPTABLE_UNUSED_NODBUG) const
 Write user data stored in a cell for columns stored as BLOBs. More...
 
const unsigned char * calculate_user_data_ptr (const unsigned char *mysql_row) const
 Calculate pointer to user data in a MySQL row. More...
 
const unsigned char * read_blob_data_ptr (const unsigned char *mysql_row) const
 Reads pointer to user data for a column stored as BLOB. More...
 

Private Attributes

bool m_nullable
 True if can be NULL. More...
 
bool m_is_blob
 True if it is a blob. More...
 
uint8_t m_null_bitmask
 Bitmask to extract is is-NULL bit from the is-NULL byte. More...
 
uint8_t m_length_bytes_size
 The number of bytes that indicate the length of the user data in the cell, for variable sized cells. More...
 
union {
   uint32_t   m_length
 Length of the user data of a cell. More...
 
   uint32_t   m_offset
 Offset of the bytes that indicate the user data length of a cell. More...
 
}; 
 
uint32_t m_null_byte_offset
 The offset of the is-NULL byte from the start of the mysql row. More...
 
uint32_t m_user_data_offset
 The offset of the user data from the start of the mysql row in bytes. More...
 

Detailed Description

A column class that describes the metadata of a column.

Constructor & Destructor Documentation

◆ Column()

temptable::Column::Column ( const unsigned char *  mysql_row,
const TABLE &mysql_table  TEMPTABLE_UNUSED_NODBUG,
const Field mysql_field 
)

Constructor.

Parameters
[in]mysql_rowA pointer to the row (user data).
[in]TEMPTABLE_UNUSED_NODBUGMySQL table that contains the column.
[in]mysql_fieldMySQL field (column/cell) that describes the columns.

Member Function Documentation

◆ calculate_user_data_ptr()

const unsigned char * temptable::Column::calculate_user_data_ptr ( const unsigned char *  mysql_row) const
inlineprivate

Calculate pointer to user data in a MySQL row.

Cannot be used for columns stored as BLOBs.

Returns
Pointer to user data stored in a cell.
Parameters
[in]mysql_rowMySQL row buffer that stores the user data.

◆ get_user_data_ptr()

const unsigned char * temptable::Column::get_user_data_ptr ( const unsigned char *  mysql_row) const
inline

Return pointer to user data in MySQL row.

Returns
Pointer to user data.

◆ is_blob()

bool temptable::Column::is_blob ( ) const
inlineprivate

Check this column stores blobs.

Returns
true if it is a blob column.

◆ is_fixed_size()

bool temptable::Column::is_fixed_size ( ) const
inlineprivate

Check if different cells that belong to this column can have different size (eg VARCHAR).

Returns
true if all cells are the same size

◆ is_nullable()

bool temptable::Column::is_nullable ( ) const
inlineprivate

Check if the cells in this column can be NULL.

Returns
true if cells are allowed to be NULL.

◆ read_blob_data_ptr()

const unsigned char * temptable::Column::read_blob_data_ptr ( const unsigned char *  mysql_row) const
inlineprivate

Reads pointer to user data for a column stored as BLOB.

Returns
Pointer to user data stored in a BLOB field.
Parameters
[in]mysql_rowMySQL row buffer that stores BLOB data pointer.

◆ read_blob_user_data()

void temptable::Column::read_blob_user_data ( unsigned char *  data,
uint32_t  data_length,
const unsigned char *  mysql_row,
size_t mysql_row_length  TEMPTABLE_UNUSED_NODBUG 
) const
inlineprivate

Reads user data stored in a cell for columns stored as BLOBs.

Performs a deep copy of the data.

Parameters
[out]dataPointer to store user data.
[out]data_lengthLength of the data to read.
[in]mysql_rowMySQL row buffer to read data from.
[in]TEMPTABLE_UNUSED_NODBUGLength of the row buffer.

◆ read_is_null()

bool temptable::Column::read_is_null ( const unsigned char *  mysql_row) const
inline

Check if a particular cell is NULL.

The cell is the intersection of this column with the provided row (in MySQL write_row() format).

Returns
true if the cell is NULL
Parameters
[in]mysql_rowMySQL row that contains the cell to be checked.

◆ read_std_user_data()

void temptable::Column::read_std_user_data ( unsigned char *  data,
uint32_t  data_length,
const unsigned char *  mysql_row,
size_t mysql_row_length  TEMPTABLE_UNUSED_NODBUG 
) const
inlineprivate

Reads user data stored in a cell.

Cannot be used for columns stored as BLOBs. Performs a deep copy of the data.

Parameters
[out]dataPointer to store user data.
[out]data_lengthLength of the data to read.
[in]mysql_rowMySQL row buffer to read data from.
[in]TEMPTABLE_UNUSED_NODBUGLength of the row buffer.

◆ read_user_data()

void temptable::Column::read_user_data ( unsigned char *  data,
uint32_t  data_length,
const unsigned char *  mysql_row,
size_t  mysql_row_length 
) const
inline

Reads user data stored in a cell.

Cannot be used for columns stored as BLOBs. Performs a deep copy of the data.

Parameters
[out]dataPointer to store user data.
[out]data_lengthLength of the data to read.
[in]mysql_rowMySQL row buffer to read data from.
[in]mysql_row_lengthLength of the row buffer.

◆ read_user_data_length()

uint32_t temptable::Column::read_user_data_length ( const unsigned char *  mysql_row) const
inline

In MySQL write_row() format - the length of the actual user data of a cell in a given row.

Returns
user data length of the cell that corresponds to this column in the given row
Parameters
[in]mysql_rowMySQL row buffer to read data from.

◆ write_blob_user_data()

void temptable::Column::write_blob_user_data ( const unsigned char *  data,
uint32_t data_length  TEMPTABLE_UNUSED,
unsigned char *  mysql_row,
size_t mysql_row_length  TEMPTABLE_UNUSED_NODBUG 
) const
inlineprivate

Write user data stored in a cell for columns stored as BLOBs.

NOTE: Currently only pointer is stored, no data is copied and the length is ignored.

Parameters
[in]dataPointer to user data. Can be NULL for cells with NULL value.
[in]TEMPTABLE_UNUSEDLength of user data.
[out]mysql_rowMySQL row buffer to write data into.
[in]TEMPTABLE_UNUSED_NODBUGLength of the row buffer.

◆ write_is_null()

void temptable::Column::write_is_null ( bool  is_null,
unsigned char *  mysql_row,
size_t mysql_row_length  TEMPTABLE_UNUSED_NODBUG 
) const
inline

Write the information that cell is NULL or not.

Parameters
[in]is_nullTrue if cell is NULL, false if it has value.
[out]mysql_rowMySQL row buffer to write data into.
[in]TEMPTABLE_UNUSED_NODBUGLength of the row buffer.

◆ write_std_user_data()

void temptable::Column::write_std_user_data ( const unsigned char *  data,
uint32_t  data_length,
unsigned char *  mysql_row,
size_t mysql_row_length  TEMPTABLE_UNUSED_NODBUG 
) const
inlineprivate

Write user data stored in a cell.

Cannot be used for columns stored as blobs.

Parameters
[in]dataPointer to used data.
[in]data_lengthLength of user data.
[out]mysql_rowMySQL row buffer to write data into.
[in]TEMPTABLE_UNUSED_NODBUGLength of the row buffer.

◆ write_user_data()

void temptable::Column::write_user_data ( bool  is_null,
const unsigned char *  data,
uint32_t  data_length,
unsigned char *  mysql_row,
size_t  mysql_row_length 
) const
inline

Write user data stored in a cell.

Cannot be used for columns stored as blobs.

Parameters
[in]is_nullTrue if cell is NULL, false if it has value.
[in]dataPointer to used data.
[in]data_lengthLength of user data.
[out]mysql_rowMySQL row buffer to write data into.
[in]mysql_row_lengthLength of the row buffer.

◆ write_user_data_length()

void temptable::Column::write_user_data_length ( uint32_t  data_length,
unsigned char *  mysql_row,
size_t mysql_row_length  TEMPTABLE_UNUSED_NODBUG 
) const
inline

Write the length of user data stored in a cell.

Parameters
[in]data_lengthUser data length.
[out]mysql_rowMySQL row buffer to write data into.
[in]TEMPTABLE_UNUSED_NODBUGLength of the row buffer.

Member Data Documentation

◆ 

union { ... } temptable::Column::@200

◆ m_is_blob

bool temptable::Column::m_is_blob
private

True if it is a blob.

◆ m_length

uint32_t temptable::Column::m_length

Length of the user data of a cell.

It is for fixed size cells (when m_length_bytes_size == 0).

◆ m_length_bytes_size

uint8_t temptable::Column::m_length_bytes_size
private

The number of bytes that indicate the length of the user data in the cell, for variable sized cells.

If this is 0, then the cell is fixed size.

◆ m_null_bitmask

uint8_t temptable::Column::m_null_bitmask
private

Bitmask to extract is is-NULL bit from the is-NULL byte.

◆ m_null_byte_offset

uint32_t temptable::Column::m_null_byte_offset
private

The offset of the is-NULL byte from the start of the mysql row.

If m_null_bitmask is set in this byte and m_nullable is true, then that particular cell is NULL.

◆ m_nullable

bool temptable::Column::m_nullable
private

True if can be NULL.

◆ m_offset

uint32_t temptable::Column::m_offset

Offset of the bytes that indicate the user data length of a cell.

It is used for variable size cells (when m_length_bytes_size > 0).

◆ m_user_data_offset

uint32_t temptable::Column::m_user_data_offset
private

The offset of the user data from the start of the mysql row in bytes.


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