MySQL 8.0.31
Source Code Documentation
row0row.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1996, 2022, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/row0row.h
28 General row routines
29
30 Created 4/20/1996 Heikki Tuuri
31 *******************************************************/
32
33#ifndef row0row_h
34#define row0row_h
35
36#include "btr0types.h"
37#include "data0data.h"
38#include "dict0types.h"
39#include "mtr0mtr.h"
40#include "que0types.h"
41#include "rem0types.h"
42#include "row0types.h"
43#include "trx0types.h"
44#include "univ.i"
45
46/** Gets the offset of the DB_TRX_ID field, in bytes relative to the origin of
47a clustered index record.
48@param[in] index Clustered index.
49@param[in] offsets rec_get_offsets(rec, index).
50@return offset of DATA_TRX_ID */
51[[nodiscard]] static inline ulint row_get_trx_id_offset(
52 const dict_index_t *index, const ulint *offsets);
53/** Reads the trx id field from a clustered index record.
54@param[in] rec Record.
55@param[in] index Clustered index.
56@param[in] offsets rec_get_offsets(rec, index).
57@return value of the field */
58[[nodiscard]] static inline trx_id_t row_get_rec_trx_id(
59 const rec_t *rec, const dict_index_t *index, const ulint *offsets);
60/** Reads the roll pointer field from a clustered index record.
61@param[in] rec Record.
62@param[in] index Clustered index.
63@param[in] offsets rec_get_offsets(rec, index).
64@return value of the field */
65[[nodiscard]] static inline roll_ptr_t row_get_rec_roll_ptr(
66 const rec_t *rec, const dict_index_t *index, const ulint *offsets);
67
68/* Flags for row build type. */
69/** build index row */
70constexpr uint32_t ROW_BUILD_NORMAL = 0;
71/** build row for purge. */
72constexpr uint32_t ROW_BUILD_FOR_PURGE = 1;
73/** build row for undo. */
74constexpr uint32_t ROW_BUILD_FOR_UNDO = 2;
75/** build row for insert. */
76constexpr uint32_t ROW_BUILD_FOR_INSERT = 3;
77/** When an insert or purge to a table is performed, this function builds
78the entry to be inserted into or purged from an index on the table.
79@param[in] row Row which should be inserted or purged.
80@param[in] ext Externally stored column prefixes, or nullptr.
81@param[in] index Index on the table.
82@param[in] heap Memory heap from which the memory for the index entry is
83allocated.
84@param[in] flag ROW_BUILD_NORMAL, ROW_BUILD_FOR_PURGE or ROW_BUILD_FOR_UNDO.
85@return index entry which should be inserted or purged
86@retval NULL if the externally stored columns in the clustered index record
87are unavailable and ext != nullptr, or row is missing some needed columns. */
88[[nodiscard]] dtuple_t *row_build_index_entry_low(const dtuple_t *row,
89 const row_ext_t *ext,
90 const dict_index_t *index,
91 mem_heap_t *heap, ulint flag);
92/** When an insert or purge to a table is performed, this function builds
93the entry to be inserted into or purged from an index on the table.
94@return index entry which should be inserted or purged, or NULL if the
95externally stored columns in the clustered index record are
96unavailable and ext != nullptr
97@param[in] row Row which should be inserted or purged.
98@param[in] ext Externally stored column prefixes, or nullptr.
99@param[in] index Index on the table.
100@param[in] heap Memory heap from which the memory for the index entry is
101allocated. */
102[[nodiscard]] static inline dtuple_t *row_build_index_entry(
103 const dtuple_t *row, const row_ext_t *ext, const dict_index_t *index,
104 mem_heap_t *heap);
105/** An inverse function to row_build_index_entry. Builds a row from a
106record in a clustered index.
107@param[in] type ROW_COPY_POINTERS or ROW_COPY_DATA; the latter copies also
108the data fields to heap while the first only places pointers to data fields on
109the index page, and thus is more efficient.
110@param[in] index Clustered index.
111@param[in] rec Record in the clustered index; NOTE: in the case
112ROW_COPY_POINTERS the data fields in the row will point directly into this
113record, therefore, the buffer page of this record must be at least s-latched and
114the latch held as long as the row dtuple is used!
115@param[in] offsets rec_get_offsets(rec,index) or nullptr, in which case this
116function will invoke rec_get_offsets().
117@param[in] col_table Table, to check which externally stored columns occur in
118the ordering columns of an index, or nullptr if index->table should be consulted
119instead; the user columns in this table should be the same columns as in
120index->table.
121@param[in] add_cols Default values of added columns, or nullptr.
122@param[in] col_map Mapping of old column numbers to new ones, or nullptr.
123@param[out] ext cache of externally stored column prefixes, or nullptr.
124@param[in] heap Memory heap from which the memory needed is allocated.
125@return own: row built; see the NOTE below! */
126dtuple_t *row_build(ulint type, const dict_index_t *index, const rec_t *rec,
127 const ulint *offsets, const dict_table_t *col_table,
128 const dtuple_t *add_cols, const ulint *col_map,
129 row_ext_t **ext, mem_heap_t *heap);
130
131/** An inverse function to row_build_index_entry. Builds a row from a
132record in a clustered index, with possible indexing on ongoing
133addition of new virtual columns.
134@param[in] type ROW_COPY_POINTERS or ROW_COPY_DATA;
135@param[in] index clustered index
136@param[in] rec record in the clustered index
137@param[in] offsets rec_get_offsets(rec,index) or NULL
138@param[in] col_table table, to check which
139 externally stored columns
140 occur in the ordering columns
141 of an index, or NULL if
142 index->table should be
143 consulted instead
144@param[in] add_cols default values of added columns, or NULL
145@param[in] add_v new virtual columns added
146 along with new indexes
147@param[in] col_map mapping of old column
148 numbers to new ones, or NULL
149@param[in] ext cache of externally stored column
150 prefixes, or NULL
151@param[in] heap memory heap from which
152 the memory needed is allocated
153@return own: row built */
155 const rec_t *rec, const ulint *offsets,
156 const dict_table_t *col_table,
157 const dtuple_t *add_cols,
158 const dict_add_v_col_t *add_v,
159 const ulint *col_map, row_ext_t **ext,
160 mem_heap_t *heap);
161
162/** Converts an index record to a typed data tuple.
163 @return index entry built; does not set info_bits, and the data fields
164 in the entry will point directly to rec */
166 const rec_t *rec, /*!< in: record in the index */
167 const dict_index_t *index, /*!< in: index */
168 const ulint *offsets, /*!< in: rec_get_offsets(rec, index) */
169 mem_heap_t *heap); /*!< in: memory heap from which
170 the memory needed is allocated */
171/** Converts an index record to a typed data tuple. NOTE that externally
172 stored (often big) fields are NOT copied to heap.
173 @return own: index entry built */
174[[nodiscard]] dtuple_t *row_rec_to_index_entry(
175 const rec_t *rec, /*!< in: record in the index */
176 const dict_index_t *index, /*!< in: index */
177 const ulint *offsets, /*!< in/out: rec_get_offsets(rec) */
178 mem_heap_t *heap); /*!< in: memory heap from which
179 the memory needed is allocated */
180/** Builds from a secondary index record a row reference with which we can
181 search the clustered index record.
182 @return own: row reference built; see the NOTE below! */
183[[nodiscard]] dtuple_t *row_build_row_ref(
184 ulint type, /*!< in: ROW_COPY_DATA, or ROW_COPY_POINTERS:
185 the former copies also the data fields to
186 heap, whereas the latter only places pointers
187 to data fields on the index page */
188 const dict_index_t *index, /*!< in: secondary index */
189 const rec_t *rec, /*!< in: record in the index;
190 NOTE: in the case ROW_COPY_POINTERS
191 the data fields in the row will point
192 directly into this record, therefore,
193 the buffer page of this record must be
194 at least s-latched and the latch held
195 as long as the row reference is used! */
196 mem_heap_t *heap); /*!< in: memory heap from which the memory
197 needed is allocated */
198
199/** Builds from a secondary index record a row reference with which we can
200search the clustered index record.
201@param[in,out] ref Row reference built; see the note below!
202@param[in,out] rec Record in the index; note: the data fields in ref will point
203directly into this record, therefore, the buffer page of this record must be at
204least s-latched and the latch held as long as the row reference is used!
205@param[in] index Secondary index
206@param[in] offsets Rec_get_offsets(rec, index) or null */
208 const dict_index_t *index, ulint *offsets);
209
210/** Builds from a secondary index record a row reference with which we can
211search the clustered index record.
212@param[in,out] ref typed data tuple where the reference is built
213@param[in] map array of field numbers in rec telling how ref should
214 be built from the fields of rec
215@param[in] rec record in the index; must be preserved while ref is
216 used, as we do not copy field values to heap
217@param[in] offsets array returned by rec_get_offsets() */
218static inline void row_build_row_ref_fast(dtuple_t *ref, const ulint *map,
219 const rec_t *rec,
220 const ulint *offsets);
221
222/** Searches the clustered index record for a row, if we have the row
223 reference.
224 @return true if found */
225[[nodiscard]] bool row_search_on_row_ref(
226 btr_pcur_t *pcur, /*!< out: persistent cursor, which
227 must be closed by the caller */
228 ulint mode, /*!< in: BTR_MODIFY_LEAF, ... */
229 dict_table_t *table, /*!< in: table */
230 const dtuple_t *ref, /*!< in: row reference */
231 mtr_t *mtr); /*!< in/out: mtr */
232/** Fetches the clustered index record for a secondary index record. The latches
233 on the secondary index record are preserved.
234 @return record or NULL, if no record found */
235[[nodiscard]] rec_t *row_get_clust_rec(
236 ulint mode, /*!< in: BTR_MODIFY_LEAF, ... */
237 const rec_t *rec, /*!< in: record in a secondary index */
238 const dict_index_t *index, /*!< in: secondary index */
239 dict_index_t **clust_index, /*!< out: clustered index */
240 mtr_t *mtr); /*!< in: mtr */
241
242/** Parse the integer data from specified data, which could be
243DATA_INT, DATA_FLOAT or DATA_DOUBLE. If the value is less than 0
244and the type is not unsigned then we reset the value to 0
245@param[in] data data to read
246@param[in] len length of data
247@param[in] mtype mtype of data
248@param[in] unsigned_type if the data is unsigned
249@return the integer value from the data */
250inline uint64_t row_parse_int(const byte *data, ulint len, ulint mtype,
251 bool unsigned_type);
252
253/** Parse the integer data from specified field, which could be
254DATA_INT, DATA_FLOAT or DATA_DOUBLE. We could return 0 if
2551) the value is less than 0 and the type is not unsigned
256or 2) the field is null.
257@param[in] field field to read the int value
258@return the integer value read from the field, 0 for negative signed
259int or NULL field */
260uint64_t row_parse_int_from_field(const dfield_t *field);
261
262/** Read the autoinc counter from the clustered index row.
263@param[in] row row to read the autoinc counter
264@param[in] n autoinc counter is in the nth field
265@return the autoinc counter read */
266uint64_t row_get_autoinc_counter(const dtuple_t *row, ulint n);
267
268/** Result of row_search_index_entry */
270 ROW_FOUND = 0, /*!< the record was found */
271 ROW_NOT_FOUND, /*!< record not found */
272 ROW_BUFFERED, /*!< one of BTR_INSERT, BTR_DELETE, or
273 BTR_DELETE_MARK was specified, the
274 secondary index leaf page was not in
275 the buffer pool, and the operation was
276 enqueued in the insert/delete buffer */
277 ROW_NOT_DELETED_REF /*!< BTR_DELETE was specified, and
278 row_purge_poss_sec() failed */
280
281/** Searches an index record.
282 @return whether the record was found or buffered */
284 dict_index_t *index, /*!< in: index */
285 const dtuple_t *entry, /*!< in: index entry */
286 ulint mode, /*!< in: BTR_MODIFY_LEAF, ... */
287 btr_pcur_t *pcur, /*!< in/out: persistent cursor, which must
288 be closed by the caller */
289 mtr_t *mtr); /*!< in: mtr */
290
291constexpr uint32_t ROW_COPY_DATA = 1;
292constexpr uint32_t ROW_COPY_POINTERS = 2;
293
294/* The allowed latching order of index records is the following:
295(1) a secondary index record ->
296(2) the clustered index record ->
297(3) rollback segment data for the clustered index record. */
298
299/** Formats the raw data in "data" (in InnoDB on-disk format) using
300 "dict_field" and writes the result to "buf".
301 Not more than "buf_size" bytes are written to "buf".
302 The result is always NUL-terminated (provided buf_size is positive) and the
303 number of bytes that were written to "buf" is returned (including the
304 terminating NUL).
305 @return number of bytes that were written */
306[[nodiscard]] ulint row_raw_format(
307 const char *data, /*!< in: raw data */
308 ulint data_len, /*!< in: raw data length
309 in bytes */
310 const dict_field_t *dict_field, /*!< in: index field */
311 char *buf, /*!< out: output buffer */
312 ulint buf_size); /*!< in: output buffer size
313 in bytes */
314
315/** Class to build a series of entries based on one multi-value field.
316It assumes that there is only one multi-value field on multi-value index. */
318 public:
319 /** Constructor */
321 : m_index(index),
322 m_selected(selected),
323 m_entry(entry),
324 m_pos(0),
326 m_mv_field_no(0) {}
327
328 virtual ~Multi_value_entry_builder() = default;
329
330 /** Get the first index entry. If the multi-value field on the index
331 is null, then it's the entry including the null field, otherwise,
332 it should be the entry with multi-value data at the 'pos' position.
333 @param[in] pos position of the multi-value array, default value
334 will always start from 0
335 @return the first index entry to handle, the one including null
336 multi-value field, or the multi-value data at the 'pos' position */
337 dtuple_t *begin(uint32_t pos = 0) {
339 return (nullptr);
340 }
341
343 ut_ad(m_entry != nullptr);
344
345 m_pos = pos;
346 return (m_mv_data == nullptr ? m_entry : next());
347 }
348
349 /** Get next index entry based on next multi-value data.
350 If the previous value is null, then always no next.
351 @return next index entry, or nullptr if no more multi-value data */
353 if (m_mv_data == nullptr || m_pos >= m_mv_data->num_v) {
354 return (nullptr);
355 }
356
357 ut_ad(m_entry != nullptr);
360
361 if (m_selected && (skip() == m_mv_data->num_v)) {
362 return (nullptr);
363 }
364
365 const auto len = m_mv_data->data_len[m_pos];
366 dfield_set_data(field, m_mv_data->datap[m_pos], len);
367
368 ++m_pos;
369 return (m_entry);
370 }
371
372 /** Get the position of last generated multi-value data
373 @return the position */
374 uint32_t last_multi_value_position() const {
375 return (m_pos > 0 ? m_pos - 1 : 0);
376 }
377
378 protected:
379 /** Find the multi-value field from the passed in entry or row.
380 m_mv_field_no should be set once the multi-value field found.
381 @return the multi-value field pointer, or nullptr if not found */
383
384 /** Prepare the corresponding multi-value field from the row.
385 This function will set the m_mv_data if the proper field found.
386 @return true if the multi-value field with data on index found,
387 otherwise, false */
390
391 if (field == nullptr || field->len == UNIV_NO_INDEX_VALUE) {
392 return (false);
393 }
394
395 ut_ad(m_mv_field_no > 0);
397
399
400 if (!dfield_is_null(field)) {
401 m_mv_data = static_cast<multi_value_data *>(field->data);
402 }
403
404 return (true);
405 }
406
407 /** Prepare the entry when the entry is not passed in */
408 virtual void prepare_entry_if_necessary() { return; }
409
410 /** Skip the not selected values and stop m_pos at the next selected one
411 @return the next valid value position, or size of m_mv_data to indicate
412 there is no more valid value */
413 virtual uint32_t skip() {
414 ut_ad(m_mv_data != nullptr);
416 return (m_mv_data->num_v);
417 }
418
419 protected:
420 /** Based on which index to build the entry */
422
423 /** True if only the selected(bitmap set) multi-value data would be
424 used to build the entries, otherwise false. */
425 const bool m_selected;
426
427 /** Entry built for the index */
429
430 /** Multi-value data position */
431 uint32_t m_pos;
432
433 /** Multi-value data */
435
436 /** Field number of multi-value data on the index */
438};
439
440/** The subclass of the multi-value entry builder, for non-INSERT cases,
441With this class, there should be no need to build separate entries for
442different values in the same multi-value field. */
444 public:
445 /** Constructor
446 @param[in] row based on which complete row to build
447 the index row
448 @param[in] ext externally stored column prefixes of
449 the row
450 @param[in,out] index multi-value index
451 @param[in,out] heap memory heap
452 @param[in] check true if type can be checked, otherwise
453 skip checking
454 @param[in] selected true if only the selected(bitmap set)
455 multi-value data would be used to build
456 the entries, otherwise false. */
458 dict_index_t *index, mem_heap_t *heap,
459 bool check, bool selected)
460 : Multi_value_entry_builder(index, nullptr, selected),
461 m_row(row),
462 m_ext(ext),
463 m_heap(heap),
464 m_check(check) {}
465
466 private:
467 /** Find the multi-value field from the passed in entry or row.
468 m_mv_field_no should be set once the multi-value field found.
469 @return the multi-value field pointer, or nullptr if not found */
471
472 /** Prepare the entry when the entry is not passed in */
474 if (m_check) {
476 } else {
477 /* If not check, then it's basically coming from purge. And actually,
478 for multi-value index, this flag really doesn't matter. */
481 }
482 }
483
484 /** Skip the not selected values and stop m_pos at the next selected one
485 @return the next valid value position, or size of m_mv_data to indicate
486 there is no more valid value */
487 uint32_t skip() override {
489
490 if (m_mv_data->bitset == nullptr) {
491 return (m_pos);
492 }
493
494 while (m_pos < m_mv_data->num_v && !m_mv_data->bitset->test(m_pos)) {
495 ++m_pos;
496 }
497
498 return (m_pos);
499 }
500
501 private:
502 /** Based on which complete row to build the index row */
504
505 /** Externally stored column prefixes, or nullptr */
507
508 /** Memory heap */
510
511 /** True if dfield type should be checked, otherwise false */
512 const bool m_check;
513};
514
515/** The subclass of the multi-value row builder, for INSERT cases.
516It simply replace the pointers to the multi-value field data for
517each different value */
519 public:
520 /** Constructor
521 @param[in,out] index multi-value index
522 @param[in] entry entry to insert based on the index */
524 : Multi_value_entry_builder(index, entry, false) {}
525
526 private:
527 /** Find the multi-value field from the passed entry in or row.
528 m_mv_field_no should be set once the multi-value field found.
529 @return the multi-value field pointer, or nullptr if not found */
531 uint16_t i = 0;
532 dfield_t *field = nullptr;
533
534 ut_ad(m_entry != nullptr);
535
536 m_mv_field_no = 0;
537 for (; i < m_entry->n_fields; ++i) {
538 field = &m_entry->fields[i];
539 if (!dfield_is_multi_value(field)) {
540 continue;
541 }
542
543 m_mv_field_no = i + 1;
544 break;
545 }
546
547 return (i == m_entry->n_fields ? nullptr : field);
548 }
549};
550
551#include "row0row.ic"
552
553#endif
The index tree general types.
bool test(size_t pos) const
Test if the specified bit is set or not.
Definition: ut0bitset.h:82
The subclass of the multi-value row builder, for INSERT cases.
Definition: row0row.h:518
dfield_t * find_multi_value_field() override
Find the multi-value field from the passed entry in or row.
Definition: row0row.h:530
Multi_value_entry_builder_insert(dict_index_t *index, dtuple_t *entry)
Constructor.
Definition: row0row.h:523
The subclass of the multi-value entry builder, for non-INSERT cases, With this class,...
Definition: row0row.h:443
const row_ext_t * m_ext
Externally stored column prefixes, or nullptr.
Definition: row0row.h:506
dfield_t * find_multi_value_field() override
Find the multi-value field from the passed in entry or row.
Definition: row0row.cc:1150
const dtuple_t * m_row
Based on which complete row to build the index row.
Definition: row0row.h:503
void prepare_entry_if_necessary() override
Prepare the entry when the entry is not passed in.
Definition: row0row.h:473
mem_heap_t * m_heap
Memory heap.
Definition: row0row.h:509
uint32_t skip() override
Skip the not selected values and stop m_pos at the next selected one.
Definition: row0row.h:487
Multi_value_entry_builder_normal(const dtuple_t *row, const row_ext_t *ext, dict_index_t *index, mem_heap_t *heap, bool check, bool selected)
Constructor.
Definition: row0row.h:457
const bool m_check
True if dfield type should be checked, otherwise false.
Definition: row0row.h:512
Class to build a series of entries based on one multi-value field.
Definition: row0row.h:317
virtual dfield_t * find_multi_value_field()=0
Find the multi-value field from the passed in entry or row.
dtuple_t * begin(uint32_t pos=0)
Get the first index entry.
Definition: row0row.h:337
uint32_t last_multi_value_position() const
Get the position of last generated multi-value data.
Definition: row0row.h:374
const multi_value_data * m_mv_data
Multi-value data.
Definition: row0row.h:434
dtuple_t * m_entry
Entry built for the index.
Definition: row0row.h:428
const bool m_selected
True if only the selected(bitmap set) multi-value data would be used to build the entries,...
Definition: row0row.h:425
dtuple_t * next()
Get next index entry based on next multi-value data.
Definition: row0row.h:352
virtual ~Multi_value_entry_builder()=default
Multi_value_entry_builder(dict_index_t *index, dtuple_t *entry, bool selected)
Constructor.
Definition: row0row.h:320
dict_index_t * m_index
Based on which index to build the entry.
Definition: row0row.h:421
uint32_t m_pos
Multi-value data position.
Definition: row0row.h:431
virtual bool prepare_multi_value_field()
Prepare the corresponding multi-value field from the row.
Definition: row0row.h:388
virtual uint32_t skip()
Skip the not selected values and stop m_pos at the next selected one.
Definition: row0row.h:413
uint32_t m_mv_field_no
Field number of multi-value data on the index.
Definition: row0row.h:437
virtual void prepare_entry_if_necessary()
Prepare the entry when the entry is not passed in.
Definition: row0row.h:408
constexpr DWORD buf_size
Definition: create_def.cc:227
SQL data field and tuple.
static void dfield_set_data(dfield_t *field, const void *data, ulint len)
Sets pointer to the data and length in a field.
static dfield_t * dtuple_get_nth_field(const dtuple_t *tuple, ulint n)
Gets nth field of a tuple.
static bool dfield_is_multi_value(const dfield_t *field)
Determine if a field is of multi-value type.
static ulint dfield_is_null(const dfield_t *field)
Determines if a field is SQL NULL.
Data dictionary global types.
char * pos
Definition: do_ctype.cc:76
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
static int flag
Definition: hp_test1.cc:39
Mini-transaction buffer.
Definition: buf0block_hint.cc:29
PT & ref(PT *tp)
Definition: tablespace_impl.cc:358
Json_data_extension ext
Definition: backend.cc:50
mode
Definition: file_handle.h:59
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2873
Query graph global types.
Record manager global types.
byte rec_t
Definition: rem0types.h:40
required string type
Definition: replication_group_member_actions.proto:33
static dtuple_t * row_build_index_entry(const dtuple_t *row, const row_ext_t *ext, const dict_index_t *index, mem_heap_t *heap)
When an insert or purge to a table is performed, this function builds the entry to be inserted into o...
dtuple_t * row_build_row_ref(ulint type, const dict_index_t *index, const rec_t *rec, mem_heap_t *heap)
Builds from a secondary index record a row reference with which we can search the clustered index rec...
Definition: row0row.cc:654
static roll_ptr_t row_get_rec_roll_ptr(const rec_t *rec, const dict_index_t *index, const ulint *offsets)
Reads the roll pointer field from a clustered index record.
dtuple_t * row_build_w_add_vcol(ulint type, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const dict_table_t *col_table, const dtuple_t *add_cols, const dict_add_v_col_t *add_v, const ulint *col_map, row_ext_t **ext, mem_heap_t *heap)
An inverse function to row_build_index_entry.
Definition: row0row.cc:548
constexpr uint32_t ROW_BUILD_NORMAL
build index row
Definition: row0row.h:70
bool row_search_on_row_ref(btr_pcur_t *pcur, ulint mode, dict_table_t *table, const dtuple_t *ref, mtr_t *mtr)
Searches the clustered index record for a row, if we have the row reference.
Definition: row0row.cc:828
constexpr uint32_t ROW_BUILD_FOR_INSERT
build row for insert.
Definition: row0row.h:76
dtuple_t * row_rec_to_index_entry_low(const rec_t *rec, const dict_index_t *index, const ulint *offsets, mem_heap_t *heap)
Converts an index record to a typed data tuple.
Definition: row0row.cc:562
uint64_t row_parse_int(const byte *data, ulint len, ulint mtype, bool unsigned_type)
Parse the integer data from specified data, which could be DATA_INT, DATA_FLOAT or DATA_DOUBLE.
Definition: row0row.ic:148
ulint row_raw_format(const char *data, ulint data_len, const dict_field_t *dict_field, char *buf, ulint buf_size)
Formats the raw data in "data" (in InnoDB on-disk format) using "dict_field" and writes the result to...
Definition: row0row.cc:1081
dtuple_t * row_rec_to_index_entry(const rec_t *rec, const dict_index_t *index, const ulint *offsets, mem_heap_t *heap)
Converts an index record to a typed data tuple.
Definition: row0row.cc:620
dtuple_t * row_build(ulint type, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const dict_table_t *col_table, const dtuple_t *add_cols, const ulint *col_map, row_ext_t **ext, mem_heap_t *heap)
An inverse function to row_build_index_entry.
Definition: row0row.cc:517
constexpr uint32_t ROW_COPY_POINTERS
Definition: row0row.h:292
static trx_id_t row_get_rec_trx_id(const rec_t *rec, const dict_index_t *index, const ulint *offsets)
Reads the trx id field from a clustered index record.
dtuple_t * row_build_index_entry_low(const dtuple_t *row, const row_ext_t *ext, const dict_index_t *index, mem_heap_t *heap, ulint flag)
When an insert or purge to a table is performed, this function builds the entry to be inserted into o...
Definition: row0row.cc:58
uint64_t row_parse_int_from_field(const dfield_t *field)
Parse the integer data from specified field, which could be DATA_INT, DATA_FLOAT or DATA_DOUBLE.
Definition: row0row.cc:906
void row_build_row_ref_in_tuple(dtuple_t *ref, const rec_t *rec, const dict_index_t *index, ulint *offsets)
Builds from a secondary index record a row reference with which we can search the clustered index rec...
Definition: row0row.cc:753
rec_t * row_get_clust_rec(ulint mode, const rec_t *rec, const dict_index_t *index, dict_index_t **clust_index, mtr_t *mtr)
Fetches the clustered index record for a secondary index record.
Definition: row0row.cc:865
enum row_search_result row_search_index_entry(dict_index_t *index, const dtuple_t *entry, ulint mode, btr_pcur_t *pcur, mtr_t *mtr)
Searches an index record.
Definition: row0row.cc:932
constexpr uint32_t ROW_BUILD_FOR_PURGE
build row for purge.
Definition: row0row.h:72
row_search_result
Result of row_search_index_entry.
Definition: row0row.h:269
@ ROW_NOT_DELETED_REF
BTR_DELETE was specified, and row_purge_poss_sec() failed.
Definition: row0row.h:277
@ ROW_NOT_FOUND
record not found
Definition: row0row.h:271
@ ROW_FOUND
the record was found
Definition: row0row.h:270
@ ROW_BUFFERED
one of BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK was specified, the secondary index leaf page was no...
Definition: row0row.h:272
static void row_build_row_ref_fast(dtuple_t *ref, const ulint *map, const rec_t *rec, const ulint *offsets)
Builds from a secondary index record a row reference with which we can search the clustered index rec...
constexpr uint32_t ROW_BUILD_FOR_UNDO
build row for undo.
Definition: row0row.h:74
uint64_t row_get_autoinc_counter(const dtuple_t *row, ulint n)
Read the autoinc counter from the clustered index row.
Definition: row0row.cc:924
constexpr uint32_t ROW_COPY_DATA
Definition: row0row.h:291
static ulint row_get_trx_id_offset(const dict_index_t *index, const ulint *offsets)
Gets the offset of the DB_TRX_ID field, in bytes relative to the origin of a clustered index record.
General row routines.
Row operation global types.
Definition: completion_hash.h:34
Definition: btr0pcur.h:98
Structure for an SQL data field.
Definition: data0data.h:604
unsigned len
data length; UNIV_SQL_NULL if SQL null
Definition: data0data.h:610
void * data
pointer to data
Definition: data0data.h:605
Data structure for newly added virtual column in a table.
Definition: dict0mem.h:810
Data structure for a field in an index.
Definition: dict0mem.h:870
Data structure for an index.
Definition: dict0mem.h:1021
Data structure for a database table.
Definition: dict0mem.h:1884
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:681
uint16_t n_fields
Number of fields in dtuple.
Definition: data0data.h:687
dfield_t * fields
Fields.
Definition: data0data.h:695
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:299
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:181
Structure to hold number of multiple values.
Definition: data0data.h:383
const void ** datap
points to different value
Definition: data0data.h:386
uint32_t num_v
number of values
Definition: data0data.h:395
Bitset * bitset
Bitset to indicate which data should be handled for current data array.
Definition: data0data.h:407
uint32_t * data_len
each individual value length
Definition: data0data.h:389
Prefixes of externally stored columns.
Definition: row0ext.h:94
Transaction system global type definitions.
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:137
ib_id_t roll_ptr_t
Rollback pointer (DB_ROLL_PTR, DATA_ROLL_PTR)
Definition: trx0types.h:139
Version control for database, common definitions, and include files.
constexpr auto UNIV_NO_INDEX_VALUE
The following number as the length of a logical field means that no attribute value for the multi-val...
Definition: univ.i:471
unsigned long int ulint
Definition: univ.i:407
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
int n
Definition: xcom_base.cc:505