MySQL  8.0.17
Source Code Documentation
records.h
Go to the documentation of this file.
1 #ifndef SQL_RECORDS_H
2 #define SQL_RECORDS_H
3 /* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License, version 2.0,
7  as published by the Free Software Foundation.
8 
9  This program is also distributed with certain software (including
10  but not limited to OpenSSL) that is licensed under separate terms,
11  as designated in a particular file or component or in included license
12  documentation. The authors of MySQL hereby grant you an additional
13  permission to link the program and your derivative works with the
14  separately licensed software that they have included with MySQL.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License, version 2.0, for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24 
25 #include <sys/types.h>
26 #include <memory>
27 #include <string>
28 
29 #include "my_alloc.h"
30 #include "my_base.h"
33 #include "sql/ref_row_iterators.h"
34 #include "sql/row_iterator.h"
35 #include "sql/sorting_iterator.h"
36 
37 class QEP_TAB;
38 class THD;
39 struct TABLE;
40 
41 struct READ_RECORD {
42  RowIterator *operator->() { return iterator.get(); }
43 
45 
46  // Holds one out of all RowIterator implementations (except the ones used
47  // for filesort, which are in sort_holder), so that it is possible to
48  // initialize a RowIterator without heap allocations. (The iterator
49  // member typically points to this union, and is responsible for
50  // running the right destructor.)
54 
67 
68  // Used for unique, for now.
72 
73  // Same, when we have sorting. If we sort, SortingIterator will be
74  // responsible for destroying the inner object, but the memory will still be
75  // held in iterator_holder, so we can't put this in the union.
77 
78  // Same, when we have sorting _and_ filtering.
80 
81  // Same technique as sort_holder, when we have an AlternativeIterator.
83 };
84 
85 void setup_read_record(READ_RECORD *info, THD *thd, TABLE *table,
86  QEP_TAB *qep_tab, bool disable_rr_cache,
87  bool ignore_not_found_rows, ha_rows *examined_rows);
88 
89 /** Calls setup_read_record(), then calls Init() on the resulting iterator. */
90 bool init_read_record(READ_RECORD *info, THD *thd, TABLE *table,
91  QEP_TAB *qep_tab, bool disable_rr_cache,
92  bool ignore_not_found_rows);
93 
94 void setup_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, uint idx,
95  bool reverse, QEP_TAB *qep_tab);
96 
97 #endif /* SQL_RECORDS_H */
unique_ptr_destroy_only< RowIterator > iterator
Definition: records.h:44
Scan a table from beginning to end.
Definition: basic_row_iterators.h:57
RangeReverse< Range > reverse(Range &x)
Iterate over a range in reverse.
Definition: utilities.h:135
Fetch the record IDs from a memory buffer, but the records themselves from the table on disk...
Definition: basic_row_iterators.h:198
RefIterator< false > ref
Definition: records.h:59
char alternative_holder[sizeof(AlternativeIterator)]
Definition: records.h:82
Definition: records.h:41
A context for reading through a single table using a chosen access method: index read...
Definition: row_iterator.h:59
Row iterators that scan a single table without reference to other tables or iterators.
Like RefIterator, but used in situations where we&#39;re guaranteed to have exactly zero or one rows for ...
Definition: ref_row_iterators.h:91
RefOrNullIterator ref_or_null
Definition: records.h:61
Scan a given range of the table (a “quick”), using an index.
Definition: basic_row_iterators.h:123
void setup_read_record(READ_RECORD *info, THD *thd, TABLE *table, QEP_TAB *qep_tab, bool disable_rr_cache, bool ignore_not_found_rows, ha_rows *examined_rows)
setup_read_record is used to scan by using a number of different methods.
Definition: records.cc:213
Definition: table.h:1294
Read a table assumed to be included in execution of a pushed join.
Definition: ref_row_iterators.h:220
Fetch the record IDs from a temporary file, then the records themselves from the table on disk...
Definition: basic_row_iterators.h:261
char sort_holder[sizeof(SortingIterator)]
Definition: records.h:76
TableScanIterator table_scan
Definition: records.h:55
This file includes constants used by all storage engines.
IndexScanIterator< true > index_scan_reverse
Definition: records.h:56
IndexScanIterator< false > index_scan
Definition: records.h:57
ConstIterator const_table
Definition: records.h:63
bool init_read_record(READ_RECORD *info, THD *thd, TABLE *table, QEP_TAB *qep_tab, bool disable_rr_cache, bool ignore_not_found_rows)
Calls setup_read_record(), then calls Init() on the resulting iterator.
Definition: records.cc:265
unsigned int uint
Definition: uca-dump.cc:29
DynamicRangeIterator dynamic_range_scan
Definition: records.h:65
An iterator that takes in a stream of rows and passes through only those that meet some criteria (i...
Definition: composite_iterators.h:69
An iterator that switches between another iterator (typically a RefIterator or similar) and a TableSc...
Definition: ref_row_iterators.h:246
RowIterator * operator->()
Definition: records.h:42
A composite row iterator is one that takes in one or more existing iterators and processes their rows...
Definition: ref_row_iterators.h:168
IteratorHolder()
Definition: records.h:52
char sort_condition_holder[sizeof(FilterIterator)]
Definition: records.h:79
SortBufferIndirectIterator sort_buffer_indirect
Definition: records.h:69
Definition: sql_executor.h:406
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:404
EQRefIterator eq_ref
Definition: records.h:62
~IteratorHolder()
Definition: records.h:53
FullTextSearchIterator fts
Definition: records.h:64
An iterator that does a search through a full-text index.
Definition: ref_row_iterators.h:138
void setup_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, uint idx, bool reverse, QEP_TAB *qep_tab)
Initialize READ_RECORD structure to perform full index scan in desired direction using the RowIterato...
Definition: records.cc:73
An adapter that takes in another RowIterator and produces the same rows, just in sorted order...
Definition: sorting_iterator.h:53
An iterator that reads from a table where only a single row is known to be matching, no matter what&#39;s on the left side, i.e., WHERE column=<const>.
Definition: ref_row_iterators.h:113
Definition: records.h:51
Log info(cout, "NOTE")
PushedJoinRefIterator pushed_join_ref
Definition: records.h:66
SortFileIndirectIterator sort_file_indirect
Definition: records.h:70
union READ_RECORD::IteratorHolder iterator_holder
Like RefIterator, but after it&#39;s returned all its rows, will also search for rows that match NULL...
Definition: ref_row_iterators.h:67
RefIterator< true > ref_reverse
Definition: records.h:60
my_off_t ha_rows
Definition: my_base.h:1130
IndexRangeScanIterator index_range_scan
Definition: records.h:58
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777