MySQL 9.0.0
Source Code Documentation
table_persisted_variables.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TABLE_PERSISTED_VARIABLES_H
25#define TABLE_PERSISTED_VARIABLES_H
26
27/**
28 @file storage/perfschema/table_persisted_variables.h
29 Table PERSISTED_VARIABLES (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
40
41class Field;
42class Plugin_table;
43struct TABLE;
44struct THR_LOCK;
45/**
46 @addtogroup performance_schema_tables
47 @{
48*/
49
51 public:
53 : PFS_engine_index(&m_key), m_key("VARIABLE_NAME") {}
54
55 ~PFS_index_persisted_variables() override = default;
56
57 virtual bool match(const System_variable *pfs);
58
59 private:
61};
62
63/**
64 A row of table
65 PERFORMANCE_SCHEMA.PERSISTED_VARIABLES.
66*/
68 /** Column VARIABLE_NAME. */
70 /** Column VARIABLE_VALUE. */
72};
73
74/** Table PERFORMANCE_SCHEMA.PERSISTED_VARIABLES. */
77
78 public:
79 /** Table share */
82 static ha_rows get_row_count();
83
84 void reset_position() override;
85
86 int rnd_init(bool scan) override;
87 int rnd_next() override;
88 int rnd_pos(const void *pos) override;
89
90 int index_init(uint idx, bool sorted) override;
91 int index_next() override;
92
93 protected:
94 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
95 bool read_all) override;
97
98 public:
99 ~table_persisted_variables() override = default;
100
101 protected:
102 int make_row(const System_variable *system_var);
103
104 private:
105 /** Table share lock. */
107 /** Table definition. */
109
110 /** Current THD variables. */
112 /** Current row. */
114 /** Current position. */
116 /** Next position. */
118
120};
121
122/** @} */
123#endif
Definition: field.h:577
Definition: pfs_engine_table.h:300
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_persisted_variables.h:50
virtual bool match(const System_variable *pfs)
Definition: table_persisted_variables.cc:46
PFS_key_variable_name m_key
Definition: table_persisted_variables.h:60
~PFS_index_persisted_variables() override=default
PFS_index_persisted_variables()
Definition: table_persisted_variables.h:52
Definition: table_helper.h:1579
Persisted variables cache.
Definition: pfs_variable.h:666
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
System variable derived from sys_var object.
Definition: pfs_variable.h:169
Table PERFORMANCE_SCHEMA.PERSISTED_VARIABLES.
Definition: table_persisted_variables.h:75
~table_persisted_variables() override=default
row_persisted_variables m_row
Current row.
Definition: table_persisted_variables.h:113
PFS_index_persisted_variables * m_opened_index
Definition: table_persisted_variables.h:119
table_persisted_variables()
Definition: table_persisted_variables.cc:99
int index_next() override
Find key in index, read record.
Definition: table_persisted_variables.cc:161
pos_t m_pos
Current position.
Definition: table_persisted_variables.h:115
PFS_system_persisted_variables_cache m_sysvar_cache
Current THD variables.
Definition: table_persisted_variables.h:111
static THR_LOCK m_table_lock
Table share lock.
Definition: table_persisted_variables.h:106
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_persisted_variables.cc:134
static ha_rows get_row_count()
Definition: table_persisted_variables.cc:91
int make_row(const System_variable *system_var)
Definition: table_persisted_variables.cc:180
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_persisted_variables.cc:193
static Plugin_table m_table_def
Table definition.
Definition: table_persisted_variables.h:108
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_persisted_variables.cc:87
int index_init(uint idx, bool sorted) override
Definition: table_persisted_variables.cc:147
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_persisted_variables.cc:118
pos_t m_next_pos
Next position.
Definition: table_persisted_variables.h:117
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_persisted_variables.cc:111
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_persisted_variables.cc:106
PFS_simple_index pos_t
Definition: table_persisted_variables.h:76
static PFS_engine_table_share m_share
Table share.
Definition: table_persisted_variables.h:80
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Some integer typedefs for easier portability.
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Performance schema tables (declarations).
Performance schema system and status variables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
Performance schema instrumentation (declarations).
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Definition: table_helper.h:1115
Definition: table_helper.h:1128
Definition: table.h:1407
Definition: thr_lock.h:139
A row of table PERFORMANCE_SCHEMA.PERSISTED_VARIABLES.
Definition: table_persisted_variables.h:67
PFS_variable_name_row m_variable_name
Column VARIABLE_NAME.
Definition: table_persisted_variables.h:69
PFS_variable_value_row m_variable_value
Column VARIABLE_VALUE.
Definition: table_persisted_variables.h:71
Helpers to implement a performance schema table.