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