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