#include "univ.i"
#include "data0data.h"
#include "que0types.h"
#include "dict0types.h"
#include "trx0types.h"
#include "row0types.h"
Go to the source code of this file.
Classes | |
struct | ins_node_struct |
Defines | |
#define | INS_NODE_MAGIC_N 15849075 |
#define | INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */ |
#define | INS_VALUES 1 /* INSERT INTO ... VALUES ... */ |
#define | INS_DIRECT |
#define | INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */ |
#define | INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */ |
#define | INS_NODE_INSERT_ENTRIES |
Functions | |
UNIV_INTERN ulint | row_ins_check_foreign_constraint (ibool check_ref, dict_foreign_t *foreign, dict_table_t *table, dtuple_t *entry, que_thr_t *thr) |
UNIV_INTERN ins_node_t * | ins_node_create (ulint ins_type, dict_table_t *table, mem_heap_t *heap) |
UNIV_INTERN void | ins_node_set_new_row (ins_node_t *node, dtuple_t *row) |
UNIV_INTERN ulint | row_ins_index_entry (dict_index_t *index, dtuple_t *entry, ulint n_ext, ibool foreign, que_thr_t *thr) |
UNIV_INTERN que_thr_t * | row_ins_step (que_thr_t *thr) |
UNIV_INTERN void | ins_node_create_entry_list (ins_node_t *node) |
#define INS_DIRECT |
#define INS_NODE_INSERT_ENTRIES |
UNIV_INTERN ins_node_t* ins_node_create | ( | ulint | ins_type, |
dict_table_t * | table, | ||
mem_heap_t * | heap | ||
) |
Creates an insert node struct.
Creates an insert node struct.
ins_type | in: INS_VALUES, ... |
table | in: table where to insert |
heap | in: mem heap where created |
Definition at line 69 of file row0ins.cc.
References ins_node_struct::common, ins_node_struct::entry, ins_node_struct::index, ins_node_create(), mem_heap_alloc(), mem_heap_create, ins_node_struct::select, ins_node_struct::state, ins_node_struct::table, ins_node_struct::trx_id, and que_common_struct::type.
Referenced by ind_create_graph_create(), ins_node_create(), pars_insert_statement(), and tab_create_graph_create().
UNIV_INTERN void ins_node_create_entry_list | ( | ins_node_t * | node | ) |
Creates an entry template for each index of a table. in: row insert node
Creates an entry template for each index of a table.
node | in: row insert node |
Definition at line 103 of file row0ins.cc.
References ins_node_create_entry_list(), ins_node_struct::row, row_build_index_entry(), ins_node_struct::table, ut_ad, UT_LIST_ADD_LAST, and UT_LIST_INIT.
Referenced by ins_node_create_entry_list(), and ins_node_set_new_row().
UNIV_INTERN void ins_node_set_new_row | ( | ins_node_t * | node, |
dtuple_t * | row | ||
) |
Sets a new row to insert for an INS_DIRECT node. This function is only used if we have constructed the row separately, which is a rare case; this function is quite slow. in: new row (or first row) for the node
Sets a new row to insert for an INS_DIRECT node. This function is only used if we have constructed the row separately, which is a rare case; this function is quite slow.
node | in: insert node |
row | in: new row (or first row) for the node |
Definition at line 186 of file row0ins.cc.
References ins_node_struct::entry, ins_node_struct::index, ins_node_create_entry_list(), ins_node_set_new_row(), mem_heap_empty(), ins_node_struct::row, ins_node_struct::state, and ins_node_struct::trx_id.
Referenced by ins_node_set_new_row(), and pars_insert_statement().
UNIV_INTERN ulint row_ins_check_foreign_constraint | ( | ibool | check_ref, |
dict_foreign_t * | foreign, | ||
dict_table_t * | table, | ||
dtuple_t * | entry, | ||
que_thr_t * | thr | ||
) |
Checks if foreign key constraint fails for an index entry. Sets shared locks which lock either the success or the failure of the constraint. NOTE that the caller must have a shared latch on dict_foreign_key_check_lock.
Checks if foreign key constraint fails for an index entry. Sets shared locks which lock either the success or the failure of the constraint. NOTE that the caller must have a shared latch on dict_operation_lock.
check_ref | in: TRUE if we want to check that the referenced table is ok, FALSE if we want to check the foreign key table |
foreign | in: foreign constraint; NOTE that the tables mentioned in it must be in the dictionary cache if they exist at all |
table | in: if check_ref is TRUE, then the foreign table, else the referenced table |
entry | in: index entry for index |
thr | in: query thread |
Definition at line 1187 of file row0ins.cc.
References btr_pcur_close(), btr_pcur_get_block(), btr_pcur_get_rec(), btr_pcur_move_to_next(), BTR_SEARCH_LEAF, cmp_dtuple_rec(), DB_SUCCESS_LOCKED_REC, dfield_get_len(), dtuple_get_n_fields_cmp(), dtuple_set_n_fields_cmp(), trx_struct::error_state, dict_foreign_struct::foreign_index, dict_foreign_struct::foreign_table, dict_foreign_struct::foreign_table_name, dict_table_struct::ibd_file_missing, LOCK_GAP, LOCK_ORDINARY, LOCK_REC_NOT_GAP, lock_table(), mem_heap_free, mtr_commit(), mtr_start(), dict_foreign_struct::n_fields, dict_index_struct::name, page_rec_is_infimum(), page_rec_is_supremum(), que_node_get_type(), que_thr_stop_for_mysql(), rec_get_deleted_flag(), rec_offs_comp(), dict_foreign_struct::referenced_index, dict_foreign_struct::referenced_table, dict_foreign_struct::referenced_table_name, row_ins_check_foreign_constraint(), que_thr_struct::run_node, srv_suspend_mysql_thread(), thr_get_trx(), trx_print(), dict_foreign_struct::type, ut_a, ut_ad, ut_print_name(), and ut_print_timestamp().
Referenced by row_ins_check_foreign_constraint().
UNIV_INTERN ulint row_ins_index_entry | ( | dict_index_t * | index, |
dtuple_t * | entry, | ||
ulint | n_ext, | ||
ibool | foreign, | ||
que_thr_t * | thr | ||
) |
Inserts an index entry to index. Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough to a delete marked record, performs the insert by updating or delete unmarking the delete marked record.
Inserts an index entry to index. Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough to a delete marked record, performs the insert by updating or delete unmarking the delete marked record.
index | in: index |
entry | in/out: index entry to insert |
n_ext | in: number of externally stored columns |
foreign | in: TRUE=check foreign key constraints (foreign=FALSE only during CREATE INDEX) |
thr | in: query thread |
Definition at line 2151 of file row0ins.cc.
References BTR_MODIFY_LEAF, BTR_MODIFY_TREE, dict_table_struct::foreign_list, row_ins_index_entry(), dict_index_struct::table, and UT_LIST_GET_FIRST.
Referenced by row_ins_index_entry().
UNIV_INTERN que_thr_t* row_ins_step | ( | que_thr_t * | thr | ) |
Inserts a row to a table. This is a high-level function used in SQL execution graphs.
Inserts a row to a table. This is a high-level function used in SQL execution graphs.
thr | in: query thread |
Definition at line 2414 of file row0ins.cc.
References trx_struct::error_state, trx_struct::id, lock_table(), que_thr_struct::prev_node, que_node_get_parent(), que_node_get_type(), row_ins_step(), que_thr_struct::run_node, SEL_NODE_FETCH, SEL_NODE_NO_MORE_ROWS, SEL_NODE_OPEN, ins_node_struct::select, ins_node_struct::state, sel_node_struct::state, ins_node_struct::table, thr_get_trx(), ins_node_struct::trx_id, trx_start_if_not_started(), trx_write_trx_id(), and ut_ad.
Referenced by row_ins_step(), and row_insert_for_mysql().