MySQL 9.0.0
Source Code Documentation
temptable::Cell_calculator Class Reference

Utility to perform calculations for a cell. More...

#include <cell_calculator.h>

Public Member Functions

 Cell_calculator ()=default
 Default constructor used for std::array initialization in Index. More...
 
 Cell_calculator (const KEY_PART_INFO &mysql_key_part)
 Constructor to be used when creating calculators for indexed columns. More...
 
 Cell_calculator (const Field *mysql_field)
 Constructor to be used when creating calculators for columns when comparing table rows. More...
 
size_t hash (const Cell &cell) const
 Calculate hash value for a cell. More...
 
int compare (const Cell &lhs, const Cell &rhs) const
 Compare two cells. More...
 

Private Types

enum class  Mode : uint8_t { BINARY , CHARSET , CHARSET_AND_CHAR_LENGTH }
 

Static Private Member Functions

static const CHARSET_INFOfield_charset (const Field &field)
 
static size_t zero_hash ()
 Convenience function to get the hash value of 0.0. More...
 

Private Attributes

const Fieldm_mysql_field
 Field for which this calculator was created. More...
 
const CHARSET_INFOm_cs
 Charset used by calculator. More...
 
Mode m_mode
 Calculation mode. More...
 
bool m_is_floating_point
 True if the key is of type double or float. More...
 
bool m_is_space_padded
 True if the cell is right-padded with spaces (CHAR column). More...
 
uint32_t m_char_length
 Length in number of characters. More...
 

Static Private Attributes

static const size_t s_zero_hash = Cell_calculator::zero_hash()
 This value is to be used for hashing 0 value for approximate types such as float or double. More...
 

Detailed Description

Utility to perform calculations for a cell.

It uses cell's contents and a stored context that describes how to interpret the data.

Member Enumeration Documentation

◆ Mode

enum class temptable::Cell_calculator::Mode : uint8_t
strongprivate
Enumerator
BINARY 
CHARSET 
CHARSET_AND_CHAR_LENGTH 

Constructor & Destructor Documentation

◆ Cell_calculator() [1/3]

temptable::Cell_calculator::Cell_calculator ( )
default

Default constructor used for std::array initialization in Index.

◆ Cell_calculator() [2/3]

temptable::Cell_calculator::Cell_calculator ( const KEY_PART_INFO mysql_key_part)
inlineexplicit

Constructor to be used when creating calculators for indexed columns.

Parameters
[in]mysql_key_partKey part (indexed column) for which calculator is created.

◆ Cell_calculator() [3/3]

temptable::Cell_calculator::Cell_calculator ( const Field mysql_field)
inlineexplicit

Constructor to be used when creating calculators for columns when comparing table rows.

Parameters
[in]mysql_fieldField (column) for which calculator is created.

Member Function Documentation

◆ compare()

int temptable::Cell_calculator::compare ( const Cell lhs,
const Cell rhs 
) const
inline

Compare two cells.

Return values
<0if lhs < rhs
0if lhs == rhs
>0if lhs > rhs
Parameters
[in]lhsFirst cell to compare.
[in]rhsSecond cell to compare.

◆ field_charset()

const CHARSET_INFO * temptable::Cell_calculator::field_charset ( const Field field)
inlinestaticprivate

◆ hash()

size_t temptable::Cell_calculator::hash ( const Cell cell) const
inline

Calculate hash value for a cell.

Returns
a hash number
Parameters
[in]cellCell for which hash is to be calculated.

◆ zero_hash()

size_t temptable::Cell_calculator::zero_hash ( )
inlinestaticprivate

Convenience function to get the hash value of 0.0.

Member Data Documentation

◆ m_char_length

uint32_t temptable::Cell_calculator::m_char_length
private

Length in number of characters.

Only used in CHARSET_AND_CHAR_LENGTH mode.

◆ m_cs

const CHARSET_INFO* temptable::Cell_calculator::m_cs
private

Charset used by calculator.

NULL for binary mode.

◆ m_is_floating_point

bool temptable::Cell_calculator::m_is_floating_point
private

True if the key is of type double or float.

◆ m_is_space_padded

bool temptable::Cell_calculator::m_is_space_padded
private

True if the cell is right-padded with spaces (CHAR column).

◆ m_mode

Mode temptable::Cell_calculator::m_mode
private

Calculation mode.

◆ m_mysql_field

const Field* temptable::Cell_calculator::m_mysql_field
private

Field for which this calculator was created.

◆ s_zero_hash

const size_t temptable::Cell_calculator::s_zero_hash = Cell_calculator::zero_hash()
staticprivate

This value is to be used for hashing 0 value for approximate types such as float or double.

Specifically, for such types we don't want to have separate hash entries for 0.0 and -0.0.


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