📄 row0upd.h
字号:
/******************************************************Update of a row(c) 1996 Innobase OyCreated 12/27/1996 Heikki Tuuri*******************************************************/#ifndef row0upd_h#define row0upd_h#include "univ.i"#include "data0data.h"#include "btr0types.h"#include "btr0pcur.h"#include "dict0types.h"#include "trx0types.h"#include "que0types.h"#include "row0types.h"#include "pars0types.h" /*************************************************************************Creates an update vector object. */UNIV_INLINEupd_t*upd_create(/*=======*/ /* out, own: update vector object */ ulint n, /* in: number of fields */ mem_heap_t* heap); /* in: heap from which memory allocated *//*************************************************************************Returns the number of fields in the update vector == number of columnsto be updated by an update vector. */UNIV_INLINEulintupd_get_n_fields(/*=============*/ /* out: number of fields */ upd_t* update); /* in: update vector *//*************************************************************************Returns the nth field of an update vector. */UNIV_INLINEupd_field_t*upd_get_nth_field(/*==============*/ /* out: update vector field */ upd_t* update, /* in: update vector */ ulint n); /* in: field position in update vector *//*************************************************************************Sets an index field number to be updated by an update vector field. */UNIV_INLINEvoidupd_field_set_field_no(/*===================*/ upd_field_t* upd_field, /* in: update vector field */ ulint field_no, /* in: field number in a clustered index */ dict_index_t* index, /* in: index */ trx_t* trx); /* in: transaction *//*************************************************************************Writes into the redo log the values of trx id and roll ptr and enough infoto determine their positions within a clustered index record. */byte*row_upd_write_sys_vals_to_log(/*==========================*/ /* out: new pointer to mlog */ dict_index_t* index, /* in: clustered index */ trx_t* trx, /* in: transaction */ dulint roll_ptr,/* in: roll ptr of the undo log record */ byte* log_ptr,/* pointer to a buffer of size > 20 opened in mlog */ mtr_t* mtr); /* in: mtr *//*************************************************************************Updates the trx id and roll ptr field in a clustered index record whena row is updated or marked deleted. */UNIV_INLINEvoidrow_upd_rec_sys_fields(/*===================*/ rec_t* rec, /* in: record */ dict_index_t* index, /* in: clustered index */ const ulint* offsets,/* in: rec_get_offsets(rec, index) */ trx_t* trx, /* in: transaction */ dulint roll_ptr);/* in: roll ptr of the undo log record *//*************************************************************************Sets the trx id or roll ptr field of a clustered index entry. */voidrow_upd_index_entry_sys_field(/*==========================*/ dtuple_t* entry, /* in: index entry, where the memory buffers for sys fields are already allocated: the function just copies the new values to them */ dict_index_t* index, /* in: clustered index */ ulint type, /* in: DATA_TRX_ID or DATA_ROLL_PTR */ dulint val); /* in: value to write *//*************************************************************************Creates an update node for a query graph. */upd_node_t*upd_node_create(/*============*/ /* out, own: update node */ mem_heap_t* heap); /* in: mem heap where created *//***************************************************************Writes to the redo log the new values of the fields occurring in the index. */voidrow_upd_index_write_log(/*====================*/ upd_t* update, /* in: update vector */ byte* log_ptr,/* in: pointer to mlog buffer: must contain at least MLOG_BUF_MARGIN bytes of free space; the buffer is closed within this function */ mtr_t* mtr); /* in: mtr into whose log to write *//***************************************************************Returns TRUE if row update changes size of some field in index or if somefield to be updated is stored externally in rec or update. */iboolrow_upd_changes_field_size_or_external(/*===================================*/ /* out: TRUE if the update changes the size of some field in index or the field is external in rec or update */ dict_index_t* index, /* in: index */ const ulint* offsets,/* in: rec_get_offsets(rec, index) */ upd_t* update);/* in: update vector *//***************************************************************Replaces the new column values stored in the update vector to the recordgiven. No field size changes are allowed. This function is used only fora clustered index */voidrow_upd_rec_in_place(/*=================*/ rec_t* rec, /* in/out: record where replaced */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ upd_t* update);/* in: update vector *//*******************************************************************Builds an update vector from those fields which in a secondary index entrydiffer from a record that has the equal ordering fields. NOTE: we comparethe fields as binary strings! */upd_t*row_upd_build_sec_rec_difference_binary(/*====================================*/ /* out, own: update vector of differing fields */ dict_index_t* index, /* in: index */ dtuple_t* entry, /* in: entry to insert */ rec_t* rec, /* in: secondary index record */ trx_t* trx, /* in: transaction */ mem_heap_t* heap); /* in: memory heap from which allocated *//*******************************************************************Builds an update vector from those fields, excluding the roll ptr andtrx id fields, which in an index entry differ from a record that hasthe equal ordering fields. NOTE: we compare the fields as binary strings! */upd_t*row_upd_build_difference_binary(/*============================*/ /* out, own: update vector of differing fields, excluding roll ptr and trx id */ dict_index_t* index, /* in: clustered index */ dtuple_t* entry, /* in: entry to insert */ ulint* ext_vec,/* in: array containing field numbers of externally stored fields in entry, or NULL */ ulint n_ext_vec,/* in: number of fields in ext_vec */ rec_t* rec, /* in: clustered index record */ trx_t* trx, /* in: transaction */ mem_heap_t* heap); /* in: memory heap from which allocated *//***************************************************************Replaces the new column values stored in the update vector to the index entrygiven. */voidrow_upd_index_replace_new_col_vals_index_pos(/*=========================================*/ dtuple_t* entry, /* in/out: index entry where replaced */ dict_index_t* index, /* in: index; NOTE that this may also be a non-clustered index */ upd_t* update, /* in: an update vector built for the index so that the field number in an upd_field is the index position */ mem_heap_t* heap); /* in: memory heap to which we allocate and copy the new values, set this as NULL if you do not want allocation *//***************************************************************Replaces the new column values stored in the update vector to the index entrygiven. */voidrow_upd_index_replace_new_col_vals(/*===============================*/ dtuple_t* entry, /* in/out: index entry where replaced */ dict_index_t* index, /* in: index; NOTE that this may also be a non-clustered index */ upd_t* update, /* in: an update vector built for the CLUSTERED index so that the field number in an upd_field is the clustered index position */ mem_heap_t* heap); /* in: memory heap to which we allocate and copy the new values, set this as NULL if you do not want allocation *//***************************************************************Checks if an update vector changes an ordering field of an index record.This function is fast if the update vector is short or the number of orderingfields in the index is small. Otherwise, this can be quadratic.NOTE: we compare the fields as binary strings! */ iboolrow_upd_changes_ord_field_binary(/*=============================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -