MySQL 8.0.39
Source Code Documentation
table_file_instances.h
Go to the documentation of this file.
1/* Copyright (c) 2008, 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_FILE_INSTANCES_H
25#define TABLE_FILE_INSTANCES_H
26
27/**
28 @file storage/perfschema/table_file_instances.h
29 Table FILE_INSTANCES (declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_base.h"
37
38class Field;
39class Plugin_table;
40struct PFS_file;
41struct TABLE;
42struct THR_LOCK;
43
44/**
45 @addtogroup performance_schema_tables
46 @{
47*/
48
49/** A row of PERFORMANCE_SCHEMA.FILE_INSTANCES. */
51 /** Column FILE_NAME. */
53 /** Column EVENT_NAME. */
54 const char *m_event_name;
55 /** Length in bytes of @c m_event_name. */
57 /** Column OPEN_COUNT. */
59};
60
62 public:
64 : PFS_engine_index(key_1) {}
65
66 ~PFS_index_file_instances() override = default;
67
68 virtual bool match(const PFS_file *pfs) = 0;
69};
70
72 public:
74 : PFS_index_file_instances(&m_key), m_key("FILE_NAME") {}
75
77
78 bool match(const PFS_file *pfs) override;
79
80 private:
82};
83
85 public:
87 : PFS_index_file_instances(&m_key), m_key("EVENT_NAME") {}
88
90
91 bool match(const PFS_file *pfs) override;
92
93 private:
95};
96
97/** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */
99 public:
100 /** Table share */
103 static ha_rows get_row_count();
104
105 void reset_position() override;
106
107 int rnd_next() override;
108 int rnd_pos(const void *pos) override;
109
110 int index_init(uint idx, bool sorted) override;
111 int index_next() override;
112
113 private:
114 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
115 bool read_all) override;
117
118 public:
119 ~table_file_instances() override = default;
120
121 private:
122 int make_row(PFS_file *pfs);
123
124 /** Table share lock. */
126 /** Table definition. */
128
129 /** Current row. */
131 /** Current position. */
133 /** Next position. */
135
137};
138
139/** @} */
140#endif
Definition: field.h:575
Definition: pfs_engine_table.h:300
Definition: pfs_engine_table.h:268
An abstract PERFORMANCE_SCHEMA table.
Definition: pfs_engine_table.h:70
Definition: table_file_instances.h:84
~PFS_index_file_instances_by_event_name() override=default
bool match(const PFS_file *pfs) override
Definition: table_file_instances.cc:88
PFS_index_file_instances_by_event_name()
Definition: table_file_instances.h:86
PFS_key_event_name m_key
Definition: table_file_instances.h:94
Definition: table_file_instances.h:71
~PFS_index_file_instances_by_file_name() override=default
PFS_index_file_instances_by_file_name()
Definition: table_file_instances.h:73
bool match(const PFS_file *pfs) override
Definition: table_file_instances.cc:79
PFS_key_file_name m_key
Definition: table_file_instances.h:81
Definition: table_file_instances.h:61
PFS_index_file_instances(PFS_engine_key *key_1)
Definition: table_file_instances.h:63
virtual bool match(const PFS_file *pfs)=0
~PFS_index_file_instances() override=default
Definition: table_helper.h:1458
Definition: table_helper.h:1613
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.FILE_INSTANCES.
Definition: table_file_instances.h:98
table_file_instances()
Definition: table_file_instances.cc:105
row_file_instances m_row
Current row.
Definition: table_file_instances.h:130
PFS_index_file_instances * m_opened_index
Definition: table_file_instances.h:136
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_file_instances.cc:113
PFS_simple_index m_pos
Current position.
Definition: table_file_instances.h:132
PFS_simple_index m_next_pos
Next position.
Definition: table_file_instances.h:134
int make_row(PFS_file *pfs)
Definition: table_file_instances.cc:181
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_file_instances.cc:108
static PFS_engine_table_share m_share
Table share.
Definition: table_file_instances.h:101
int index_init(uint idx, bool sorted) override
Definition: table_file_instances.cc:140
int index_next() override
Find key in index, read record.
Definition: table_file_instances.cc:160
static ha_rows get_row_count()
Definition: table_file_instances.cc:101
static THR_LOCK m_table_lock
Table share lock.
Definition: table_file_instances.h:125
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_file_instances.cc:127
~table_file_instances() override=default
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_file_instances.cc:97
static Plugin_table m_table_def
Table definition.
Definition: table_file_instances.h:127
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_file_instances.cc:205
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
Definition: buf0block_hint.cc:30
Performance schema tables (declarations).
static const LEX_CSTRING pfs
Definition: sql_show_processlist.cc:66
A PERFORMANCE_SCHEMA table share.
Definition: pfs_engine_table.h:358
Definition: pfs_name.h:602
Instrumented File and FILE implementation.
Definition: pfs_instr.h:177
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Definition: table.h:1399
Definition: thr_lock.h:139
A row of PERFORMANCE_SCHEMA.FILE_INSTANCES.
Definition: table_file_instances.h:50
PFS_file_name m_file_name
Column FILE_NAME.
Definition: table_file_instances.h:52
uint m_open_count
Column OPEN_COUNT.
Definition: table_file_instances.h:58
uint m_event_name_length
Length in bytes of m_event_name.
Definition: table_file_instances.h:56
const char * m_event_name
Column EVENT_NAME.
Definition: table_file_instances.h:54
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca9-dump.cc:75