MySQL 8.2.0
Source Code Documentation
table_session_variables.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef TABLE_SESSION_VARIABLES_H
24#define TABLE_SESSION_VARIABLES_H
25
26/**
27 @file storage/perfschema/table_session_variables.h
28 Table SESSION_VARIABLES (declarations).
29*/
30
31#include <sys/types.h>
32
33#include "my_base.h"
34#include "my_inttypes.h"
39
40class Field;
41class Plugin_table;
42struct TABLE;
43struct THR_LOCK;
44/**
45 @addtogroup performance_schema_tables
46 @{
47*/
48
50 public:
52 : PFS_engine_index(&m_key), m_key("VARIABLE_NAME") {}
53
54 ~PFS_index_session_variables() override = default;
55
56 virtual bool match(const System_variable *pfs);
57
58 private:
60};
61
62/**
63 A row of table
64 PERFORMANCE_SCHEMA.SESSION_VARIABLES.
65*/
67 /** Column VARIABLE_NAME. */
69 /** Column VARIABLE_VALUE. */
71};
72
73/** Table PERFORMANCE_SCHEMA.SESSION_VARIABLES. */
76
77 public:
78 /** Table share */
81 static ha_rows get_row_count();
82
83 void reset_position() override;
84
85 int rnd_init(bool scan) override;
86 int rnd_next() override;
87 int rnd_pos(const void *pos) override;
88
89 int index_init(uint idx, bool sorted) override;
90 int index_next() override;
91
92 protected:
93 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
94 bool read_all) override;
96
97 public:
98 ~table_session_variables() override = default;
99
100 protected:
101 int make_row(const System_variable *system_var);
102
103 private:
104 /** Table share lock. */
106 /** Table definition. */
108
109 /** Current THD variables. */
111 /** Current row. */
113 /** Current position. */
115 /** Next position. */
117
119};
120
121/** @} */
122#endif
Definition: field.h:576
Definition: pfs_engine_table.h:299
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_session_variables.h:49
virtual bool match(const System_variable *pfs)
Definition: table_session_variables.cc:46
PFS_key_variable_name m_key
Definition: table_session_variables.h:59
PFS_index_session_variables()
Definition: table_session_variables.h:51
~PFS_index_session_variables() override=default
Definition: table_helper.h:1549
System variable cache.
Definition: pfs_variable.h:605
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
System variable derived from sys_var object.
Definition: pfs_variable.h:168
Table PERFORMANCE_SCHEMA.SESSION_VARIABLES.
Definition: table_session_variables.h:74
PFS_simple_index pos_t
Definition: table_session_variables.h:75
static PFS_engine_table_share m_share
Table share.
Definition: table_session_variables.h:79
static ha_rows get_row_count()
Definition: table_session_variables.cc:91
pos_t m_pos
Current position.
Definition: table_session_variables.h:114
PFS_index_session_variables * m_opened_index
Definition: table_session_variables.h:118
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_session_variables.cc:115
pos_t m_next_pos
Next position.
Definition: table_session_variables.h:116
~table_session_variables() override=default
row_session_variables m_row
Current row.
Definition: table_session_variables.h:112
int index_next() override
Find key in index, read record.
Definition: table_session_variables.cc:166
static Plugin_table m_table_def
Table definition.
Definition: table_session_variables.h:107
int make_row(const System_variable *system_var)
Definition: table_session_variables.cc:185
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_session_variables.cc:138
int index_init(uint idx, bool sorted) override
Definition: table_session_variables.cc:151
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_session_variables.cc:122
table_session_variables()
Definition: table_session_variables.cc:104
static THR_LOCK m_table_lock
Table share lock.
Definition: table_session_variables.h:105
PFS_system_variable_cache m_sysvar_cache
Current THD variables.
Definition: table_session_variables.h:110
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_session_variables.cc:87
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_session_variables.cc:198
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_session_variables.cc:110
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1139
Some integer typedefs for easier portability.
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: buf0block_hint.cc:29
Performance schema tables (declarations).
Performance schema system and status variables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:65
Performance schema instrumentation (declarations).
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:557
Definition: table_helper.h:1087
Definition: table_helper.h:1100
Definition: table.h:1396
Definition: thr_lock.h:138
A row of table PERFORMANCE_SCHEMA.SESSION_VARIABLES.
Definition: table_session_variables.h:66
PFS_variable_name_row m_variable_name
Column VARIABLE_NAME.
Definition: table_session_variables.h:68
PFS_variable_value_row m_variable_value
Column VARIABLE_VALUE.
Definition: table_session_variables.h:70
Helpers to implement a performance schema table.