MySQL 9.1.0
Source Code Documentation
|
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_INFO * | field_charset (const Field &field) |
static size_t | zero_hash () |
Convenience function to get the hash value of 0.0. More... | |
Private Attributes | |
const Field * | m_mysql_field |
Field for which this calculator was created. More... | |
const CHARSET_INFO * | m_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... | |
Utility to perform calculations for a cell.
It uses cell's contents and a stored context that describes how to interpret the data.
|
strongprivate |
|
default |
Default constructor used for std::array initialization in Index.
|
inlineexplicit |
Constructor to be used when creating calculators for indexed columns.
[in] | mysql_key_part | Key part (indexed column) for which calculator is created. |
|
inlineexplicit |
Constructor to be used when creating calculators for columns when comparing table rows.
[in] | mysql_field | Field (column) for which calculator is created. |
Compare two cells.
<0 | if lhs < rhs |
0 | if lhs == rhs |
>0 | if lhs > rhs |
[in] | lhs | First cell to compare. |
[in] | rhs | Second cell to compare. |
|
inlinestaticprivate |
|
inline |
Calculate hash value for a cell.
[in] | cell | Cell for which hash is to be calculated. |
|
inlinestaticprivate |
Convenience function to get the hash value of 0.0.
|
private |
Length in number of characters.
Only used in CHARSET_AND_CHAR_LENGTH mode.
|
private |
Charset used by calculator.
NULL for binary mode.
|
private |
True if the key is of type double or float.
|
private |
True if the cell is right-padded with spaces (CHAR column).
|
private |
Calculation mode.
|
private |
Field for which this calculator was created.
|
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.