1
/******************************************************
6
Created 12/27/1996 Heikki Tuuri
7
*******************************************************/
15
/*************************************************************************
16
Creates an update vector object. */
21
/* out, own: update vector object */
22
ulint n, /* in: number of fields */
23
mem_heap_t* heap) /* in: heap from which memory allocated */
28
update = mem_heap_alloc(heap, sizeof(upd_t));
30
update->info_bits = 0;
32
update->fields = mem_heap_alloc(heap, sizeof(upd_field_t) * n);
34
for (i = 0; i < n; i++) {
35
update->fields[i].extern_storage = 0;
41
/*************************************************************************
42
Returns the number of fields in the update vector == number of columns
43
to be updated by an update vector. */
48
/* out: number of fields */
49
upd_t* update) /* in: update vector */
53
return(update->n_fields);
56
/*************************************************************************
57
Returns the nth field of an update vector. */
62
/* out: update vector field */
63
upd_t* update, /* in: update vector */
64
ulint n) /* in: field position in update vector */
67
ut_ad(n < update->n_fields);
69
return(update->fields + n);
72
/*************************************************************************
73
Sets an index field number to be updated by an update vector field. */
76
upd_field_set_field_no(
77
/*===================*/
78
upd_field_t* upd_field, /* in: update vector field */
79
ulint field_no, /* in: field number in a clustered
81
dict_index_t* index, /* in: index */
82
trx_t* trx) /* in: transaction */
84
upd_field->field_no = field_no;
86
if (UNIV_UNLIKELY(field_no >= dict_index_get_n_fields(index))) {
88
"InnoDB: Error: trying to access field %lu in ",
90
dict_index_name_print(stderr, trx, index);
92
"InnoDB: but index only has %lu fields\n",
93
(ulong) dict_index_get_n_fields(index));
96
dict_col_copy_type(dict_index_get_nth_col(index, field_no),
97
dfield_get_type(&(upd_field->new_val)));
100
/*************************************************************************
101
Updates the trx id and roll ptr field in a clustered index record when
102
a row is updated or marked deleted. */
105
row_upd_rec_sys_fields(
106
/*===================*/
107
rec_t* rec, /* in: record */
108
dict_index_t* index, /* in: clustered index */
109
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
110
trx_t* trx, /* in: transaction */
111
dulint roll_ptr)/* in: roll ptr of the undo log record */
113
ut_ad(index->type & DICT_CLUSTERED);
114
ut_ad(rec_offs_validate(rec, index, offsets));
115
#ifdef UNIV_SYNC_DEBUG
116
ut_ad(!buf_block_align(rec)->is_hashed
117
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
118
#endif /* UNIV_SYNC_DEBUG */
120
row_set_rec_trx_id(rec, index, offsets, trx->id);
121
row_set_rec_roll_ptr(rec, index, offsets, roll_ptr);