MySQL 26.10.0
Source Code Documentation
table_base.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2026, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free 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,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TABLE_BASE_INCLUDED
25#define TABLE_BASE_INCLUDED
26
27/* Common header for all Health Monitor tables. */
28
29#include "component_table.h"
31
32namespace hm {
33
36 void reset() { m_index = 0; }
37 void set_at(const table_base_pos *other) { m_index = other->m_index; }
38 void set_after(const table_base_pos *other) { m_index = other->m_index + 1; }
39 // Record id, zero-based
40 unsigned int m_index;
41};
42
44 public:
46
47 table_base() = default;
48 virtual ~table_base() = default;
49
50 table_base(const table_base &) = default;
51 table_base &operator=(const table_base &) = default;
52 table_base(table_base &&) = default;
54
55 virtual int rnd_init(bool /*scan*/) { return 0; }
56 virtual int rnd_next() = 0;
57 virtual int rnd_pos() = 0;
58 virtual void reset_position() { m_pos.reset(); }
59 virtual int read_column_value(PSI_field *field, unsigned int index) = 0;
60 virtual void close_table() {}
61
62 /* C interface */
63 static int rnd_init(PSI_table_handle *handle, bool /*scan*/);
64 static int rnd_next(PSI_table_handle *handle);
65 static int rnd_pos(PSI_table_handle *handle);
68 unsigned int index);
70
73};
74
75} // namespace hm
76
77#endif // TABLE_BASE_INCLUDED
Definition: table_base.h:43
virtual void close_table()
Definition: table_base.h:60
virtual int rnd_pos()=0
table_base()=default
virtual int read_column_value(PSI_field *field, unsigned int index)=0
pos_t m_next_pos
Definition: table_base.h:72
virtual ~table_base()=default
table_base(table_base &&)=default
virtual int rnd_init(bool)
Definition: table_base.h:55
virtual void reset_position()
Definition: table_base.h:58
table_base_pos pos_t
Definition: table_base.h:45
pos_t m_pos
Definition: table_base.h:71
table_base(const table_base &)=default
table_base & operator=(const table_base &)=default
table_base & operator=(table_base &&)=default
virtual int rnd_next()=0
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
Definition: component_command.h:29
static int handle(int sql_errno, const char *sqlstate, const char *message, void *state)
Bridge function between the C++ API offered by this module and the C API of the parser service.
Definition: services.cc:64
struct PSI_table_handle PSI_table_handle
This is an opaque structure to denote table handle in plugin/component code.
Definition: pfs_plugin_table_service.h:97
struct PSI_field PSI_field
This is an opaque structure to denote field in plugin/component code.
Definition: pfs_plugin_table_service.h:93
Definition: table_base.h:34
table_base_pos()
Definition: table_base.h:35
void reset()
Definition: table_base.h:36
void set_after(const table_base_pos *other)
Definition: table_base.h:38
void set_at(const table_base_pos *other)
Definition: table_base.h:37
unsigned int m_index
Definition: table_base.h:40