MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
row0row.cc File Reference
#include "row0row.h"
#include "data0type.h"
#include "dict0dict.h"
#include "btr0btr.h"
#include "ha_prototypes.h"
#include "mach0data.h"
#include "trx0rseg.h"
#include "trx0trx.h"
#include "trx0roll.h"
#include "trx0undo.h"
#include "trx0purge.h"
#include "trx0rec.h"
#include "que0que.h"
#include "row0ext.h"
#include "row0upd.h"
#include "rem0cmp.h"
#include "read0read.h"
#include "ut0mem.h"
Include dependency graph for row0row.cc:

Go to the source code of this file.

Functions

UNIV_INTERN dtuple_trow_build_index_entry_low (const dtuple_t *row, const row_ext_t *ext, dict_index_t *index, mem_heap_t *heap)
UNIV_INTERN dtuple_trow_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)
UNIV_INTERN dtuple_trow_rec_to_index_entry_low (const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *n_ext, mem_heap_t *heap)
UNIV_INTERN dtuple_trow_rec_to_index_entry (const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *n_ext, mem_heap_t *heap)
UNIV_INTERN dtuple_trow_build_row_ref (ulint type, dict_index_t *index, const rec_t *rec, mem_heap_t *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)
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)
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)
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)
UNIV_INTERN ulint row_raw_format (const char *data, ulint data_len, const dict_field_t *dict_field, char *buf, ulint buf_size)

Detailed Description

General row routines

Created 4/20/1996 Heikki Tuuri

Definition in file row0row.cc.

Function Documentation

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.

Returns
own: row built; see the NOTE below!
Parameters
typein: 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
indexin: clustered index
recin: 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!
offsetsin: rec_get_offsets(rec,index) or NULL, in which case this function will invoke rec_get_offsets()
col_tablein: table, to check which externally stored columns occur in the ordering columns of an index, or NULL if index->table should be consulted instead
add_colsin: default values of added columns, or NULL
col_mapin: mapping of old column numbers to new ones, or NULL
extout, own: cache of externally stored column prefixes, or NULL
heapin: memory heap from which the memory needed is allocated

Definition at line 192 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
index entry which should be inserted or purged
Return values
NULLif the externally stored columns in the clustered index record are unavailable and ext != NULL, or row is missing some needed columns.
Parameters
rowin: row which should be inserted or purged
extin: externally stored column prefixes, or NULL
indexin: index on the table
heapin: memory heap from which the memory for the index entry is allocated

Definition at line 58 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
own: row reference built; see the NOTE below!
Parameters
typein: 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
indexin: secondary index
recin: 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!
heapin: memory heap from which the memory needed is allocated

Definition at line 493 of file row0row.cc.

Here is the call graph for this function:

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.

Parameters
refin/out: row reference built; see the NOTE below!
recin: 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!
indexin: secondary index
offsetsin: rec_get_offsets(rec, index) or NULL
trxin: transaction

Definition at line 603 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
record or NULL, if no record found
Parameters
modein: BTR_MODIFY_LEAF, ...
recin: record in a secondary index
indexin: secondary index
clust_indexout: clustered index
mtrin: mtr

Definition at line 759 of file row0row.cc.

Here is the call graph for this function:

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).

Returns
number of bytes that were written
Parameters
datain: raw data
data_lenin: raw data length in bytes
dict_fieldin: index field
bufout: output buffer
buf_sizein: output buffer size in bytes

Definition at line 961 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
own: index entry built
Parameters
recin: record in the index
indexin: index
offsetsin: rec_get_offsets(rec)
n_extout: number of externally stored columns
heapin: memory heap from which the memory needed is allocated

Definition at line 453 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
index entry built; does not set info_bits, and the data fields in the entry will point directly to rec
Parameters
recin: record in the index
indexin: index
offsetsin: rec_get_offsets(rec, index)
n_extout: number of externally stored columns
heapin: memory heap from which the memory needed is allocated

Definition at line 395 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
whether the record was found or buffered
Parameters
indexin: index
entryin: index entry
modein: BTR_MODIFY_LEAF, ...
pcurin/out: persistent cursor, which must be closed by the caller
mtrin: mtr

Definition at line 800 of file row0row.cc.

Here is the call graph for this function:

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.

Returns
TRUE if found
Parameters
pcurout: persistent cursor, which must be closed by the caller
modein: BTR_MODIFY_LEAF, ...
tablein: table
refin: row reference
mtrin/out: mtr

Definition at line 715 of file row0row.cc.

Here is the call graph for this function: