MySQL 9.1.0
Source Code Documentation
Bulk_data_convert::Row_header Class Reference

Public Types

enum  Flag { HAS_NULL_DATA = 1 , IS_FIXED_CHAR = 2 , FLAG_MAX = 16 }
 

Public Member Functions

 Row_header (const Row_meta &row_meta)
 Construct header. More...
 
bool serialize (char *buffer, size_t length)
 Serialize header into a buffer. More...
 
bool deserialize (const char *buffer, size_t length)
 De-Serialize header from a buffer. More...
 
void add_length (size_t add)
 Add length to row. More...
 
size_t get_row_length () const
 
void set (Flag flag)
 Set specific flag. More...
 
bool is_set (Flag flag) const
 Check if a specific flag is set. More...
 
void set_column_null (const Column_meta &col_meta)
 Set the column value as NULL in header. More...
 
bool is_column_null (const Column_meta &col_meta) const
 check if column value is NULL in header. More...
 
size_t header_length () const
 

Static Public Attributes

static const size_t MAX_NULLABLE_BYTES = 512
 Matches MAX_FIELDS in SQL. More...
 

Private Attributes

std::array< unsigned char, MAX_NULLABLE_BYTESm_null_bitmap
 NULL bitmap for the row. More...
 
size_t m_null_bitmap_length {}
 Actual length of bitmap in bytes. More...
 
uint16_t m_row_length {}
 Current row length. More...
 
uint16_t m_flags {}
 Row flags : 2 bytes, maximum 16 flags. More...
 

Member Enumeration Documentation

◆ Flag

Enumerator
HAS_NULL_DATA 

If there is one or more NULL data in current row.

IS_FIXED_CHAR 

Character data is fixed length.

FLAG_MAX 

Don't define flag beyond this maximum.

Constructor & Destructor Documentation

◆ Row_header()

Bulk_data_convert::Row_header::Row_header ( const Row_meta row_meta)
explicit

Construct header.

Parameters
[in]row_metarow metadata.

Member Function Documentation

◆ add_length()

void Bulk_data_convert::Row_header::add_length ( size_t  add)
inline

Add length to row.

Parameters
[in]addlength to add

◆ deserialize()

bool Bulk_data_convert::Row_header::deserialize ( const char *  buffer,
size_t  length 
)

De-Serialize header from a buffer.

Parameters
[in]bufferbuffer to write to
[in]lengthbuffer length
Returns
true iff successful.

◆ get_row_length()

size_t Bulk_data_convert::Row_header::get_row_length ( ) const
inline
Returns
current row length.

◆ header_length()

size_t Bulk_data_convert::Row_header::header_length ( ) const
inline
Returns
total header length.

◆ is_column_null()

bool Bulk_data_convert::Row_header::is_column_null ( const Column_meta col_meta) const

check if column value is NULL in header.

Parameters
[in]col_metacolumn metadata
Returns
true iff NULL

◆ is_set()

bool Bulk_data_convert::Row_header::is_set ( Flag  flag) const
inline

Check if a specific flag is set.

Parameters
[in]flagflag to check
Returns
true iff set.

◆ serialize()

bool Bulk_data_convert::Row_header::serialize ( char *  buffer,
size_t  length 
)

Serialize header into a buffer.

Parameters
[in,out]bufferbuffer to write to
[in]lengthbuffer length
Returns
true iff successful.

◆ set()

void Bulk_data_convert::Row_header::set ( Flag  flag)
inline

Set specific flag.

Parameters
[in]flagflag to set

◆ set_column_null()

void Bulk_data_convert::Row_header::set_column_null ( const Column_meta col_meta)

Set the column value as NULL in header.

Parameters
[in]col_metacolumn metadata

Member Data Documentation

◆ m_flags

uint16_t Bulk_data_convert::Row_header::m_flags {}
private

Row flags : 2 bytes, maximum 16 flags.

◆ m_null_bitmap

std::array<unsigned char, MAX_NULLABLE_BYTES> Bulk_data_convert::Row_header::m_null_bitmap
private

NULL bitmap for the row.

Needed only while sorting by key.

◆ m_null_bitmap_length

size_t Bulk_data_convert::Row_header::m_null_bitmap_length {}
private

Actual length of bitmap in bytes.

Must be less than or equal to MAX_NULLABLE_BYTES.

◆ m_row_length

uint16_t Bulk_data_convert::Row_header::m_row_length {}
private

Current row length.

◆ MAX_NULLABLE_BYTES

const size_t Bulk_data_convert::Row_header::MAX_NULLABLE_BYTES = 512
static

Matches MAX_FIELDS in SQL.

We need separate definition here as we have array of this size allocated from stack. If SQL increases the value in future we need to re-evaluate and possibly go for dynamic allocation. We don't want to use dynamic allocation unconditionally as it impacts performance.


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