| MySQL 5.6.14 Source Code Document
    | 
#include "univ.i"#include "data0data.h"#include "que0types.h"#include "dict0types.h"#include "trx0types.h"#include "row0types.h"#include "row0ins.ic"

Go to the source code of this file.
| Classes | |
| struct | ins_node_t | 
| Macros | |
| #define | row_ins_index_entry_big_rec(e, big, ofs, heap, index, thd, file, line) row_ins_index_entry_big_rec_func(e,big,ofs,heap,index,file,thd,line) | 
| #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 | 
| Variables | |
| UNIV_INTERN dberr_t | warn_unused_result | 
| #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 71 of file row0ins.cc.


| 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 193 of file row0ins.cc.


| UNIV_INTERN dberr_t 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.
| 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 | 
| UNIV_INTERN dberr_t row_ins_clust_index_entry | ( | dict_index_t * | index, | 
| dtuple_t * | entry, | ||
| que_thr_t * | thr, | ||
| ulint | n_ext | ||
| ) | 
Inserts an entry into a clustered 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: clustered index | 
| entry | in/out: index entry to insert | 
| thr | in: query thread | 
| n_ext | in: number of externally stored columns | 
| UNIV_INTERN dberr_t row_ins_clust_index_entry_low | ( | ulint | flags, | 
| ulint | mode, | ||
| dict_index_t * | index, | ||
| ulint | n_uniq, | ||
| dtuple_t * | entry, | ||
| ulint | n_ext, | ||
| que_thr_t * | thr | ||
| ) | 
Tries to insert an entry into a clustered index, ignoring foreign key constraints. If a record with the same unique key is found, the other record is necessarily marked deleted by a committed transaction, or a unique key violation error occurs. The delete marked record is then updated to an existing record, and we must write an undo log record on the delete marked record.
| DB_SUCCESS | on success | 
| DB_LOCK_WAIT | on lock wait when !(flags & BTR_NO_LOCKING_FLAG) | 
| DB_FAIL | if retry with BTR_MODIFY_TREE is needed | 
| flags | in: undo logging and locking flags | 
| mode | in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether we wish optimistic or pessimistic descent down the index tree | 
| index | in: clustered index | 
| n_uniq | in: 0 or index->n_uniq | 
| entry | in/out: index entry to insert | 
| n_ext | in: number of externally stored columns | 
| thr | in: query thread or NULL | 
| UNIV_INTERN dberr_t row_ins_index_entry_big_rec_func | ( | const dtuple_t * | entry, | 
| const big_rec_t * | big_rec, | ||
| ulint * | offsets, | ||
| mem_heap_t ** | heap, | ||
| dict_index_t * | index, | ||
| const char * | file, | ||
| const void * | thd, | ||
| ulint | line | ||
| ) | 
Tries to insert the externally stored fields (off-page columns) of a clustered index entry.
| entry | in/out: index entry to insert | 
| big_rec | in: externally stored fields | 
| offsets | in/out: rec offsets | 
| heap | in/out: memory heap | 
| index | in: index | 
| file | in: file name of caller | 
| thd | in: connection, or NULL | 
| line | in: line number of caller | 
| UNIV_INTERN dberr_t row_ins_sec_index_entry | ( | dict_index_t * | index, | 
| dtuple_t * | entry, | ||
| que_thr_t * | thr | ||
| ) | 
Inserts an entry into a secondary 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: secondary index | 
| entry | in/out: index entry to insert | 
| thr | in: query thread | 
| UNIV_INTERN dberr_t row_ins_sec_index_entry_low | ( | ulint | flags, | 
| ulint | mode, | ||
| dict_index_t * | index, | ||
| mem_heap_t * | offsets_heap, | ||
| mem_heap_t * | heap, | ||
| dtuple_t * | entry, | ||
| trx_id_t | trx_id, | ||
| que_thr_t * | thr | ||
| ) | 
Tries to insert an entry into a secondary index. If a record with exactly the same fields is found, the other record is necessarily marked deleted. It is then unmarked. Otherwise, the entry is just inserted to the index.
| DB_SUCCESS | on success | 
| DB_LOCK_WAIT | on lock wait when !(flags & BTR_NO_LOCKING_FLAG) | 
| DB_FAIL | if retry with BTR_MODIFY_TREE is needed | 
| flags | in: undo logging and locking flags | 
| mode | in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether we wish optimistic or pessimistic descent down the index tree | 
| index | in: secondary index | 
| offsets_heap | in/out: memory heap that can be emptied | 
| heap | in/out: memory heap | 
| entry | in/out: index entry to insert | 
| trx_id | in: PAGE_MAX_TRX_ID during row_log_table_apply(), or 0 | 
| thr | in: query thread |