MySQL  8.0.17
Source Code Documentation
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.
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.
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.
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  GNU General Public License, version 2.0, for more details.
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 */
25 #include <sys/types.h>
26 #include <memory>
27 #include <string>
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"
37 class QEP_TAB;
38 class THD;
39 struct TABLE;
41 struct READ_RECORD {
42  RowIterator *operator->() { return iterator.get(); }
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.)
68  // Used for unique, for now.
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.
78  // Same, when we have sorting _and_ filtering.
81  // Same technique as sort_holder, when we have an AlternativeIterator.
83 };
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);
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);
94 void setup_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, uint idx,
95  bool reverse, QEP_TAB *qep_tab);
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: 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.
unsigned int uint
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
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
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...
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