MySQL 9.0.0
Source Code Documentation
table_status_by_user.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 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_STATUS_BY_USER_H
25#define TABLE_STATUS_BY_USER_H
26
27/**
28 @file storage/perfschema/table_status_by_user.h
29 Table STATUS_BY_USER (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
35#include "my_inttypes.h"
41
42class Field;
43class Plugin_table;
44struct PFS_user;
45struct TABLE;
46struct THR_LOCK;
47
48/**
49 @addtogroup performance_schema_tables
50 @{
51*/
52
53/**
54 A row of table
55 PERFORMANCE_SCHEMA.STATUS_BY_USER.
56*/
58 /** Column USER */
60 /** Column VARIABLE_NAME. */
62 /** Column VARIABLE_VALUE. */
64};
65
66/**
67 Position of a cursor on
68 PERFORMANCE_SCHEMA.STATUS_BY_USER.
69 Index 1 on user (0 based)
70 Index 2 on status variable (0 based)
71*/
74
75 inline void reset() {
76 m_index_1 = 0;
77 m_index_2 = 0;
78 }
79
80 inline bool has_more_user() {
82 }
83
84 inline void next_user() {
85 m_index_1++;
86 m_index_2 = 0;
87 }
88};
89
91 public:
94 m_key_1("USER"),
95 m_key_2("VARIABLE_NAME") {}
96
97 ~PFS_index_status_by_user() override = default;
98
99 virtual bool match(PFS_user *pfs);
100 virtual bool match(const Status_variable *pfs);
101
102 private:
105};
106
107/** Table PERFORMANCE_SCHEMA.STATUS_BY_USER. */
110
111 public:
112 /** Table share */
115 static int delete_all_rows();
116 static ha_rows get_row_count();
117
118 void reset_position() override;
119
120 int rnd_init(bool scan) override;
121 int rnd_next() override;
122 int rnd_pos(const void *pos) override;
123
124 int index_init(uint idx, bool sorted) override;
125 int index_next() override;
126
127 protected:
128 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
129 bool read_all) override;
131
132 public:
133 ~table_status_by_user() override = default;
134
135 protected:
136 int make_row(PFS_user *user, const Status_variable *status_var);
137
138 private:
139 /** Table share lock. */
141 /** Table definition. */
143
144 /** Status variable cache for one user. */
146
147 /** Current row. */
149 /** Current position. */
151 /** Next position. */
153
155};
156
157/** @} */
158#endif
Definition: field.h:577
size_t get_row_count()
Definition: pfs_buffer_container.h:519
Definition: pfs_engine_table.h:300
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_status_by_user.h:90
~PFS_index_status_by_user() override=default
PFS_key_user m_key_1
Definition: table_status_by_user.h:103
virtual bool match(PFS_user *pfs)
Definition: table_status_by_user.cc:81
PFS_index_status_by_user()
Definition: table_status_by_user.h:92
PFS_key_variable_name m_key_2
Definition: table_status_by_user.h:104
Definition: table_helper.h:1494
Definition: table_helper.h:1579
Status variable cache.
Definition: pfs_variable.h:680
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Status variable derived from SHOW_VAR.
Definition: pfs_variable.h:208
Table PERFORMANCE_SCHEMA.STATUS_BY_USER.
Definition: table_status_by_user.h:108
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_status_by_user.cc:137
PFS_index_status_by_user * m_opened_index
Definition: table_status_by_user.h:154
int index_next() override
Find key in index, read record.
Definition: table_status_by_user.cc:188
static ha_rows get_row_count()
Definition: table_status_by_user.cc:113
PFS_status_variable_cache m_status_cache
Status variable cache for one user.
Definition: table_status_by_user.h:145
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_status_by_user.cc:100
table_status_by_user()
Definition: table_status_by_user.cc:120
static PFS_engine_table_share m_share
Table share.
Definition: table_status_by_user.h:113
int index_init(uint idx, bool sorted) override
Definition: table_status_by_user.cc:177
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_status_by_user.cc:162
static THR_LOCK m_table_lock
Table share lock.
Definition: table_status_by_user.h:140
~table_status_by_user() override=default
pos_status_by_user pos_t
Definition: table_status_by_user.h:109
static Plugin_table m_table_def
Table definition.
Definition: table_status_by_user.h:142
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_status_by_user.cc:125
row_status_by_user m_row
Current row.
Definition: table_status_by_user.h:148
static int delete_all_rows()
Definition: table_status_by_user.cc:104
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_status_by_user.cc:248
int rnd_init(bool scan) override
Initialize table scan.
Definition: table_status_by_user.cc:130
pos_t m_pos
Current position.
Definition: table_status_by_user.h:150
pos_t m_next_pos
Next position.
Definition: table_status_by_user.h:152
int make_row(PFS_user *user, const Status_variable *status_var)
Definition: table_status_by_user.cc:223
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.
char * user
Definition: mysqladmin.cc:66
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Generic buffer container.
PFS_user_container global_user_container
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).
Position of a double cursor, for iterations using 2 nested loops.
Definition: pfs_engine_table.h:601
uint m_index_1
Outer index.
Definition: pfs_engine_table.h:603
uint m_index_2
Current index within index_1.
Definition: pfs_engine_table.h:605
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Row fragment for column USER.
Definition: table_helper.h:540
Per user statistics.
Definition: pfs_user.h:63
Definition: table_helper.h:1115
Definition: table_helper.h:1128
Definition: table.h:1407
Definition: thr_lock.h:139
Position of a cursor on PERFORMANCE_SCHEMA.STATUS_BY_USER.
Definition: table_status_by_user.h:72
pos_status_by_user()
Definition: table_status_by_user.h:73
bool has_more_user()
Definition: table_status_by_user.h:80
void reset()
Definition: table_status_by_user.h:75
void next_user()
Definition: table_status_by_user.h:84
A row of table PERFORMANCE_SCHEMA.STATUS_BY_USER.
Definition: table_status_by_user.h:57
PFS_variable_name_row m_variable_name
Column VARIABLE_NAME.
Definition: table_status_by_user.h:61
PFS_variable_value_row m_variable_value
Column VARIABLE_VALUE.
Definition: table_status_by_user.h:63
PFS_user_row m_user
Column USER.
Definition: table_status_by_user.h:59
Helpers to implement a performance schema table.