MySQL 8.3.0
Source Code Documentation
table_status_by_account.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_STATUS_BY_ACCOUNT_H
24#define TABLE_STATUS_BY_ACCOUNT_H
25
26/**
27 @file storage/perfschema/table_status_by_account.h
28 Table STATUS_BY_ACCOUNT (declarations).
29*/
30
31#include <sys/types.h>
32
33#include "my_base.h"
34#include "my_inttypes.h"
40
41class Field;
42class Plugin_table;
43struct PFS_account;
44struct TABLE;
45struct THR_LOCK;
46
47/**
48 @addtogroup performance_schema_tables
49 @{
50*/
51
52/**
53 A row of table
54 PERFORMANCE_SCHEMA.STATUS_BY_ACCOUNT.
55*/
57 /** Column USER, HOST. */
59 /** Column VARIABLE_NAME. */
61 /** Column VARIABLE_VALUE. */
63};
64
65/**
66 Position of a cursor on
67 PERFORMANCE_SCHEMA.STATUS_BY_ACCOUNT.
68 Index 1 on account (0 based)
69 Index 2 on status variable (0 based)
70*/
73
74 inline void reset() {
75 m_index_1 = 0;
76 m_index_2 = 0;
77 }
78
79 inline bool has_more_account() {
81 }
82
83 inline void next_account() {
84 m_index_1++;
85 m_index_2 = 0;
86 }
87};
88
90 public:
93 m_key_1("USER"),
94 m_key_2("HOST"),
95 m_key_3("VARIABLE_NAME") {}
96
97 ~PFS_index_status_by_account() override = default;
98
99 virtual bool match(PFS_account *pfs);
100 virtual bool match(const Status_variable *pfs);
101
102 private:
106};
107
108/** Table PERFORMANCE_SCHEMA.STATUS_BY_ACCOUNT. */
111
112 public:
113 /** Table share */
116 static int delete_all_rows();
117 static ha_rows get_row_count();
118
119 void reset_position() override;
120
121 int rnd_init(bool scan) override;
122 int rnd_next() override;
123 int rnd_pos(const void *pos) override;
124
125 int index_init(uint idx, bool sorted) override;
126 int index_next() override;
127
128 protected:
129 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
130 bool read_all) override;
132
133 public:
134 ~table_status_by_account() override = default;
135
136 protected:
137 int make_row(PFS_account *pfs_account, const Status_variable *status_var);
138
139 private:
140 /** Table share lock. */
142 /** Table definition. */
144
145 /** Status variable cache for one account. */
147
148 /** Current row. */
150 /** Current position. */
152 /** Next position. */
154
156};
157
158/** @} */
159#endif
Definition: field.h:574
size_t get_row_count()
Definition: pfs_buffer_container.h:464
Definition: pfs_engine_table.h:299
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:69
Definition: table_status_by_account.h:89
virtual bool match(PFS_account *pfs)
Definition: table_status_by_account.cc:80
PFS_index_status_by_account()
Definition: table_status_by_account.h:91
PFS_key_user m_key_1
Definition: table_status_by_account.h:103
PFS_key_variable_name m_key_3
Definition: table_status_by_account.h:105
PFS_key_host m_key_2
Definition: table_status_by_account.h:104
~PFS_index_status_by_account() override=default
Definition: table_helper.h:1503
Definition: table_helper.h:1491
Definition: table_helper.h:1576
Status variable cache.
Definition: pfs_variable.h:677
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:39
Status variable derived from SHOW_VAR.
Definition: pfs_variable.h:207
Table PERFORMANCE_SCHEMA.STATUS_BY_ACCOUNT.
Definition: table_status_by_account.h:109
PFS_status_variable_cache m_status_cache
Status variable cache for one account.
Definition: table_status_by_account.h:146
pos_status_by_account pos_t
Definition: table_status_by_account.h:110
int make_row(PFS_account *pfs_account, const Status_variable *status_var)
Definition: table_status_by_account.cc:228
int index_init(uint idx, bool sorted) override
Definition: table_status_by_account.cc:181
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_status_by_account.cc:134
pos_t m_next_pos
Next position.
Definition: table_status_by_account.h:153
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_status_by_account.cc:129
static Plugin_table m_table_def
Table definition.
Definition: table_status_by_account.h:143
static PFS_engine_table_share m_share
Table share.
Definition: table_status_by_account.h:114
static THR_LOCK m_table_lock
Table share lock.
Definition: table_status_by_account.h:141
PFS_index_status_by_account * m_opened_index
Definition: table_status_by_account.h:155
int index_next() override
Find key in index, read record.
Definition: table_status_by_account.cc:194
pos_t m_pos
Current position.
Definition: table_status_by_account.h:151
table_status_by_account()
Definition: table_status_by_account.cc:123
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_status_by_account.cc:166
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_status_by_account.cc:104
static int delete_all_rows()
Definition: table_status_by_account.cc:108
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_status_by_account.cc:141
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_status_by_account.cc:253
row_status_by_account m_row
Current row.
Definition: table_status_by_account.h:149
~table_status_by_account() override=default
static ha_rows get_row_count()
Definition: table_status_by_account.cc:116
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Some integer typedefs for easier portability.
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: buf0block_hint.cc:29
Generic buffer container.
PFS_account_container global_account_container
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).
Row fragment for columns USER, HOST.
Definition: table_helper.h:551
Per account statistics.
Definition: pfs_account.h:66
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:592
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:594
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:596
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:357
Definition: table_helper.h:1114
Definition: table_helper.h:1127
Definition: table.h:1403
Definition: thr_lock.h:138
Position of a cursor on PERFORMANCE_SCHEMA.STATUS_BY_ACCOUNT.
Definition: table_status_by_account.h:71
void next_account()
Definition: table_status_by_account.h:83
pos_status_by_account()
Definition: table_status_by_account.h:72
bool has_more_account()
Definition: table_status_by_account.h:79
void reset()
Definition: table_status_by_account.h:74
A row of table PERFORMANCE_SCHEMA.STATUS_BY_ACCOUNT.
Definition: table_status_by_account.h:56
PFS_account_row m_account
Column USER, HOST.
Definition: table_status_by_account.h:58
PFS_variable_name_row m_variable_name
Column VARIABLE_NAME.
Definition: table_status_by_account.h:60
PFS_variable_value_row m_variable_value
Column VARIABLE_VALUE.
Definition: table_status_by_account.h:62
Helpers to implement a performance schema table.