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