MySQL 8.3.0
Source Code Documentation
table_column_iterator.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019, 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24#ifndef _table_column_iterator_h
25#define _table_column_iterator_h
26
27#include "my_bitmap.h" // MY_BITMAP
28#include "sql/field.h" // Field
29#include "sql/table.h" // TABLE
30
31/**
32 @class Table_columns_view
33
34 This template class acts as a container of table columns and encapsulates and
35 abstracts a `TABLE` object field set iteration logic, by providing an iterator
36 interface implementation.
37
38 The template parameter `ExclusionFilter` is a predicate that takes a `TABLE`
39 reference and a column index and returns whether or not the field should be
40 filtered out, more specifically, a signature compatible with:
41
42 std::function<bool (TABLE const*, size_t)>
43
44 This template class accepts an empty parameter set, which provides an
45 unfiltered container and iterates over all the table columns:
46
47 void print_all_fields(TABLE *table) {
48 Table_columns_view<> fields{table};
49
50 for (auto field : fields) {
51 std::cout << field->field_index << ". " << field << std::endl
52 << std::flush;
53 }
54 }
55
56 The template parameter predicate may take the form of a `operator()`:
57
58 class JSON_fields {
59 public:
60 bool operator()(TABLE const *table, size_t column_index) {
61 return table->field[column_index]->type() != MYSQL_TYPE_JSON;
62 }
63
64 void print_json_fields(TABLE *table) {
65 Table_columns_view<JSON_fields &> fields{table, *this};
66 for (auto field : fields) {
67 std::cout << field->field_index << ". " << field << std::endl
68 << std::flush;
69 }
70 }
71 };
72
73 The template parameter predicate may take the form of a lambda function:
74
75 void print_int_fields(TABLE *table) {
76 Table_columns_view<> fields{
77 table, [](TABLE const *table, size_t column_index) -> bool {
78 return table->field[column_index]->type() != MYSQL_TYPE_INT24;
79 }};
80
81 for (auto field : fields) {
82 std::cout << field->field_index << ". " << field << std::endl
83 << std::flush;
84 }
85 }
86
87 The list of generated columns is kept separately in the `TABLE` class, in
88 the `TABLE::vfield` member. Although we could achieve accurate filtering
89 using the above described methods, as a performance optimization, this
90 class allows applying the filter and iteration directly and exclusively
91 on the generated columns. For that we can use the `VFIELDS_ONLY` option:
92
93 void print_virtual_generated_columns(TABLE *table) {
94 Table_columns_view<> fields{
95 table, [](TABLE const *table, size_t column_index) -> bool {
96 return table->field[column_index]->is_virtual_gcol();
97 },
98 Table_columns_view<>::VFIELDS_ONLY
99 };
100
101 for (auto field : fields) {
102 std::cout << field->field_index << ". " << field << std::endl
103 << std::flush;
104 }
105 }
106 */
107template <typename ExclusionFilter = std::function<bool(TABLE const *, size_t)>>
109 public:
110 /**
111 Alias for the predicate type, for readability purposes.
112 */
113 using filter_fn_type = ExclusionFilter;
114
115 /**
116 Default set of options.
117 */
118 static constexpr unsigned long DEFAULTS = 0;
119 /**
120 Request the view excluding filter to operate `TABLE::vfields` instead
121 of the full set.
122 */
123 static constexpr unsigned long VFIELDS_ONLY = 1;
124
125 /**
126 Empty constructor, only available when the predicate type is a lambda
127 function.
128
129 @param options optional parameter for filtering and iterating
130 options. Options should be combined with `|`. Available
131 options are `VFIELDS_ONLY`.
132 */
133 template <typename U = ExclusionFilter>
135 unsigned long options = 0,
136 typename std::enable_if<std::is_same<
137 U, std::function<bool(TABLE const *, size_t)>>::value>::type * =
138 nullptr);
139 /**
140 Constructor that takes the target `TABLE` object, only available when the
141 predicate type is a lambda function.
142
143 @param table reference to the target TABLE object.
144 @param options optional parameter for filtering and iterating
145 options. Options should be combined with `|`. Available
146 options are `VFIELDS_ONLY`.
147 */
148 template <typename U = ExclusionFilter>
150 TABLE const *table, unsigned long options = 0,
151 typename std::enable_if<std::is_same<
152 U, std::function<bool(TABLE const *, size_t)>>::value>::type * =
153 nullptr);
154 /**
155 Constructor which takes a predicate used to filter this container iteration.
156
157 @param filtering_predicate the predicate to filter this container iteration.
158 @param options optional parameter for filtering and iterating
159 options. Options should be combined with `|`. Available
160 options are `VFIELDS_ONLY`.
161 */
162 Table_columns_view(ExclusionFilter filtering_predicate,
163 unsigned long options = 0);
164 /**
165 Constructor which takes the TABLE object whose field set will be iterated
166 and a predicate used to filter this container iteration.
167
168 @param table reference to the target TABLE object.
169 @param filtering_predicate the predicate to filter this container iteration.
170 @param options optional parameter for filtering and iterating
171 options. Options should be combined with `|`. Available
172 options are `VFIELDS_ONLY`.
173 */
174 Table_columns_view(TABLE const *table, ExclusionFilter filtering_predicate,
175 unsigned long options = 0);
176 /**
177 Destructor for the class.
178 */
179 virtual ~Table_columns_view();
180 /**
181 Setter which initializes the internal reference to the TABLE object whose
182 field set will be iterated over.
183
184 @param rhs reference to the target TABLE object
185
186 @return a reference to this object.
187 */
188 virtual Table_columns_view &set_table(const TABLE *rhs);
189 /**
190 Setter which initializes the internal filtering predicate of type
191 `ExclusionFilter`.
192
193 @param rhs reference to the target filtering predicate `ExclusionFilter`
194
195 @return a reference to this object.
196 */
197 virtual Table_columns_view &set_filter(ExclusionFilter rhs);
198
199 // --> Deleted constructors and methods to remove default move/copy semantics
204 // <--
205
206 /**
207 Iterator class to allow iterating over the replicatable fields in a TABLE
208 object field set. It implements the bidirectional iterator concept.
209
210 In order to fully understand this class implementation, please, check the
211 documentation on the Iterator concept requirements within the C++ standard
212 and the STL definition.
213 */
214 class iterator {
215 public:
216 using difference_type = std::ptrdiff_t;
217 using value_type = Field *;
218 using pointer = Field *;
219 using reference = Field *;
220 using iterator_category = std::bidirectional_iterator_tag;
221 /**
222 Constructor for the iterator. It takes the parent Table_columns_view
223 object and the initial positions for the replicated table and for the
224 local table.
225
226 @param parent reference to the target Table_columns_view object.
227 @param pos initial replicated table field set position.
228 @param col initial local table field set position.
229 */
230 explicit iterator(Table_columns_view &parent, long pos, long col);
231 /**
232 Constructor for the iterator. It takes the parent Table_columns_view
233 object and the initial positions for the replicated table and for the
234 local table. It also includes a translation factor so we can get the
235 iterated position in relation to a different set of columns.
236
237 @note When this iterator is used in the context of a replica that is
238 applying an event, the translation offset represents the number of extra
239 columns that the event has to the left of other columns, which the table
240 does not have (if any). So, for example, when the event has a GIPK column
241 to the left, and the replica does not have that, then the offset is 1.
242
243 @param parent reference to the target Table_columns_view object.
244 @param pos initial replicated table field set position.
245 @param col initial local table field set position.
246 @param translation_offset the translation offset for translated_pos()
247 */
248 explicit iterator(Table_columns_view &parent, long pos, long col,
249 long translation_offset);
250 /**
251 Copy constructor.
252
253 @param rhs object instance we pretend to copy from.
254 */
255 iterator(const iterator &rhs);
256 /**
257 Default destructor
258 */
259 virtual ~iterator() = default;
260 // BASIC ITERATOR METHODS //
261 iterator &operator=(const iterator &rhs);
263 reference operator*() const;
264 // END / BASIC ITERATOR METHODS //
265 // INPUT ITERATOR METHODS //
266 iterator operator++(int);
267 pointer operator->() const;
268 bool operator==(iterator rhs) const;
269 bool operator!=(iterator rhs) const;
270 // END / INPUT ITERATOR METHODS //
271
272 // OUTPUT ITERATOR METHODS //
273 // reference operator*() const; <- already defined
274 // iterator operator++(int); <- already defined
275 // END / OUTPUT ITERATOR METHODS //
276 // FORWARD ITERATOR METHODS //
277 // Enable support for both input and output iterator <- already enabled
278 // END / FORWARD ITERATOR METHODS //
279
280 // BIDIRECTIOANL ITERATOR METHODS //
282 iterator operator--(int);
283 // END / BIDIRECTIOANL ITERATOR METHODS //
284 /**
285 Returns the position this iterator object is pointing to, within the
286 local table field set.
287
288 @return the position this object is pointing to, within the local table
289 field set.
290 */
291 size_t absolute_pos();
292 /**
293 Returns the position this iterator relative to the set of table columns
294 which are not excluded by the associated filters
295
296 @return the position this object is pointing to considering the non
297 filtered columns
298 */
299 size_t filtered_pos();
300 /**
301 Returns the position this iterator object is pointing to, within the
302 replicated table field set plus the translation_offset
303
304 @note When this iterator is used in the context of a replica that is
305 applying an event, use translated_pos to get the position within the
306 event."
307
308 @return the position this object is pointing to, within the replicated
309 table field set adjusted to another frame of reference.
310 */
311 size_t translated_pos();
312
313 friend struct TABLE;
314 friend class Table_columns_view;
315
316 private:
317 /** A reference to the instance we wish to iterate over. */
319 /**
320 The position, relative to the TABLE object, this instance iterator is
321 pointing to.
322 */
324 /**
325 The position, relative to the set of included fields, this instance
326 iterator is pointing to.
327 */
329 /**
330 Translation unit used on top of the iterator filtered position, so
331 we can adjust the position to another frame of reference.
332
333 When this iterator is used in the context of a replica that is applying an
334 event, use translated_pos to get the position within the event. This
335 number should be set to N when the event has N extra columns to the left,
336 which do not exist in the replica table.
337 */
339 };
340
341 /**
342 Computes the total number of fields in the table.
343
344 @return the number of fields in the table.
345 */
346 size_t absolute_size() const;
347 /**
348 Computes the total number of fields after filtering.
349
350 @return the number of fields after filtering.
351 */
352 size_t filtered_size() const;
353 /**
354 Creates an iterator object, pointing at the beginning of the table field
355 set.
356
357 @return an iterator pointing to the beginning of the field set.
358 */
359 virtual iterator begin();
360 /**
361 Creates an iterator object, pointing at the end of the table field set.
362
363 @return an iterator pointing to the end of the field set.
364 */
365 virtual iterator end();
366 /**
367 Returns whether or not the field at `index` is to be excluded from the field
368 set iteration process.
369
370 @param index the index of the field to test for exclusion from iteration.
371
372 @return true if the field is to be excluded from the iteration, false
373 otherwise.
374 */
375 bool is_excluded(size_t index) const;
376 /**
377 Returns the bitmap for the columns from the local table set that are to be
378 included in the replicated row.
379
380 @return a bitmap indicating which columns from the local table are to be
381 included in the replicated row.
382 */
384 /**
385 Returns the bitmap for the columns from the local table set that are to be
386 excluded from the replicated row.
387
388 @return a bitmap indicating which columns from the local table are to be
389 excluded from the replicated row.
390 */
392 /**
393 Takes a bitmap object, as received from the replication channel and
394 translates it to a bitmap that matches the local TABLE object.
395
396 @param[in] source the bitmap as received from the replication channel
397 @param[out] destination the bitmap that matches the local TABLE format
398
399 @return this object reference (for chaining purposes).
400 */
402 MY_BITMAP &destination);
403
404 /**
405 For the absolute position on the table that equals the given position given
406 as a parameter, return the translated position.
407
408 @param source the position in the local table
409
410 @return the translated position within the local table.
411 */
412 size_t translate_position(size_t source);
413
414 /**
415 Returns the iterator for the (absolute) position in the table.
416
417 @param absolute_pos the position in the local table
418
419 @return the iterator for the position, if found
420 */
421 iterator find_by_absolute_pos(size_t absolute_pos);
422
423 protected:
424 /**
425 Initializes the internal included and excluded fields bitmaps. After each
426 member is set, this method should be invoked in order to remake the bitmaps.
427
428 @return this object reference (for chaining purposes).
429 */
431
432 private:
433 /**
434 The TABLE object reference which contains the field set to be iterated over.
435 */
436 TABLE const *m_table{nullptr};
437 /**
438 ExclusionFiltering predicate to be invoked when determining if a column is
439 to be included in the iteration.
440 */
441 ExclusionFilter m_filtering_predicate;
442 /** Number of columns to include in iteration. */
444 /**
445 Bitmap that holds the information about which columns from the local table
446 are to be included in the replicated row.
447 */
449 /**
450 Bitmap that holds the information about which columns from the local table
451 are to be excluded from the replicated row.
452 */
454 /**
455 Set of options to apply to view behaviour
456 */
457 unsigned long m_options{0};
458
459 /**
460 Default filtering predicate.
461 */
462 static bool default_filter(TABLE const *table, size_t column_index);
463};
464
465template <typename F>
466template <typename U>
468 unsigned long options,
469 typename std::enable_if<std::is_same<
470 U, std::function<bool(TABLE const *, size_t)>>::value>::type *)
474}
475
476template <typename F>
477template <typename U>
479 TABLE const *table, unsigned long options,
480 typename std::enable_if<std::is_same<
481 U, std::function<bool(TABLE const *, size_t)>>::value>::type *)
485 .set_table(table);
486}
487
488template <typename F>
490 unsigned long options)
491 : Table_columns_view{nullptr, filtering_predicate, options} {}
492
493template <typename F>
495 F filtering_predicate,
496 unsigned long options)
497 : m_filtering_predicate{filtering_predicate}, m_options{options} {
498 this->set_filter(filtering_predicate) //
499 .set_table(target);
500}
501
502template <typename F>
506}
507
508template <typename F>
510 this->m_table = rhs;
511 this->init_fields_bitmaps();
512 return (*this);
513}
514
515template <typename F>
517 this->m_filtering_predicate = rhs;
518 this->init_fields_bitmaps();
519 return (*this);
520}
521
522template <typename F>
524 if (this->m_table == nullptr) return 0;
525 return this->m_table->s->fields;
526}
527
528template <typename F>
530 return this->m_filtered_size;
531}
532
533template <typename F>
535 typename Table_columns_view<F>::iterator to_return{*this, -1, -1};
536 ++to_return;
537 return to_return;
538}
539
540template <typename F>
542 typename Table_columns_view<F>::iterator to_return{
543 *this, static_cast<long>(this->absolute_size()),
544 static_cast<long>(this->filtered_size())};
545 return to_return;
546}
547
548template <typename F>
549bool Table_columns_view<F>::is_excluded(size_t index) const {
550 return bitmap_is_set(&this->m_excluded_fields_bitmap, index);
551}
552
553template <typename F>
555 return this->m_included_fields_bitmap;
556}
557
558template <typename F>
560 return this->m_excluded_fields_bitmap;
561}
562
563template <typename F>
565 MY_BITMAP &source, MY_BITMAP &destination) {
566 if (this->m_table == nullptr) return (*this);
567 if (source.bitmap == nullptr) return (*this);
568
569 bitmap_init(&destination, nullptr, this->m_table->s->fields);
570
571 for (auto it = begin(); it != end(); ++it) {
572 size_t source_pos = it.translated_pos();
573 size_t abs_pos = it.absolute_pos();
574 if (source_pos >= source.n_bits) break;
575 if (bitmap_is_set(&source, static_cast<uint>(source_pos))) {
576 bitmap_set_bit(&destination, static_cast<uint>(abs_pos));
577 }
578 }
579
580 return (*this);
581}
582
583template <typename F>
586 return std::find_if(begin(), end(), [absolute_pos](auto it) {
587 return it->field_index() == absolute_pos;
588 });
589}
590
591template <typename F>
593 for (auto it = begin(); it != end(); ++it) {
594 size_t abs_pos = it.absolute_pos();
595 if (abs_pos == orig_pos) return it.translated_pos();
596 }
597 return orig_pos;
598}
599
600template <typename F>
602 if (this->m_table == nullptr) return (*this);
603
607 this->m_table->s->fields);
609 this->m_table->s->fields);
610
611 this->m_filtered_size = 0;
612 if ((this->m_options & VFIELDS_ONLY) == VFIELDS_ONLY) {
614 for (auto fld = this->m_table->vfield; *fld != nullptr; ++fld) {
615 auto idx = (*fld)->field_index();
616 if (!this->m_filtering_predicate(this->m_table, idx)) {
619 ++this->m_filtered_size;
620 }
621 }
622 } else {
623 for (size_t idx = 0; idx != this->m_table->s->fields; ++idx) {
624 if (this->m_filtering_predicate(this->m_table, idx)) {
626 } else {
628 ++this->m_filtered_size;
629 }
630 }
631 }
632 return (*this);
633}
634
635template <typename F>
637 return false;
638}
639
640template <typename F>
642 long absolute_pos, long filtered_pos)
643 : m_parent{&parent},
644 m_absolute_pos{absolute_pos},
645 m_filtered_pos{filtered_pos},
646 m_translation_offset{0} {}
647
648template <typename F>
650 long absolute_pos, long filtered_pos,
651 long translation_offset)
652 : m_parent{&parent},
653 m_absolute_pos{absolute_pos},
654 m_filtered_pos{filtered_pos},
655 m_translation_offset{translation_offset} {}
656
657template <typename F>
659 (*this) = rhs;
660}
661
662template <typename F>
666 this->m_parent = rhs.m_parent;
667 this->m_absolute_pos = rhs.m_absolute_pos;
668 this->m_filtered_pos = rhs.m_filtered_pos;
669 this->m_translation_offset = rhs.m_translation_offset;
670 return (*this);
671}
672
673template <typename F>
676 if (this->m_parent->m_table != nullptr &&
677 this->m_absolute_pos !=
678 static_cast<long>(this->m_parent->absolute_size())) {
679 do {
680 ++this->m_absolute_pos;
681 } while (this->m_absolute_pos !=
682 static_cast<long>(this->m_parent->absolute_size()) &&
683 this->m_parent->is_excluded(this->m_absolute_pos));
684 ++this->m_filtered_pos;
685 }
686 return (*this);
687}
688
689template <typename F>
692 if (this->m_parent->m_table != nullptr &&
693 this->m_absolute_pos !=
694 static_cast<long>(this->m_parent->absolute_size())) {
695 return this->m_parent->m_table->field[this->m_absolute_pos];
696 }
697 return nullptr;
698}
699
700template <typename F>
703 typename Table_columns_view<F>::iterator to_return = (*this);
704 ++(*this);
705 return to_return;
706}
707
708template <typename F>
711 return this->operator*();
712}
713
714template <typename F>
717 return this->m_absolute_pos == rhs.m_absolute_pos &&
718 this->m_parent->m_table == rhs.m_parent->m_table;
719}
720
721template <typename F>
724 return !((*this) == rhs);
725}
726
727template <typename F>
730 if (this->m_parent->m_table != nullptr && this->m_absolute_pos != 0) {
731 do {
732 --this->m_absolute_pos;
733 } while (this->m_absolute_pos != 0 &&
734 this->m_parent->is_excluded(this->m_absolute_pos));
735 --this->m_filtered_pos;
736 }
737 return (*this);
738}
739
740template <typename F>
743 typename Table_columns_view<F>::iterator to_return = (*this);
744 --(*this);
745 return to_return;
746}
747
748template <typename F>
750 return static_cast<size_t>(this->m_absolute_pos);
751}
752
753template <typename F>
755 return static_cast<size_t>(this->m_filtered_pos);
756}
757
758template <typename F>
760 return static_cast<size_t>(this->m_filtered_pos + this->m_translation_offset);
761}
762
763#endif // _table_column_iterator_h
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:250
Definition: field.h:574
Iterator class to allow iterating over the replicatable fields in a TABLE object field set.
Definition: table_column_iterator.h:214
iterator & operator--()
Definition: table_column_iterator.h:729
reference operator*() const
Definition: table_column_iterator.h:691
std::ptrdiff_t difference_type
Definition: table_column_iterator.h:216
long m_filtered_pos
The position, relative to the set of included fields, this instance iterator is pointing to.
Definition: table_column_iterator.h:328
iterator(Table_columns_view &parent, long pos, long col)
Constructor for the iterator.
Definition: table_column_iterator.h:641
bool operator!=(iterator rhs) const
Definition: table_column_iterator.h:722
size_t absolute_pos()
Returns the position this iterator object is pointing to, within the local table field set.
Definition: table_column_iterator.h:749
iterator & operator++()
Definition: table_column_iterator.h:675
bool operator==(iterator rhs) const
Definition: table_column_iterator.h:715
iterator & operator=(const iterator &rhs)
Definition: table_column_iterator.h:664
Table_columns_view const * m_parent
A reference to the instance we wish to iterate over.
Definition: table_column_iterator.h:318
long m_translation_offset
Translation unit used on top of the iterator filtered position, so we can adjust the position to anot...
Definition: table_column_iterator.h:338
std::bidirectional_iterator_tag iterator_category
Definition: table_column_iterator.h:220
pointer operator->() const
Definition: table_column_iterator.h:710
size_t translated_pos()
Returns the position this iterator object is pointing to, within the replicated table field set plus ...
Definition: table_column_iterator.h:759
virtual ~iterator()=default
Default destructor.
long m_absolute_pos
The position, relative to the TABLE object, this instance iterator is pointing to.
Definition: table_column_iterator.h:323
size_t filtered_pos()
Returns the position this iterator relative to the set of table columns which are not excluded by the...
Definition: table_column_iterator.h:754
This template class acts as a container of table columns and encapsulates and abstracts a TABLE objec...
Definition: table_column_iterator.h:108
static constexpr unsigned long VFIELDS_ONLY
Request the view excluding filter to operate TABLE::vfields instead of the full set.
Definition: table_column_iterator.h:123
Table_columns_view(unsigned long options=0, typename std::enable_if< std::is_same< U, std::function< bool(TABLE const *, size_t)> >::value >::type *=nullptr)
Empty constructor, only available when the predicate type is a lambda function.
Definition: table_column_iterator.h:467
MY_BITMAP & get_included_fields_bitmap()
Returns the bitmap for the columns from the local table set that are to be included in the replicated...
Definition: table_column_iterator.h:554
virtual ~Table_columns_view()
Destructor for the class.
Definition: table_column_iterator.h:503
virtual Table_columns_view & set_table(const TABLE *rhs)
Setter which initializes the internal reference to the TABLE object whose field set will be iterated ...
Definition: table_column_iterator.h:509
ExclusionFilter filter_fn_type
Alias for the predicate type, for readability purposes.
Definition: table_column_iterator.h:113
bool is_excluded(size_t index) const
Returns whether or not the field at index is to be excluded from the field set iteration process.
Definition: table_column_iterator.h:549
virtual iterator end()
Creates an iterator object, pointing at the end of the table field set.
Definition: table_column_iterator.h:541
size_t m_filtered_size
Number of columns to include in iteration.
Definition: table_column_iterator.h:443
virtual iterator begin()
Creates an iterator object, pointing at the beginning of the table field set.
Definition: table_column_iterator.h:534
Table_columns_view & translate_bitmap(MY_BITMAP &source, MY_BITMAP &destination)
Takes a bitmap object, as received from the replication channel and translates it to a bitmap that ma...
Definition: table_column_iterator.h:564
virtual Table_columns_view & set_filter(ExclusionFilter rhs)
Setter which initializes the internal filtering predicate of type ExclusionFilter.
Definition: table_column_iterator.h:516
Table_columns_view(Table_columns_view &&rhs)=delete
MY_BITMAP & get_excluded_fields_bitmap()
Returns the bitmap for the columns from the local table set that are to be excluded from the replicat...
Definition: table_column_iterator.h:559
Table_columns_view(ExclusionFilter filtering_predicate, unsigned long options=0)
Constructor which takes a predicate used to filter this container iteration.
MY_BITMAP m_included_fields_bitmap
Bitmap that holds the information about which columns from the local table are to be included in the ...
Definition: table_column_iterator.h:448
iterator find_by_absolute_pos(size_t absolute_pos)
Returns the iterator for the (absolute) position in the table.
Definition: table_column_iterator.h:585
TABLE const * m_table
The TABLE object reference which contains the field set to be iterated over.
Definition: table_column_iterator.h:436
size_t translate_position(size_t source)
For the absolute position on the table that equals the given position given as a parameter,...
Definition: table_column_iterator.h:592
Table_columns_view & operator=(Table_columns_view &&rhs)=delete
Table_columns_view & operator=(const Table_columns_view &rhs)=delete
Table_columns_view & init_fields_bitmaps()
Initializes the internal included and excluded fields bitmaps.
Definition: table_column_iterator.h:601
static bool default_filter(TABLE const *table, size_t column_index)
Default filtering predicate.
Definition: table_column_iterator.h:636
size_t absolute_size() const
Computes the total number of fields in the table.
Definition: table_column_iterator.h:523
static constexpr unsigned long DEFAULTS
Default set of options.
Definition: table_column_iterator.h:118
ExclusionFilter m_filtering_predicate
ExclusionFiltering predicate to be invoked when determining if a column is to be included in the iter...
Definition: table_column_iterator.h:441
Table_columns_view(TABLE const *table, ExclusionFilter filtering_predicate, unsigned long options=0)
Constructor which takes the TABLE object whose field set will be iterated and a predicate used to fil...
MY_BITMAP m_excluded_fields_bitmap
Bitmap that holds the information about which columns from the local table are to be excluded from th...
Definition: table_column_iterator.h:453
unsigned long m_options
Set of options to apply to view behaviour.
Definition: table_column_iterator.h:457
size_t filtered_size() const
Computes the total number of fields after filtering.
Definition: table_column_iterator.h:529
Table_columns_view(const Table_columns_view &rhs)=delete
int field_index(const char *field_name)
Definition: rules_table_service.cc:151
static void bitmap_set_all(MY_BITMAP *map)
Definition: my_bitmap.h:127
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:94
bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits)
Definition: my_bitmap.cc:139
static void bitmap_clear_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:89
void bitmap_free(MY_BITMAP *map)
Definition: my_bitmap.cc:157
static void bitmap_set_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:79
void * begin(THD *thd, const TABLE *table, size_t data_size, size_t memory, size_t num_threads) noexcept
Definition: bulk_data_service.cc:1533
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: options.cc:56
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:191
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:41
required string type
Definition: replication_group_member_actions.proto:33
Definition: my_bitmap.h:42
my_bitmap_map * bitmap
Definition: my_bitmap.h:43
uint fields
Definition: table.h:843
Definition: table.h:1403
Field ** vfield
Pointer to generated columns.
Definition: table.h:1506
TABLE_SHARE * s
Definition: table.h:1404
Definition: dtoa.cc:588