Indexed cells represent one or more cells that are covered by an index.
More...
#include <indexed_cells.h>
|
static Cell | cell_from_row (size_t i, const Index &index, const Row &row) |
| Generate a cell from a temptable::Row object with a possibly reduced length, if a prefix index is used. More...
|
|
Indexed cells represent one or more cells that are covered by an index.
◆ Data_location
Enum that designates where the actual user data is stored.
Enumerator |
---|
MYSQL_BUF_INDEX_READ | The data is in a MySQL buffer in index_read() input format (MySQL search cells).
|
MYSQL_BUF_WRITE_ROW | The data is in a MySQL buffer in write_row() format (MySQL row).
|
ROW | The data is in temptable::Row .
|
◆ Indexed_cells() [1/3]
temptable::Indexed_cells::Indexed_cells |
( |
const unsigned char * |
mysql_search_cells, |
|
|
uint16_t |
mysql_search_cells_length, |
|
|
const Index & |
index |
|
) |
| |
Construct from a MySQL indexed cells (eg index_read() input buffer).
- Parameters
-
[in] | mysql_search_cells | Search cells in "index_read() input" format. These must remain valid during the lifetime of the created `Indexed_cells` object. |
[in] | mysql_search_cells_length | The length of `mysql_search_cells` in bytes. |
[in] | index | MySQL index, used for querying metadata. |
◆ Indexed_cells() [2/3]
temptable::Indexed_cells::Indexed_cells |
( |
const unsigned char * |
mysql_row, |
|
|
const Index & |
index |
|
) |
| |
Construct from a mysql row.
The row must remain valid during the lifetime of the created Indexed_cells
object.
- Parameters
-
[in] | mysql_row | MySQL row. |
[in] | index | MySQL index whose cells this `Indexed_cells` represents. |
◆ Indexed_cells() [3/3]
temptable::Indexed_cells::Indexed_cells |
( |
const Row & |
row, |
|
|
const Index & |
index |
|
) |
| |
Construct from a row in a table.
The row must remain valid during the lifetime of the created Indexed_cells
object.
- Parameters
-
[in] | row | Row from which to create the indexed cells. |
[in] | index | MySQL index, used for querying metadata. |
◆ cell()
Cell temptable::Indexed_cells::cell |
( |
size_t |
i, |
|
|
const Index & |
index |
|
) |
| const |
Get a given indexed cell.
- Returns
- cell
- Parameters
-
[in] | i | Index of the cell within the indexed cells, must be in [0, number_of_cells()). |
[in] | index | Index to which the current objects belongs, used for querying metadata. |
◆ cell_from_mysql_buf_index_read()
Cell temptable::Indexed_cells::cell_from_mysql_buf_index_read |
( |
size_t |
i, |
|
|
const Index & |
index |
|
) |
| const |
|
private |
Derive the Nth cell if m_data_location == Data_location::MYSQL_BUF_INDEX_READ
.
- Returns
- Nth cell
- Parameters
-
[in] | i | Index of the cell within the indexed cells, must be in [0, number_of_cells()). |
[in] | index | Index, for querying metadata via the MySQL index. |
◆ cell_from_row()
Cell temptable::Indexed_cells::cell_from_row |
( |
size_t |
i, |
|
|
const Index & |
index, |
|
|
const Row & |
row |
|
) |
| |
|
staticprivate |
Generate a cell from a temptable::Row
object with a possibly reduced length, if a prefix index is used.
- Parameters
-
[in] | i | Indexed cell number in the index. E.g. if we have a row (a, b, c, d) and an index on (b, c) and we want the cell `c`, then this will be 1. |
[in] | index | Index to which the current objects belongs, used for querying metadata. |
[in] | row | Row that contains the data. |
◆ compare()
int temptable::Indexed_cells::compare |
( |
const Indexed_cells & |
rhs, |
|
|
const Index & |
index |
|
) |
| const |
Compare to another indexed cells object.
Each cell is compared individually until a differing cells are found. If the compared objects contain different number of cells and all cells are equal up to the smaller object, then the objects are considered equal. E.g. (10, 15) == (10, 15, 23).
- Return values
-
<0 | if this < rhs |
0 | if this == rhs |
>0 | if this > rhs |
- Parameters
-
[in] | rhs | Indexed cells to compare with the current object. |
[in] | index | Index, used for querying metadata. |
◆ export_row_to_mysql()
void temptable::Indexed_cells::export_row_to_mysql |
( |
const Columns & |
columns, |
|
|
unsigned char * |
mysql_row, |
|
|
size_t |
mysql_row_length |
|
) |
| const |
|
inline |
Export the row of these indexed cells in the mysql row format (write_row()).
As with the row()
method, this one does not make sense and must not be called if the current Indexed_cells object has been created from MySQL search cells.
- Parameters
-
[in] | columns | Metadata for the columns that constitute the exported row. |
[out] | mysql_row | Buffer to write the MySQL row into. |
[in] | mysql_row_length | Presumed length of the mysql row in bytes. |
◆ number_of_cells() [1/2]
size_t temptable::Indexed_cells::number_of_cells |
( |
| ) |
const |
|
inline |
Get the number of indexed cells.
- Returns
- number of indexed cells
◆ number_of_cells() [2/2]
void temptable::Indexed_cells::number_of_cells |
( |
size_t |
n | ) |
|
|
inline |
Set the number of indexed cells.
It only makes sense to reduce the number in order to compare less cells for the purposes of prefix search. We treat (10) == (10, 20).
◆ row()
Get the row of these indexed cells.
There is no row if this Indexed_cells object has been created from a MySQL search cells (Handler::index_read() input), so this method must not be called in this case.
- Returns
- row, an element of Table::m_rows
union { ... } temptable::Indexed_cells::@210 |
Save space by putting the members in a union.
Exactly one of those is used.
◆ m_data_location
Flag indicating whether we are interpreting MySQL buffer or we have references to a temptable::Row
object.
◆ m_length
uint16_t temptable::Indexed_cells::m_length |
|
private |
MySQL search cells' length, used only when m_data_location == MYSQL_BUF_INDEX_READ
.
◆ m_mysql_buf
const unsigned char* temptable::Indexed_cells::m_mysql_buf |
Pointer to one of:
- MySQL search cells buffer (index_read() input format) used when m_data_location == MYSQL_BUF_INDEX_READ or
- MySQL row in write_row() format used when m_data_location == MYSQL_BUF_WRITE_ROW.
◆ m_number_of_cells
uint8_t temptable::Indexed_cells::m_number_of_cells |
|
private |
Number of cells that are indexed.
◆ m_row
const Row* temptable::Indexed_cells::m_row |
Pointer to the row, used when m_data_location == ROW.
The documentation for this class was generated from the following files: