| MySQL 5.6.14 Source Code Document
    | 
#include "univ.i"#include "data0data.h"#include "dict0types.h"#include "trx0types.h"#include "que0types.h"#include "mtr0mtr.h"#include "rem0types.h"#include "read0types.h"#include "row0types.h"#include "btr0types.h"#include "row0row.ic"

Go to the source code of this file.
| Macros | |
| #define | ROW_COPY_DATA 1 | 
| #define | ROW_COPY_POINTERS 2 | 
| Enumerations | |
| enum | row_search_result { ROW_FOUND = 0, ROW_NOT_FOUND, ROW_BUFFERED, ROW_NOT_DELETED_REF } | 
| Functions | |
| UNIV_INLINE ulint | row_get_trx_id_offset (const dict_index_t *index, const ulint *offsets) __attribute__((nonnull | 
| UNIV_INLINE trx_id_t | row_get_rec_trx_id (const rec_t *rec, const dict_index_t *index, const ulint *offsets) __attribute__((nonnull | 
| UNIV_INLINE roll_ptr_t | row_get_rec_roll_ptr (const rec_t *rec, const dict_index_t *index, const ulint *offsets) __attribute__((nonnull | 
| UNIV_INTERN dtuple_t * | row_build_index_entry_low (const dtuple_t *row, const row_ext_t *ext, dict_index_t *index, mem_heap_t *heap) __attribute__((warn_unused_result | 
| UNIV_INTERN dtuple_t | nonnull (1, 3, 4))) | 
| UNIV_INLINE dtuple_t * | row_build_index_entry (const dtuple_t *row, const row_ext_t *ext, dict_index_t *index, mem_heap_t *heap) __attribute__((warn_unused_result | 
| UNIV_INTERN 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) __attribute__((nonnull(2 | 
| UNIV_INTERN dtuple_t UNIV_INTERN dtuple_t * | row_rec_to_index_entry_low (const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *n_ext, mem_heap_t *heap) __attribute__((nonnull | 
| UNIV_INTERN dtuple_t * | row_rec_to_index_entry (const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *n_ext, mem_heap_t *heap) __attribute__((nonnull | 
| UNIV_INTERN dtuple_t * | row_build_row_ref (ulint type, dict_index_t *index, const rec_t *rec, mem_heap_t *heap) __attribute__((nonnull | 
| UNIV_INTERN void | row_build_row_ref_in_tuple (dtuple_t *ref, const rec_t *rec, const dict_index_t *index, ulint *offsets, trx_t *trx) __attribute__((nonnull(1 | 
| UNIV_INTERN void UNIV_INLINE void | row_build_row_ref_fast (dtuple_t *ref, const ulint *map, const rec_t *rec, const ulint *offsets) | 
| UNIV_INTERN ibool | row_search_on_row_ref (btr_pcur_t *pcur, ulint mode, const dict_table_t *table, const dtuple_t *ref, mtr_t *mtr) __attribute__((nonnull | 
| UNIV_INTERN rec_t * | row_get_clust_rec (ulint mode, const rec_t *rec, dict_index_t *index, dict_index_t **clust_index, mtr_t *mtr) __attribute__((nonnull | 
| UNIV_INTERN 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) __attribute__((nonnull | 
| UNIV_INTERN ulint | row_raw_format (const char *data, ulint data_len, const dict_field_t *dict_field, char *buf, ulint buf_size) __attribute__((nonnull | 
| Variables | |
| UNIV_INLINE ulint | warn_unused_result | 
| enum row_search_result | 
Result of row_search_index_entry
| ROW_FOUND | the record was found | 
| ROW_NOT_FOUND | record not found | 
| ROW_BUFFERED | one of BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK was specified, the secondary index leaf page was not in the buffer pool, and the operation was enqueued in the insert/delete buffer | 
| ROW_NOT_DELETED_REF | BTR_DELETE was specified, and row_purge_poss_sec() failed | 
| UNIV_INTERN 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.
| type | in: 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 | 
| index | in: clustered index | 
| rec | in: 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! | 
| offsets | in: rec_get_offsets(rec,index) or NULL, in which case this function will invoke rec_get_offsets() | 
| col_table | in: table, to check which externally stored columns occur in the ordering columns of an index, or NULL if index->table should be consulted instead; the user columns in this table should be the same columns as in index->table | 
| add_cols | in: default values of added columns, or NULL | 
| col_map | in: mapping of old column numbers to new ones, or NULL | 
| ext | out, own: cache of externally stored column prefixes, or NULL | 
| heap | in: memory heap from which the memory needed is allocated | 

| UNIV_INLINE dtuple_t* row_build_index_entry | ( | const dtuple_t * | row, | 
| const row_ext_t * | ext, | ||
| 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.
| row | in: row which should be inserted or purged | 
| ext | in: externally stored column prefixes, or NULL | 
| index | in: index on the table | 
| heap | in: memory heap from which the memory for the index entry is allocated | 

| UNIV_INTERN dtuple_t* row_build_index_entry_low | ( | const dtuple_t * | row, | 
| const row_ext_t * | ext, | ||
| 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.
| NULL | if the externally stored columns in the clustered index record are unavailable and ext != NULL, or row is missing some needed columns. | 
| row | in: row which should be inserted or purged | 
| ext | in: externally stored column prefixes, or NULL | 
| index | in: index on the table | 
| heap | in: memory heap from which the memory for the index entry is allocated | 
| UNIV_INTERN dtuple_t* row_build_row_ref | ( | ulint | type, | 
| 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 | 

| UNIV_INTERN void UNIV_INLINE 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. in: array returned by rec_get_offsets()
| ref | in/out: typed data tuple where the reference is built | 
| map | in: array of field numbers in rec telling how ref should be built from the fields of rec | 
| rec | in: record in the index; must be preserved while ref is used, as we do not copy field values to heap | 
| UNIV_INTERN void row_build_row_ref_in_tuple | ( | dtuple_t * | ref, | 
| const rec_t * | rec, | ||
| const dict_index_t * | index, | ||
| ulint * | offsets, | ||
| trx_t * | trx | ||
| ) | 
Builds from a secondary index record a row reference with which we can search the clustered index record.
| ref | in/out: row reference built; see the NOTE below! | 
| rec | in: 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! | 
| index | in: secondary index | 
| offsets | in: rec_get_offsets(rec, index) or NULL | 
| trx | in: transaction or NULL | 
| UNIV_INTERN rec_t* row_get_clust_rec | ( | ulint | mode, | 
| const rec_t * | rec, | ||
| 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.
| mode | in: BTR_MODIFY_LEAF, ... | 
| rec | in: record in a secondary index | 
| index | in: secondary index | 
| clust_index | out: clustered index | 
| mtr | in: mtr | 

| UNIV_INLINE 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.
| rec | in: record | 
| index | in: clustered index | 
| offsets | in: rec_get_offsets(rec, index) | 

| UNIV_INLINE 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.
| rec | in: record | 
| index | in: clustered index | 
| offsets | in: rec_get_offsets(rec, index) | 

| UNIV_INLINE 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.
| index | in: clustered index | 
| offsets | in: record offsets | 
| UNIV_INTERN 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).
| 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 | 
| UNIV_INTERN dtuple_t* row_rec_to_index_entry | ( | const rec_t * | rec, | 
| const dict_index_t * | index, | ||
| const ulint * | offsets, | ||
| ulint * | n_ext, | ||
| 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.
| rec | in: record in the index | 
| index | in: index | 
| offsets | in/out: rec_get_offsets(rec) | 
| n_ext | out: number of externally stored columns | 
| heap | in: memory heap from which the memory needed is allocated | 
| UNIV_INTERN dtuple_t UNIV_INTERN dtuple_t* row_rec_to_index_entry_low | ( | const rec_t * | rec, | 
| const dict_index_t * | index, | ||
| const ulint * | offsets, | ||
| ulint * | n_ext, | ||
| 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) | 
| n_ext | out: number of externally stored columns | 
| heap | in: memory heap from which the memory needed is allocated | 

| UNIV_INTERN 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 | 
| UNIV_INTERN ibool row_search_on_row_ref | ( | btr_pcur_t * | pcur, | 
| ulint | mode, | ||
| const 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 | 
