MySQL 9.0.0
Source Code Documentation
indexed_column.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify it under
4the terms of the GNU General Public License, version 2.0, as published by the
5Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
18for more details.
19
20You should have received a copy of the GNU General Public License along with
21this program; if not, write to the Free Software Foundation, Inc.,
2251 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/** @file storage/temptable/include/temptable/indexed_column.h
25TempTable Indexed Column. */
26
27#ifndef TEMPTABLE_INDEXED_COLUMN_H
28#define TEMPTABLE_INDEXED_COLUMN_H
29
30#include <cstddef>
31
33#include "sql/field.h"
34#include "sql/key.h"
36
37namespace temptable {
38
40 public:
41 /** Default constructor used for std::array initialization in Index. */
42 Indexed_column() = default;
43
44 explicit Indexed_column(const KEY_PART_INFO &mysql_key_part);
45
46 size_t field_index() const;
47
48 uint32_t prefix_length() const;
49
50 const Cell_calculator &cell_calculator() const;
51
52 private:
53 /** The position of the indexed column. It can range from 1 to MAX_FIELDS.
54 Use an appropriate datatype that can hold these values. */
58};
59
60/* Implementation of inlined methods. */
61
62inline Indexed_column::Indexed_column(const KEY_PART_INFO &mysql_key_part)
63 : m_mysql_field_index(static_cast<decltype(m_mysql_field_index)>(
64 mysql_key_part.field->field_index())),
65 m_prefix_length(mysql_key_part.length),
66 m_cell_calculator(mysql_key_part) {
67 assert(mysql_key_part.field->field_index() <=
68 std::numeric_limits<decltype(m_mysql_field_index)>::max());
69}
70
71inline size_t Indexed_column::field_index() const {
73}
74
75inline uint32_t Indexed_column::prefix_length() const {
76 return m_prefix_length;
77}
78
80 return m_cell_calculator;
81}
82
83} /* namespace temptable */
84
85#endif /* TEMPTABLE_INDEXED_COLUMN_H */
TempTable Cell_calculator declaration.
uint16 field_index() const
Returns field index.
Definition: field.h:1840
Definition: key.h:57
Field * field
Definition: key.h:59
Utility to perform calculations for a cell.
Definition: cell_calculator.h:44
Definition: indexed_column.h:39
uint16_t m_mysql_field_index
The position of the indexed column.
Definition: indexed_column.h:55
const Cell_calculator & cell_calculator() const
Definition: indexed_column.h:79
Cell_calculator m_cell_calculator
Definition: indexed_column.h:57
size_t field_index() const
Definition: indexed_column.h:71
uint32_t prefix_length() const
Definition: indexed_column.h:75
uint32_t m_prefix_length
Definition: indexed_column.h:56
Indexed_column()=default
Default constructor used for std::array initialization in Index.
A better implementation of the UNIX ctype(3) library.
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Definition: allocator.h:45