MySQL 8.0.39
Source Code Documentation
table_prepared_stmt_instances.h
Go to the documentation of this file.
1/* Copyright (c) 2013, 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_PREPARED_STMT_INSTANCES
25#define TABLE_PREPARED_STMT_INSTANCES
26
27/**
28 @file storage/perfschema/table_prepared_stmt_instances.h
29 Table PREPARED_STATEMENT_INSTANCE(declarations).
30*/
31
32#include <sys/types.h>
33
34#include "my_inttypes.h"
37
38/**
39 @addtogroup performance_schema_tables
40 @{
41*/
42
43/**
44 A row of table
45 PERFORMANCE_SCHEMA.PREPARED_STATEMENT_INSTANCES.
46*/
48 /** Column OBJECT_INSTANCE_BEGIN. */
49 const void *m_identity;
50
51 /** Column STMT_ID. */
53
54 /** Column STMT_NAME. */
57
58 /** Column SQL_TEXT. */
61
62 /** Column OWNER_THREAD_ID. */
64
65 /** Column OWNER_EVENT_ID. */
67
68 /** Column OWNER_OBJECT_TYPE. */
70
71 /** Column OWNER_OBJECT_SCHEMA */
73
74 /** Column OWNER_OBJECT_NAME */
76
77 /** Columns TIMER_PREPARE. */
79
80 /** Columns COUNT_REPREPARE. */
82
83 /** Column EXECUTION_ENGINE. */
85
86 /** Columns COUNT_STAR...SUM_NO_GOOD_INDEX_USED. */
88};
89
91 public:
93 : PFS_engine_index(key_1) {}
94
96 PFS_engine_key *key_2)
97 : PFS_engine_index(key_1, key_2) {}
98
100 PFS_engine_key *key_2,
101 PFS_engine_key *key_3)
102 : PFS_engine_index(key_1, key_2, key_3) {}
103
105
106 virtual bool match(const PFS_prepared_stmt *pfs) = 0;
107};
108
111 public:
114 m_key("OBJECT_INSTANCE_BEGIN") {}
115
117
118 bool match(const PFS_prepared_stmt *pfs) override;
119
120 private:
122};
123
126 public:
129 m_key_1("OWNER_THREAD_ID"),
130 m_key_2("OWNER_EVENT_ID") {}
131
133
134 bool match(const PFS_prepared_stmt *pfs) override;
135
136 private:
139};
140
143 public:
145 : PFS_index_prepared_stmt_instances(&m_key), m_key("STATEMENT_ID") {}
146
148
149 bool match(const PFS_prepared_stmt *pfs) override;
150
151 private:
153};
154
157 public:
159 : PFS_index_prepared_stmt_instances(&m_key), m_key("STATEMENT_NAME") {}
160
162
163 bool match(const PFS_prepared_stmt *pfs) override;
164
165 private:
167};
168
171 public:
174 m_key_1("OWNER_OBJECT_TYPE"),
175 m_key_2("OWNER_OBJECT_SCHEMA"),
176 m_key_3("OWNER_OBJECT_NAME") {}
177
179
180 bool match(const PFS_prepared_stmt *pfs) override;
181
182 private:
186};
187
188/** Table PERFORMANCE_SCHEMA.PREPARED_STATEMENT_INSTANCES. */
190 public:
191 /** Table share */
194 static int delete_all_rows();
195 static ha_rows get_row_count();
196
197 void reset_position() override;
198
199 int rnd_next() override;
200 int rnd_pos(const void *pos) override;
201
202 int index_init(uint idx, bool sorted) override;
203 int index_next() override;
204
205 protected:
206 int read_row_values(TABLE *table, unsigned char *buf, Field **fields,
207 bool read_all) override;
208
210
211 public:
212 ~table_prepared_stmt_instances() override = default;
213
214 protected:
216
217 /** Table share lock. */
219 /** Table definition. */
221
222 /** Current row. */
224 /** Current position. */
226 /** Next position. */
228
230};
231
232/** @} */
233#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_prepared_stmt_instances.h:110
bool match(const PFS_prepared_stmt *pfs) override
Definition: table_prepared_stmt_instances.cc:122
PFS_key_object_instance m_key
Definition: table_prepared_stmt_instances.h:121
~PFS_index_prepared_stmt_instances_by_instance() override=default
PFS_index_prepared_stmt_instances_by_instance()
Definition: table_prepared_stmt_instances.h:112
Definition: table_prepared_stmt_instances.h:170
bool match(const PFS_prepared_stmt *pfs) override
Definition: table_prepared_stmt_instances.cc:168
PFS_index_prepared_stmt_instances_by_owner_object()
Definition: table_prepared_stmt_instances.h:172
PFS_key_object_type_enum m_key_1
Definition: table_prepared_stmt_instances.h:183
PFS_key_object_schema m_key_2
Definition: table_prepared_stmt_instances.h:184
PFS_key_object_name m_key_3
Definition: table_prepared_stmt_instances.h:185
~PFS_index_prepared_stmt_instances_by_owner_object() override=default
Definition: table_prepared_stmt_instances.h:125
PFS_index_prepared_stmt_instances_by_owner_thread()
Definition: table_prepared_stmt_instances.h:127
PFS_key_event_id m_key_2
Definition: table_prepared_stmt_instances.h:138
PFS_key_thread_id m_key_1
Definition: table_prepared_stmt_instances.h:137
~PFS_index_prepared_stmt_instances_by_owner_thread() override=default
bool match(const PFS_prepared_stmt *pfs) override
Definition: table_prepared_stmt_instances.cc:132
Definition: table_prepared_stmt_instances.h:142
bool match(const PFS_prepared_stmt *pfs) override
Definition: table_prepared_stmt_instances.cc:148
~PFS_index_prepared_stmt_instances_by_statement_id() override=default
PFS_index_prepared_stmt_instances_by_statement_id()
Definition: table_prepared_stmt_instances.h:144
PFS_key_statement_id m_key
Definition: table_prepared_stmt_instances.h:152
Definition: table_prepared_stmt_instances.h:156
PFS_index_prepared_stmt_instances_by_statement_name()
Definition: table_prepared_stmt_instances.h:158
PFS_key_statement_name m_key
Definition: table_prepared_stmt_instances.h:166
bool match(const PFS_prepared_stmt *pfs) override
Definition: table_prepared_stmt_instances.cc:158
~PFS_index_prepared_stmt_instances_by_statement_name() override=default
Definition: table_prepared_stmt_instances.h:90
virtual bool match(const PFS_prepared_stmt *pfs)=0
PFS_index_prepared_stmt_instances(PFS_engine_key *key_1, PFS_engine_key *key_2, PFS_engine_key *key_3)
Definition: table_prepared_stmt_instances.h:99
PFS_index_prepared_stmt_instances(PFS_engine_key *key_1, PFS_engine_key *key_2)
Definition: table_prepared_stmt_instances.h:95
PFS_index_prepared_stmt_instances(PFS_engine_key *key_1)
Definition: table_prepared_stmt_instances.h:92
~PFS_index_prepared_stmt_instances() override=default
Definition: table_helper.h:1294
Definition: table_helper.h:1700
Definition: table_helper.h:1637
Definition: table_helper.h:1622
Definition: table_helper.h:1681
Definition: table_helper.h:1336
Definition: table_helper.h:1602
Definition: table_helper.h:1278
Class to hold information regarding a table to be created on behalf of a plugin.
Definition: plugin_table.h:40
Table PERFORMANCE_SCHEMA.PREPARED_STATEMENT_INSTANCES.
Definition: table_prepared_stmt_instances.h:189
static PFS_engine_table * create(PFS_engine_table_share *)
Definition: table_prepared_stmt_instances.cc:190
PFS_simple_index m_pos
Current position.
Definition: table_prepared_stmt_instances.h:225
void reset_position() override
Reset the cursor position to the beginning of the table.
Definition: table_prepared_stmt_instances.cc:209
static PFS_engine_table_share m_share
Table share.
Definition: table_prepared_stmt_instances.h:192
int rnd_pos(const void *pos) override
Fetch a row by position.
Definition: table_prepared_stmt_instances.cc:229
int index_next() override
Find key in index, read record.
Definition: table_prepared_stmt_instances.cc:271
row_prepared_stmt_instances m_row
Current row.
Definition: table_prepared_stmt_instances.h:223
PFS_index_prepared_stmt_instances * m_opened_index
Definition: table_prepared_stmt_instances.h:229
int index_init(uint idx, bool sorted) override
Definition: table_prepared_stmt_instances.cc:242
static int delete_all_rows()
Definition: table_prepared_stmt_instances.cc:195
int read_row_values(TABLE *table, unsigned char *buf, Field **fields, bool read_all) override
Read the current row values.
Definition: table_prepared_stmt_instances.cc:333
int make_row(PFS_prepared_stmt *)
Definition: table_prepared_stmt_instances.cc:291
static Plugin_table m_table_def
Table definition.
Definition: table_prepared_stmt_instances.h:220
int rnd_next() override
Fetch the next row in this cursor.
Definition: table_prepared_stmt_instances.cc:214
static THR_LOCK m_table_lock
Table share lock.
Definition: table_prepared_stmt_instances.h:218
PFS_simple_index m_next_pos
Next position.
Definition: table_prepared_stmt_instances.h:227
static ha_rows get_row_count()
Definition: table_prepared_stmt_instances.cc:200
table_prepared_stmt_instances()
Definition: table_prepared_stmt_instances.cc:204
~table_prepared_stmt_instances() override=default
my_off_t ha_rows
Definition: my_base.h:1140
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Definition: buf0block_hint.cc:30
#define COL_INFO_SIZE
Size of INFO columns, in bytes.
Definition: pfs_column_types.h:71
enum_object_type
Enum values for the various OBJECT_TYPE columns.
Definition: pfs_column_types.h:222
Stored Program data structures (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:336
Definition: pfs_prepared_stmt.h:42
Definition: pfs_name.h:186
Position of a cursor, for simple iterations.
Definition: pfs_engine_table.h:566
Row fragment for single statistics columns (COUNT, SUM, MIN, AVG, MAX)
Definition: table_helper.h:688
Row fragment for statement statistics columns.
Definition: table_helper.h:873
Definition: table.h:1399
Definition: thr_lock.h:139
A row of table PERFORMANCE_SCHEMA.PREPARED_STATEMENT_INSTANCES.
Definition: table_prepared_stmt_instances.h:47
char m_sql_text[COL_INFO_SIZE]
Column SQL_TEXT.
Definition: table_prepared_stmt_instances.h:59
bool m_secondary
Column EXECUTION_ENGINE.
Definition: table_prepared_stmt_instances.h:84
PFS_stat_row m_prepare_stat
Columns TIMER_PREPARE.
Definition: table_prepared_stmt_instances.h:78
PFS_schema_name m_owner_object_schema
Column OWNER_OBJECT_SCHEMA.
Definition: table_prepared_stmt_instances.h:72
enum_object_type m_owner_object_type
Column OWNER_OBJECT_TYPE.
Definition: table_prepared_stmt_instances.h:69
PFS_stat_row m_reprepare_stat
Columns COUNT_REPREPARE.
Definition: table_prepared_stmt_instances.h:81
ulonglong m_owner_event_id
Column OWNER_EVENT_ID.
Definition: table_prepared_stmt_instances.h:66
ulonglong m_owner_thread_id
Column OWNER_THREAD_ID.
Definition: table_prepared_stmt_instances.h:63
char m_stmt_name[COL_INFO_SIZE]
Column STMT_NAME.
Definition: table_prepared_stmt_instances.h:55
ulonglong m_stmt_id
Column STMT_ID.
Definition: table_prepared_stmt_instances.h:52
const void * m_identity
Column OBJECT_INSTANCE_BEGIN.
Definition: table_prepared_stmt_instances.h:49
PFS_statement_stat_row m_execute_stat
Columns COUNT_STAR...SUM_NO_GOOD_INDEX_USED.
Definition: table_prepared_stmt_instances.h:87
int m_stmt_name_length
Definition: table_prepared_stmt_instances.h:56
int m_sql_text_length
Definition: table_prepared_stmt_instances.h:60
PFS_object_name m_owner_object_name
Column OWNER_OBJECT_NAME.
Definition: table_prepared_stmt_instances.h:75
Helpers to implement a performance schema table.
unsigned int uint
Definition: uca9-dump.cc:75