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