1
/******************************************************
6
Created 4/20/1996 Heikki Tuuri
7
*******************************************************/
13
/*************************************************************************
14
Reads the trx id or roll ptr field from a clustered index record: this function
15
is slower than the specialized inline functions. */
18
row_get_rec_sys_field(
19
/*==================*/
20
/* out: value of the field */
21
ulint type, /* in: DATA_TRX_ID or DATA_ROLL_PTR */
22
rec_t* rec, /* in: record */
23
dict_index_t* index, /* in: clustered index */
24
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
25
/*************************************************************************
26
Sets the trx id or roll ptr field in a clustered index record: this function
27
is slower than the specialized inline functions. */
30
row_set_rec_sys_field(
31
/*==================*/
32
/* out: value of the field */
33
ulint type, /* in: DATA_TRX_ID or DATA_ROLL_PTR */
34
rec_t* rec, /* in: record */
35
dict_index_t* index, /* in: clustered index */
36
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
37
dulint val); /* in: value to set */
39
/*************************************************************************
40
Reads the trx id field from a clustered index record. */
45
/* out: value of the field */
46
rec_t* rec, /* in: record */
47
dict_index_t* index, /* in: clustered index */
48
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
52
ut_ad(index->type & DICT_CLUSTERED);
53
ut_ad(rec_offs_validate(rec, index, offsets));
55
offset = index->trx_id_offset;
58
return(trx_read_trx_id(rec + offset));
60
return(row_get_rec_sys_field(DATA_TRX_ID,
61
rec, index, offsets));
65
/*************************************************************************
66
Reads the roll pointer field from a clustered index record. */
71
/* out: value of the field */
72
rec_t* rec, /* in: record */
73
dict_index_t* index, /* in: clustered index */
74
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
78
ut_ad(index->type & DICT_CLUSTERED);
79
ut_ad(rec_offs_validate(rec, index, offsets));
81
offset = index->trx_id_offset;
84
return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
86
return(row_get_rec_sys_field(DATA_ROLL_PTR,
87
rec, index, offsets));
91
/*************************************************************************
92
Writes the trx id field to a clustered index record. */
97
rec_t* rec, /* in: record */
98
dict_index_t* index, /* in: clustered index */
99
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
100
dulint trx_id) /* in: value of the field */
104
ut_ad(index->type & DICT_CLUSTERED);
105
ut_ad(rec_offs_validate(rec, index, offsets));
107
offset = index->trx_id_offset;
110
trx_write_trx_id(rec + offset, trx_id);
112
row_set_rec_sys_field(DATA_TRX_ID,
113
rec, index, offsets, trx_id);
117
/*************************************************************************
118
Sets the roll pointer field in a clustered index record. */
121
row_set_rec_roll_ptr(
122
/*=================*/
123
rec_t* rec, /* in: record */
124
dict_index_t* index, /* in: clustered index */
125
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
126
dulint roll_ptr)/* in: value of the field */
130
ut_ad(index->type & DICT_CLUSTERED);
131
ut_ad(rec_offs_validate(rec, index, offsets));
133
offset = index->trx_id_offset;
136
trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
138
row_set_rec_sys_field(DATA_ROLL_PTR,
139
rec, index, offsets, roll_ptr);
143
/***********************************************************************
144
Builds from a secondary index record a row reference with which we can
145
search the clustered index record. */
148
row_build_row_ref_fast(
149
/*===================*/
150
dtuple_t* ref, /* in: typed data tuple where the
151
reference is built */
152
const ulint* map, /* in: array of field numbers in rec
153
telling how ref should be built from
155
rec_t* rec, /* in: record in the index; must be
156
preserved while ref is used, as we do
157
not copy field values to heap */
158
const ulint* offsets)/* in: array returned by rec_get_offsets() */
167
ut_ad(rec_offs_validate(rec, NULL, offsets));
168
ref_len = dtuple_get_n_fields(ref);
170
for (i = 0; i < ref_len; i++) {
171
dfield = dtuple_get_nth_field(ref, i);
173
field_no = *(map + i);
175
if (field_no != ULINT_UNDEFINED) {
177
field = rec_get_nth_field(rec, offsets,
179
dfield_set_data(dfield, field, len);