MySQL 9.1.0
Source Code Documentation
|
General row routines. More...
#include "btr0types.h"
#include "data0data.h"
#include "dict0types.h"
#include "mtr0mtr.h"
#include "que0types.h"
#include "rem0types.h"
#include "row0types.h"
#include "trx0types.h"
#include "univ.i"
#include "row0row.ic"
Go to the source code of this file.
Classes | |
class | Multi_value_entry_builder |
Class to build a series of entries based on one multi-value field. More... | |
class | Multi_value_entry_builder_normal |
The subclass of the multi-value entry builder, for non-INSERT cases, With this class, there should be no need to build separate entries for different values in the same multi-value field. More... | |
class | Multi_value_entry_builder_insert |
The subclass of the multi-value row builder, for INSERT cases. More... | |
Enumerations | |
enum | row_search_result { ROW_FOUND = 0 , ROW_NOT_FOUND , ROW_BUFFERED , ROW_NOT_DELETED_REF } |
Result of row_search_index_entry. More... | |
Functions | |
static ulint | row_get_trx_id_offset (const dict_index_t *index, const ulint *offsets) |
Gets the offset of the DB_TRX_ID field, in bytes relative to the origin of a clustered index record. More... | |
static trx_id_t | row_get_rec_trx_id (const rec_t *rec, const dict_index_t *index, const ulint *offsets) |
Reads the trx id field from a clustered index record. More... | |
static roll_ptr_t | row_get_rec_roll_ptr (const rec_t *rec, const dict_index_t *index, const ulint *offsets) |
Reads the roll pointer field from a clustered index record. More... | |
dtuple_t * | row_build_index_entry_low (const dtuple_t *row, const row_ext_t *ext, const dict_index_t *index, mem_heap_t *heap, ulint flag) |
When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table. More... | |
static dtuple_t * | row_build_index_entry (const dtuple_t *row, const row_ext_t *ext, const dict_index_t *index, mem_heap_t *heap) |
When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table. More... | |
dtuple_t * | row_build (ulint type, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const dict_table_t *col_table, const dtuple_t *add_cols, const ulint *col_map, row_ext_t **ext, mem_heap_t *heap) |
An inverse function to row_build_index_entry. More... | |
dtuple_t * | row_build_w_add_vcol (ulint type, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const dict_table_t *col_table, const dtuple_t *add_cols, const dict_add_v_col_t *add_v, const ulint *col_map, row_ext_t **ext, mem_heap_t *heap) |
An inverse function to row_build_index_entry. More... | |
dtuple_t * | row_rec_to_index_entry_low (const rec_t *rec, const dict_index_t *index, const ulint *offsets, mem_heap_t *heap) |
Converts an index record to a typed data tuple. More... | |
dtuple_t * | row_rec_to_index_entry (const rec_t *rec, const dict_index_t *index, const ulint *offsets, mem_heap_t *heap) |
Converts an index record to a typed data tuple. More... | |
dtuple_t * | row_build_row_ref (ulint type, const dict_index_t *index, const rec_t *rec, mem_heap_t *heap) |
Builds from a secondary index record a row reference with which we can search the clustered index record. More... | |
void | row_build_row_ref_in_tuple (dtuple_t *ref, const rec_t *rec, const dict_index_t *index, ulint *offsets) |
Builds from a secondary index record a row reference with which we can search the clustered index record. More... | |
static void | row_build_row_ref_fast (dtuple_t *ref, const ulint *map, const rec_t *rec, const ulint *offsets) |
Builds from a secondary index record a row reference with which we can search the clustered index record. More... | |
bool | row_search_on_row_ref (btr_pcur_t *pcur, ulint mode, dict_table_t *table, const dtuple_t *ref, mtr_t *mtr) |
Searches the clustered index record for a row, if we have the row reference. More... | |
rec_t * | row_get_clust_rec (ulint mode, const rec_t *rec, const dict_index_t *index, dict_index_t **clust_index, mtr_t *mtr) |
Fetches the clustered index record for a secondary index record. More... | |
uint64_t | row_parse_int (const byte *data, ulint len, ulint mtype, bool unsigned_type) |
Parse the integer data from specified data, which could be DATA_INT, DATA_FLOAT or DATA_DOUBLE. More... | |
uint64_t | row_parse_int_from_field (const dfield_t *field) |
Parse the integer data from specified field, which could be DATA_INT, DATA_FLOAT or DATA_DOUBLE. More... | |
uint64_t | row_get_autoinc_counter (const dtuple_t *row, ulint n) |
Read the autoinc counter from the clustered index row. More... | |
enum row_search_result | row_search_index_entry (dict_index_t *index, const dtuple_t *entry, ulint mode, btr_pcur_t *pcur, mtr_t *mtr) |
Searches an index record. More... | |
ulint | row_raw_format (const char *data, ulint data_len, const dict_field_t *dict_field, char *buf, ulint buf_size) |
Formats the raw data in "data" (in InnoDB on-disk format) using "dict_field" and writes the result to "buf". More... | |
Variables | |
constexpr uint32_t | ROW_BUILD_NORMAL = 0 |
build index row More... | |
constexpr uint32_t | ROW_BUILD_FOR_PURGE = 1 |
build row for purge. More... | |
constexpr uint32_t | ROW_BUILD_FOR_UNDO = 2 |
build row for undo. More... | |
constexpr uint32_t | ROW_BUILD_FOR_INSERT = 3 |
build row for insert. More... | |
constexpr uint32_t | ROW_COPY_DATA = 1 |
constexpr uint32_t | ROW_COPY_POINTERS = 2 |
General row routines.
Created 4/20/1996 Heikki Tuuri
enum row_search_result |
Result of row_search_index_entry.
dtuple_t * row_build | ( | ulint | type, |
const dict_index_t * | index, | ||
const rec_t * | rec, | ||
const ulint * | offsets, | ||
const dict_table_t * | col_table, | ||
const dtuple_t * | add_cols, | ||
const ulint * | col_map, | ||
row_ext_t ** | ext, | ||
mem_heap_t * | heap | ||
) |
An inverse function to row_build_index_entry.
Builds a row from a record in a clustered index.
[in] | type | ROW_COPY_POINTERS or ROW_COPY_DATA; the latter copies also the data fields to heap while the first only places pointers to data fields on the index page, and thus is more efficient. |
[in] | index | Clustered index. |
[in] | rec | Record in the clustered index; NOTE: in the case ROW_COPY_POINTERS the data fields in the row will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the row dtuple is used! |
[in] | offsets | rec_get_offsets(rec,index) or nullptr, in which case this function will invoke rec_get_offsets(). |
[in] | col_table | Table, to check which externally stored columns occur in the ordering columns of an index, or nullptr if index->table should be consulted instead; the user columns in this table should be the same columns as in index->table. |
[in] | add_cols | Default values of added columns, or nullptr. |
[in] | col_map | Mapping of old column numbers to new ones, or nullptr. |
[out] | ext | cache of externally stored column prefixes, or nullptr. |
[in] | heap | Memory heap from which the memory needed is allocated. |
|
inlinestatic |
When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table.
[in] | row | Row which should be inserted or purged. |
[in] | ext | Externally stored column prefixes, or nullptr. |
[in] | index | Index on the table. |
[in] | heap | Memory heap from which the memory for the index entry is allocated. |
dtuple_t * row_build_index_entry_low | ( | const dtuple_t * | row, |
const row_ext_t * | ext, | ||
const dict_index_t * | index, | ||
mem_heap_t * | heap, | ||
ulint | flag | ||
) |
When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table.
[in] | row | Row which should be inserted or purged. |
[in] | ext | Externally stored column prefixes, or nullptr. |
[in] | index | Index on the table. |
[in] | heap | Memory heap from which the memory for the index entry is allocated. |
[in] | flag | ROW_BUILD_NORMAL, ROW_BUILD_FOR_PURGE or ROW_BUILD_FOR_UNDO. |
NULL | if the externally stored columns in the clustered index record are unavailable and ext != nullptr, or row is missing some needed columns. |
dtuple_t * row_build_row_ref | ( | ulint | type, |
const dict_index_t * | index, | ||
const rec_t * | rec, | ||
mem_heap_t * | heap | ||
) |
Builds from a secondary index record a row reference with which we can search the clustered index record.
type | in: ROW_COPY_DATA, or ROW_COPY_POINTERS: the former copies also the data fields to heap, whereas the latter only places pointers to data fields on the index page |
index | in: secondary index |
rec | in: record in the index; NOTE: in the case ROW_COPY_POINTERS the data fields in the row will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the row reference is used! |
heap | in: memory heap from which the memory needed is allocated |
|
inlinestatic |
Builds from a secondary index record a row reference with which we can search the clustered index record.
[in,out] | ref | typed data tuple where the reference is built |
[in] | map | array of field numbers in rec telling how ref should be built from the fields of rec |
[in] | rec | record in the index; must be preserved while ref is used, as we do not copy field values to heap |
[in] | offsets | array returned by rec_get_offsets() |
void row_build_row_ref_in_tuple | ( | dtuple_t * | ref, |
const rec_t * | rec, | ||
const dict_index_t * | index, | ||
ulint * | offsets | ||
) |
Builds from a secondary index record a row reference with which we can search the clustered index record.
[in,out] | ref | Row reference built; see the note below! |
[in,out] | rec | Record in the index; note: the data fields in ref will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the row reference is used! |
[in] | index | Secondary index |
[in] | offsets | Rec_get_offsets(rec, index) or null |
dtuple_t * row_build_w_add_vcol | ( | ulint | type, |
const dict_index_t * | index, | ||
const rec_t * | rec, | ||
const ulint * | offsets, | ||
const dict_table_t * | col_table, | ||
const dtuple_t * | add_cols, | ||
const dict_add_v_col_t * | add_v, | ||
const ulint * | col_map, | ||
row_ext_t ** | ext, | ||
mem_heap_t * | heap | ||
) |
An inverse function to row_build_index_entry.
Builds a row from a record in a clustered index, with possible indexing on ongoing addition of new virtual columns.
[in] | type | ROW_COPY_POINTERS or ROW_COPY_DATA; |
[in] | index | clustered index |
[in] | rec | record in the clustered index |
[in] | offsets | rec_get_offsets(rec,index) or NULL |
[in] | col_table | table, to check which externally stored columns occur in the ordering columns of an index, or NULL if index->table should be consulted instead |
[in] | add_cols | default values of added columns, or NULL |
[in] | add_v | new virtual columns added along with new indexes |
[in] | col_map | mapping of old column numbers to new ones, or NULL |
[in] | ext | cache of externally stored column prefixes, or NULL |
[in] | heap | memory heap from which the memory needed is allocated |
Read the autoinc counter from the clustered index row.
[in] | row | row to read the autoinc counter |
[in] | n | autoinc counter is in the nth field |
rec_t * row_get_clust_rec | ( | ulint | mode, |
const rec_t * | rec, | ||
const dict_index_t * | index, | ||
dict_index_t ** | clust_index, | ||
mtr_t * | mtr | ||
) |
Fetches the clustered index record for a secondary index record.
The latches on the secondary index record are preserved.
The latches on the secondary index record are preserved.
mode | in: BTR_MODIFY_LEAF, ... |
rec | in: record in a secondary index |
index | in: secondary index |
clust_index | out: clustered index |
mtr | in: mtr |
|
inlinestatic |
Reads the roll pointer field from a clustered index record.
[in] | rec | Record. |
[in] | index | Clustered index. |
[in] | offsets | rec_get_offsets(rec, index). |
|
inlinestatic |
Reads the trx id field from a clustered index record.
[in] | rec | Record. |
[in] | index | Clustered index. |
[in] | offsets | rec_get_offsets(rec, index). |
|
inlinestatic |
Gets the offset of the DB_TRX_ID field, in bytes relative to the origin of a clustered index record.
[in] | index | Clustered index. |
[in] | offsets | rec_get_offsets(rec, index). |
Parse the integer data from specified data, which could be DATA_INT, DATA_FLOAT or DATA_DOUBLE.
If the value is less than 0 and the type is not unsigned then we reset the value to 0
[in] | data | data to read |
[in] | len | length of data |
[in] | mtype | mtype of data |
[in] | unsigned_type | if the data is unsigned |
uint64_t row_parse_int_from_field | ( | const dfield_t * | field | ) |
Parse the integer data from specified field, which could be DATA_INT, DATA_FLOAT or DATA_DOUBLE.
We could return 0 if 1) the value is less than 0 and the type is not unsigned or 2) the field is null.
[in] | field | field to read the int value |
ulint row_raw_format | ( | const char * | data, |
ulint | data_len, | ||
const dict_field_t * | dict_field, | ||
char * | buf, | ||
ulint | buf_size | ||
) |
Formats the raw data in "data" (in InnoDB on-disk format) using "dict_field" and writes the result to "buf".
Not more than "buf_size" bytes are written to "buf". The result is always NUL-terminated (provided buf_size is positive) and the number of bytes that were written to "buf" is returned (including the terminating NUL).
Not more than "buf_size" bytes are written to "buf". The result is always NUL-terminated (provided buf_size is positive) and the number of bytes that were written to "buf" is returned (including the terminating NUL).
data | in: raw data |
data_len | in: raw data length in bytes |
dict_field | in: index field |
buf | out: output buffer |
buf_size | in: output buffer size in bytes |
dtuple_t * row_rec_to_index_entry | ( | const rec_t * | rec, |
const dict_index_t * | index, | ||
const ulint * | offsets, | ||
mem_heap_t * | heap | ||
) |
Converts an index record to a typed data tuple.
NOTE that externally stored (often big) fields are NOT copied to heap.
NOTE that externally stored (often big) fields are NOT copied to heap.
rec | in: record in the index |
index | in: index |
offsets | in: rec_get_offsets(rec) |
heap | in: memory heap from which the memory needed is allocated |
dtuple_t * row_rec_to_index_entry_low | ( | const rec_t * | rec, |
const dict_index_t * | index, | ||
const ulint * | offsets, | ||
mem_heap_t * | heap | ||
) |
Converts an index record to a typed data tuple.
rec | in: record in the index |
index | in: index |
offsets | in: rec_get_offsets(rec, index) |
heap | in: memory heap from which the memory needed is allocated |
enum row_search_result row_search_index_entry | ( | dict_index_t * | index, |
const dtuple_t * | entry, | ||
ulint | mode, | ||
btr_pcur_t * | pcur, | ||
mtr_t * | mtr | ||
) |
Searches an index record.
index | in: index |
entry | in: index entry |
mode | in: BTR_MODIFY_LEAF, ... |
pcur | in/out: persistent cursor, which must be closed by the caller |
mtr | in: mtr |
bool row_search_on_row_ref | ( | btr_pcur_t * | pcur, |
ulint | mode, | ||
dict_table_t * | table, | ||
const dtuple_t * | ref, | ||
mtr_t * | mtr | ||
) |
Searches the clustered index record for a row, if we have the row reference.
pcur | out: persistent cursor, which must be closed by the caller |
mode | in: BTR_MODIFY_LEAF, ... |
table | in: table |
ref | in: row reference |
mtr | in/out: mtr |
|
constexpr |
build row for insert.
|
constexpr |
build row for purge.
|
constexpr |
build row for undo.
|
constexpr |
build index row
|
constexpr |
|
constexpr |