MySQL 9.7.0
Source Code Documentation
sql_show.h
Go to the documentation of this file.
1/* Copyright (c) 2005, 2026, 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 SQL_SHOW_H
25#define SQL_SHOW_H
26
27#include <stddef.h>
28#include <sys/types.h>
29
30#include "field_types.h"
31#include "lex_string.h"
32#include "my_inttypes.h"
33#include "mysql/status_var.h"
34#include "sql/sql_select.h"
35#include "typelib.h"
36
37/* Forward declarations */
38class Item;
39class JOIN;
40class QEP_TAB;
41class Query_block;
42class String;
43class Table_ident;
44class THD;
45class sp_name;
46struct CHARSET_INFO;
47struct HA_CREATE_INFO;
48struct LEX;
49struct ST_SCHEMA_TABLE;
51struct TABLE;
52class Table_ref;
54enum enum_schema_tables : int;
55enum enum_var_type : int;
56
57/** Characters shown for the command in 'show processlist'. */
58constexpr const size_t PROCESS_LIST_WIDTH{100};
59/* Characters shown for the command in 'information_schema.processlist' */
60constexpr const size_t PROCESS_LIST_INFO_WIDTH{65535};
61
62bool store_create_info(THD *thd, Table_ref *table_list, String *packet,
63 HA_CREATE_INFO *create_info_arg, bool show_database,
64 bool for_show_create_stmt);
65
66void append_identifier(const THD *thd, String *packet, const char *name,
67 size_t length, const CHARSET_INFO *from_cs = nullptr,
68 const CHARSET_INFO *to_cs = nullptr);
69
70void mysqld_list_fields(THD *thd, Table_ref *table, const char *wild);
71bool mysqld_show_create(THD *thd, Table_ref *table_list);
72bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
73
74void mysqld_list_processes(THD *thd, const char *user, bool verbose,
75 bool has_cursor);
78void append_definer(const THD *thd, String *buffer,
79 const LEX_CSTRING &definer_user,
80 const LEX_CSTRING &definer_host);
81bool add_status_vars(const SHOW_VAR *list);
83void init_status_vars();
84void free_status_vars();
85bool get_recursive_status_var(THD *thd, const char *name, char *const value,
86 enum_var_type var_type, size_t *length,
87 const CHARSET_INFO **charset);
90bool show_create_trigger(THD *thd, const sp_name *trg_name);
91void view_store_options(const THD *thd, Table_ref *table, String *buff);
92
94
95/**
96 Store record to I_S table, convert HEAP table to InnoDB table if necessary.
97
98 @param[in] thd thread handler
99 @param[in] table Information schema table to be updated
100 @param[in] make_ondisk if true, convert heap table to on disk table.
101 default value is true.
102 @return 0 on success
103 @return error code on failure.
104*/
105int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk);
106
107/**
108 Convert HEAP table to InnoDB table if necessary
109
110 @param[in] thd thread handler
111 @param[in] table Information schema table to be converted.
112 @param[in] error the error code returned previously.
113 @return false on success, true on error.
114*/
117bool make_table_list(THD *thd, Query_block *sel, const LEX_CSTRING &db_name,
118 const LEX_CSTRING &table_name);
119
123 enum enum_schema_tables schema_table_idx);
124bool mysql_schema_table(THD *thd, LEX *lex, Table_ref *table_list);
126
127const char *get_one_variable(THD *thd, const SHOW_VAR *variable,
129 System_status_var *status_var,
130 const CHARSET_INFO **charset, char *buff,
131 size_t *length, bool *is_null = nullptr);
132
133const char *get_one_variable_ext(THD *running_thd, THD *target_thd,
134 const SHOW_VAR *variable,
136 System_status_var *status_var,
137 const CHARSET_INFO **charset, char *buff,
138 size_t *length, bool *is_null = nullptr);
139
140/* These functions were under INNODB_COMPATIBILITY_HOOKS */
141int get_quote_char_for_identifier(const THD *thd, const char *name,
142 size_t length);
143
144void show_sql_type(enum_field_types type, bool is_array, uint metadata,
145 String *str, const CHARSET_INFO *field_cs = nullptr,
146 unsigned int vector_dimensionality = 0);
147
148bool do_fill_information_schema_table(THD *thd, Table_ref *table_list,
149 Item *condition);
150
151extern std::atomic_ulong deprecated_use_i_s_processlist_count;
152extern std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp;
153extern TYPELIB grant_types;
154
155/**
156 Sql_cmd_show represents the SHOW statements that are implemented
157 as SELECT statements internally.
158 Normally, preparation and execution is the same as for regular SELECT
159 statements.
160*/
162 public:
164 : Sql_cmd_select(nullptr), m_sql_command(sql_command) {}
166 virtual bool check_parameters(THD *) { return false; }
167 /// Generally, the SHOW commands do not distinguish precheck and regular check
168 bool precheck(THD *thd) override { return check_privileges(thd); }
169 bool check_privileges(THD *) override;
170 bool execute(THD *thd) override;
171
172 protected:
174};
175
176/**
177 Common base class: Represents commands that are not represented by
178 a plan that is equivalent to a SELECT statement.
179
180 This class has a common execution framework with an execute() function
181 that calls check_privileges() and execute_inner().
182*/
184 protected:
186 : Sql_cmd_show(sql_command) {}
187 bool execute(THD *thd) override {
188 lex = thd->lex;
189 if (check_privileges(thd)) return true;
190 if (execute_inner(thd)) return true;
191 return false;
192 }
193};
194
195/// Common base class: Represents commands that operate on a schema (database)
196
198 public:
200 bool check_privileges(THD *thd) override;
201 bool check_parameters(THD *thd) override;
202 bool set_metadata_lock(THD *thd);
203};
204
205/// Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
206
208 public:
210 bool check_privileges(THD *thd) override;
211 bool check_parameters(THD *thd) override;
212
213 bool m_temporary; ///< True if table to be analyzed is temporary
214};
215
216/// Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
217
219 public:
221 const sp_name *routine_name)
222 : Sql_cmd_show_noplan(sql_command), m_routine_name(routine_name) {}
223 bool check_privileges(THD *thd) override;
224 bool execute_inner(THD *thd) override;
225
226 private:
228};
229
230/// Following are all subclasses of class Sql_cmd_show, in alphabetical order
231
232/// Represents SHOW BINLOG EVENTS statement.
233
235 public:
238 bool check_privileges(THD *thd) override;
239 bool execute_inner(THD *thd) override;
240
241 private:
242 // binlog_in
243 // binlog_from
244 // opt_limit
245};
246
247/// Represents SHOW BINARY LOGS statement.
248
250 public:
252 bool check_privileges(THD *thd) override;
253 bool execute_inner(THD *thd) override;
254};
255
256/// Represents SHOW CHARACTER SET statement.
257
259 public:
261};
262
263/// Represents SHOW COLLATION statement.
264
266 public:
268};
269
270/// Represents SHOW COLUMNS statement.
271
273 public:
275};
276
277/// Represents SHOW CREATE DATABASE statement.
278
280 public:
282 bool check_privileges(THD *thd) override;
283 bool execute_inner(THD *thd) override;
284};
285
286/// Represents SHOW CREATE EVENT statement.
287
289 public:
291 bool check_privileges(THD *thd) override;
292 bool execute_inner(THD *thd) override;
293};
294
295/// Represents SHOW CREATE FUNCTION statement.
296
298 public:
301 bool check_privileges(THD *thd) override;
302 bool execute_inner(THD *thd) override;
303};
304
305/// Represents SHOW CREATE LIBRARY statement.
306
308 public:
311 bool check_privileges(THD *thd) override;
312 bool execute_inner(THD *thd) override;
313};
314
315/// Represents SHOW CREATE PROCEDURE statement.
316
318 public:
321 bool check_privileges(THD *thd) override;
322 bool execute_inner(THD *thd) override;
323};
324
325/// Represents SHOW CREATE TABLE/VIEW statement.
326
328 public:
332 m_table_ident(table_ident) {}
333 bool check_privileges(THD *thd) override;
334 bool execute_inner(THD *thd) override;
335
336 private:
337 const bool m_is_view;
339};
340
341/// Represents SHOW CREATE TRIGGER statement.
342
344 public:
347 bool check_privileges(THD *thd) override;
348 bool execute_inner(THD *thd) override;
349};
350
351/// Represents SHOW CREATE USER statement.
352
354 public:
356 bool check_privileges(THD *thd) override;
357 bool execute_inner(THD *thd) override;
358};
359
360/// Represents SHOW CREATE MASKING POLICY statement.
361
363 public:
366 m_policy_name{policy_name} {}
367 bool check_privileges(THD *thd) override;
368 bool execute_inner(THD *thd) override;
369
370 private:
372};
373
374/// Represents SHOW DATABASES statement.
375
377 public:
379 bool check_privileges(THD *thd) override;
380};
381
382/// Represents SHOW ENGINE LOGS statement.
383
385 public:
387 bool check_privileges(THD *thd) override;
388 bool execute_inner(THD *thd) override;
389};
390
391/// Represents SHOW ENGINE MUTEX statement.
392
394 public:
396 bool check_privileges(THD *thd) override;
397 bool execute_inner(THD *thd) override;
398};
399
400/// Represents SHOW ENGINE STATUS statement.
401
403 public:
406 bool check_privileges(THD *thd) override;
407 bool execute_inner(THD *thd) override;
408};
409
410/// Represents SHOW STORAGE ENGINES statement.
411
413 public:
415};
416
417/// Represents SHOW ERRORS statement.
418
420 public:
422 bool execute_inner(THD *thd) override {
423 return mysqld_show_warnings(thd, 1UL << (uint)Sql_condition::SL_ERROR);
424 }
425};
426
427/// Represents SHOW EVENTS statement.
428
430 public:
432 bool check_privileges(THD *thd) override;
433 // To enable error message for unknown database, delete the below function.
434 bool check_parameters(THD *) override { return false; }
435};
436
437/// Represents SHOW GRANTS statement.
438
440 public:
441 Sql_cmd_show_grants(const LEX_USER *for_user_arg,
442 const List<LEX_USER> *using_users_arg)
444 for_user(for_user_arg),
445 using_users(using_users_arg) {}
446
447 bool check_privileges(THD *thd) override;
448 bool execute_inner(THD *thd) override;
449
450 private:
453};
454
455/// Represents the SHOW INDEX statement.
456
458 public:
460};
461
462/// Represents SHOW BINARY LOG STATUS statement.
463
465 public:
468 bool check_privileges(THD *thd) override;
469 bool execute_inner(THD *thd) override;
470};
471
472/// Represents SHOW OPEN TABLES statement.
473
475 public:
477};
478
479/// Represents SHOW PLUGINS statement.
480
482 public:
484};
485
486/// Represents SHOW PRIVILEGES statement.
487
489 public:
491 bool execute_inner(THD *thd) override;
492};
493
494/// Represents SHOW PROCESSLIST statement.
495
497 public:
501 bool check_privileges(THD *thd) override;
502 bool execute_inner(THD *thd) override;
503
505 bool verbose() const { return m_verbose; }
506
507 private:
508 bool use_pfs() { return m_use_pfs; }
509
510 const bool m_verbose{false};
511 bool m_use_pfs{false};
512};
513
514/// Represents SHOW PARSE_TREE statement.
515
517 public:
519};
520
521/// Represents SHOW PROFILE statement.
522
524 public:
526};
527
528/// Represents SHOW PROFILES statement.
529
531 public:
533 bool execute_inner(THD *thd) override;
534};
535
536/// Represents SHOW RELAYLOG EVENTS statement.
537
539 public:
542 bool check_privileges(THD *thd) override;
543 bool execute_inner(THD *thd) override;
544
545 private:
546 // binlog_in
547 // binlog_from
548 // opt_limit
549};
550
551/// Represents SHOW REPLICAS statement.
552
554 public:
556 bool check_privileges(THD *thd) override;
557 bool execute_inner(THD *thd) override;
558};
559
560/// Represents SHOW REPLICA STATUS statement.
561
563 public:
566 bool check_privileges(THD *thd) override;
567 bool execute_inner(THD *thd) override;
568};
569
570/// Represents SHOW STATUS statement.
571
573 public:
575 bool execute(THD *thd) override;
576};
577
578/// Represents SHOW STATUS LIBRARY statement.
579
581 public:
583};
584
585/// Represents SHOW STATUS FUNCTION statement.
586
588 public:
590};
591
592/// Represents SHOW STATUS PROCEDURE statement.
593
595 public:
597};
598
599/// Represents SHOW TABLE STATUS statement.
600
602 public:
605};
606
607/// Represents SHOW TABLES statement.
608
610 public:
612};
613
614/// Represents SHOW TRIGGERS statement.
615
617 public:
619};
620
621/// Represents SHOW VARIABLES statement.
622
624 public:
626};
627
628/// Represents SHOW WARNINGS statement.
629
631 public:
633 bool execute_inner(THD *thd) override {
634 return mysqld_show_warnings(thd,
635 (1UL << (uint)Sql_condition::SL_NOTE) |
636 (1UL << (uint)Sql_condition::SL_WARNING) |
637 (1UL << (uint)Sql_condition::SL_ERROR));
638 }
639};
640
641#endif /* SQL_SHOW_H */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:929
Definition: sql_optimizer.h:133
Definition: sql_list.h:494
Definition: sql_executor.h:256
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1179
LEX * lex
Pointer to LEX for this statement.
Definition: sql_cmd_dml.h:222
Definition: sql_select.h:76
Represents SHOW BINARY LOG STATUS statement.
Definition: sql_show.h:464
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:622
Sql_cmd_show_binary_log_status()
Definition: sql_show.h:466
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:618
Following are all subclasses of class Sql_cmd_show, in alphabetical order.
Definition: sql_show.h:234
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:317
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:321
Sql_cmd_show_binlog_events()
Definition: sql_show.h:236
Represents SHOW BINARY LOGS statement.
Definition: sql_show.h:249
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:325
Sql_cmd_show_binlogs()
Definition: sql_show.h:251
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:329
Represents SHOW CHARACTER SET statement.
Definition: sql_show.h:258
Sql_cmd_show_charsets()
Definition: sql_show.h:260
Represents SHOW COLLATION statement.
Definition: sql_show.h:265
Sql_cmd_show_collations()
Definition: sql_show.h:267
Represents SHOW COLUMNS statement.
Definition: sql_show.h:272
Sql_cmd_show_columns()
Definition: sql_show.h:274
Represents SHOW CREATE DATABASE statement.
Definition: sql_show.h:279
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:331
Sql_cmd_show_create_database()
Definition: sql_show.h:281
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:333
Represents SHOW CREATE EVENT statement.
Definition: sql_show.h:288
Sql_cmd_show_create_event()
Definition: sql_show.h:290
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:343
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:341
Represents SHOW CREATE FUNCTION statement.
Definition: sql_show.h:297
Sql_cmd_show_create_function()
Definition: sql_show.h:299
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:348
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:350
Represents SHOW CREATE LIBRARY statement.
Definition: sql_show.h:307
Sql_cmd_show_create_library()
Definition: sql_show.h:309
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:354
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:356
Represents SHOW CREATE MASKING POLICY statement.
Definition: sql_show.h:362
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:466
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:470
LEX_CSTRING m_policy_name
Definition: sql_show.h:371
Sql_cmd_show_create_masking_policy(LEX_CSTRING policy_name)
Definition: sql_show.h:364
Represents SHOW CREATE PROCEDURE statement.
Definition: sql_show.h:317
Sql_cmd_show_create_procedure()
Definition: sql_show.h:319
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:362
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:360
Represents SHOW CREATE TABLE/VIEW statement.
Definition: sql_show.h:327
const bool m_is_view
Definition: sql_show.h:337
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:366
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:371
Table_ident *const m_table_ident
Definition: sql_show.h:338
Sql_cmd_show_create_table(bool is_view, Table_ident *table_ident)
Definition: sql_show.h:329
Represents SHOW CREATE TRIGGER statement.
Definition: sql_show.h:343
Sql_cmd_show_create_trigger()
Definition: sql_show.h:345
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:440
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:442
Represents SHOW CREATE USER statement.
Definition: sql_show.h:353
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:451
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:453
Sql_cmd_show_create_user()
Definition: sql_show.h:355
Represents SHOW DATABASES statement.
Definition: sql_show.h:376
Sql_cmd_show_databases()
Definition: sql_show.h:378
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:511
Represents SHOW ENGINE LOGS statement.
Definition: sql_show.h:384
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:525
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:521
Sql_cmd_show_engine_logs()
Definition: sql_show.h:386
Represents SHOW ENGINE MUTEX statement.
Definition: sql_show.h:393
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:533
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:529
Sql_cmd_show_engine_mutex()
Definition: sql_show.h:395
Represents SHOW ENGINE STATUS statement.
Definition: sql_show.h:402
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:541
Sql_cmd_show_engine_status()
Definition: sql_show.h:404
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:537
Represents SHOW STORAGE ENGINES statement.
Definition: sql_show.h:412
Sql_cmd_show_engines()
Definition: sql_show.h:414
Represents SHOW ERRORS statement.
Definition: sql_show.h:419
Sql_cmd_show_errors()
Definition: sql_show.h:421
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:422
Represents SHOW EVENTS statement.
Definition: sql_show.h:429
Sql_cmd_show_events()
Definition: sql_show.h:431
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:545
bool check_parameters(THD *) override
Definition: sql_show.h:434
Represents SHOW GRANTS statement.
Definition: sql_show.h:439
const LEX_USER * for_user
Definition: sql_show.h:451
const List< LEX_USER > * using_users
Definition: sql_show.h:452
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:577
Sql_cmd_show_grants(const LEX_USER *for_user_arg, const List< LEX_USER > *using_users_arg)
Definition: sql_show.h:441
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:572
Represents the SHOW INDEX statement.
Definition: sql_show.h:457
Sql_cmd_show_keys()
Definition: sql_show.h:459
Common base class: Represents commands that are not represented by a plan that is equivalent to a SEL...
Definition: sql_show.h:183
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.h:187
Sql_cmd_show_noplan(enum_sql_command sql_command)
Definition: sql_show.h:185
Represents SHOW OPEN TABLES statement.
Definition: sql_show.h:474
Sql_cmd_show_open_tables()
Definition: sql_show.h:476
Represents SHOW PARSE_TREE statement.
Definition: sql_show.h:516
Sql_cmd_show_parse_tree()
Definition: sql_show.h:518
Represents SHOW PLUGINS statement.
Definition: sql_show.h:481
Sql_cmd_show_plugins()
Definition: sql_show.h:483
Represents SHOW PRIVILEGES statement.
Definition: sql_show.h:488
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:636
Sql_cmd_show_privileges()
Definition: sql_show.h:490
Represents SHOW PROCESSLIST statement.
Definition: sql_show.h:496
Sql_cmd_show_processlist(bool verbose)
Definition: sql_show.h:499
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:647
Sql_cmd_show_processlist()
Definition: sql_show.h:498
void set_use_pfs(bool use_pfs)
Definition: sql_show.h:504
const bool m_verbose
Definition: sql_show.h:510
bool use_pfs()
Definition: sql_show.h:508
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:640
bool verbose() const
Definition: sql_show.h:505
bool m_use_pfs
Definition: sql_show.h:511
Represents SHOW PROFILE statement.
Definition: sql_show.h:523
Sql_cmd_show_profile()
Definition: sql_show.h:525
Represents SHOW PROFILES statement.
Definition: sql_show.h:530
Sql_cmd_show_profiles()
Definition: sql_show.h:532
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:626
Represents SHOW RELAYLOG EVENTS statement.
Definition: sql_show.h:538
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:671
Sql_cmd_show_relaylog_events()
Definition: sql_show.h:540
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:667
Represents SHOW REPLICA STATUS statement.
Definition: sql_show.h:562
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:716
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:712
Sql_cmd_show_replica_status()
Definition: sql_show.h:564
Represents SHOW REPLICAS statement.
Definition: sql_show.h:553
Sql_cmd_show_replicas()
Definition: sql_show.h:555
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:708
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:704
Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
Definition: sql_show.h:218
const sp_name * m_routine_name
Definition: sql_show.h:227
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:679
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:674
Sql_cmd_show_routine_code(enum_sql_command sql_command, const sp_name *routine_name)
Definition: sql_show.h:220
Common base class: Represents commands that operate on a schema (database)
Definition: sql_show.h:197
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:246
bool check_parameters(THD *thd) override
Definition: sql_show.cc:275
bool set_metadata_lock(THD *thd)
Definition: sql_show.cc:229
Sql_cmd_show_schema_base(enum_sql_command command)
Definition: sql_show.h:199
Represents SHOW STATUS FUNCTION statement.
Definition: sql_show.h:587
Sql_cmd_show_status_func()
Definition: sql_show.h:589
Represents SHOW STATUS LIBRARY statement.
Definition: sql_show.h:580
Sql_cmd_show_status_library()
Definition: sql_show.h:582
Represents SHOW STATUS PROCEDURE statement.
Definition: sql_show.h:594
Sql_cmd_show_status_proc()
Definition: sql_show.h:596
Represents SHOW STATUS statement.
Definition: sql_show.h:572
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:817
Sql_cmd_show_status()
Definition: sql_show.h:574
Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
Definition: sql_show.h:207
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:292
bool check_parameters(THD *thd) override
Definition: sql_show.cc:767
bool m_temporary
True if table to be analyzed is temporary.
Definition: sql_show.h:213
Sql_cmd_show_table_base(enum_sql_command command)
Definition: sql_show.h:209
Represents SHOW TABLE STATUS statement.
Definition: sql_show.h:601
Sql_cmd_show_table_status()
Definition: sql_show.h:603
Represents SHOW TABLES statement.
Definition: sql_show.h:609
Sql_cmd_show_tables()
Definition: sql_show.h:611
Represents SHOW TRIGGERS statement.
Definition: sql_show.h:616
Sql_cmd_show_triggers()
Definition: sql_show.h:618
Represents SHOW VARIABLES statement.
Definition: sql_show.h:623
Sql_cmd_show_variables()
Definition: sql_show.h:625
Represents SHOW WARNINGS statement.
Definition: sql_show.h:630
Sql_cmd_show_warnings()
Definition: sql_show.h:632
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:633
Sql_cmd_show represents the SHOW statements that are implemented as SELECT statements internally.
Definition: sql_show.h:161
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:221
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_show.h:165
virtual bool check_parameters(THD *)
Definition: sql_show.h:166
Sql_cmd_show(enum_sql_command sql_command)
Definition: sql_show.h:163
enum_sql_command m_sql_command
Definition: sql_show.h:173
bool check_privileges(THD *) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:214
bool precheck(THD *thd) override
Generally, the SHOW commands do not distinguish precheck and regular check.
Definition: sql_show.h:168
@ SL_NOTE
Definition: sql_error.h:66
@ SL_ERROR
Definition: sql_error.h:66
@ SL_WARNING
Definition: sql_error.h:66
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
LEX * lex
Definition: sql_class.h:1006
Definition: sql_lex.h:313
Definition: table.h:2958
ST_SCHEMA_TABLE * schema_table
Definition: table.h:3827
Definition: sp_head.h:124
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
virtual bool execute_inner(THD *thd)
The inner parts of query optimization and execution.
Definition: sql_select.cc:1123
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
enum_sql_command
Definition: my_sqlcommand.h:46
@ SQLCOM_SHOW_ENGINE_LOGS
Definition: my_sqlcommand.h:64
@ SQLCOM_SHOW_GRANTS
Definition: my_sqlcommand.h:70
@ SQLCOM_SHOW_CREATE_DB
Definition: my_sqlcommand.h:74
@ SQLCOM_SHOW_STATUS_FUNC
Definition: my_sqlcommand.h:145
@ SQLCOM_SHOW_CREATE_FUNC
Definition: my_sqlcommand.h:143
@ SQLCOM_SHOW_CREATE_TRIGGER
Definition: my_sqlcommand.h:174
@ SQLCOM_SHOW_CREATE_MASKING_POLICY
Definition: my_sqlcommand.h:214
@ SQLCOM_SHOW_ENGINE_MUTEX
Definition: my_sqlcommand.h:66
@ SQLCOM_SHOW_PARSE_TREE
Definition: my_sqlcommand.h:206
@ SQLCOM_SHOW_PRIVILEGES
Definition: my_sqlcommand.h:129
@ SQLCOM_SHOW_BINLOGS
Definition: my_sqlcommand.h:115
@ SQLCOM_SHOW_BINLOG_EVENTS
Definition: my_sqlcommand.h:123
@ SQLCOM_SHOW_REPLICAS
Definition: my_sqlcommand.h:120
@ SQLCOM_SHOW_WARNS
Definition: my_sqlcommand.h:125
@ SQLCOM_SHOW_STATUS_PROC
Definition: my_sqlcommand.h:144
@ SQLCOM_SHOW_PLUGINS
Definition: my_sqlcommand.h:165
@ SQLCOM_SHOW_PROFILE
Definition: my_sqlcommand.h:175
@ SQLCOM_SHOW_DATABASES
Definition: my_sqlcommand.h:58
@ SQLCOM_SHOW_CHARSETS
Definition: my_sqlcommand.h:72
@ SQLCOM_SHOW_OPEN_TABLES
Definition: my_sqlcommand.h:116
@ SQLCOM_SHOW_TABLE_STATUS
Definition: my_sqlcommand.h:75
@ SQLCOM_SHOW_ERRORS
Definition: my_sqlcommand.h:127
@ SQLCOM_SHOW_REPLICA_STATUS
Definition: my_sqlcommand.h:69
@ SQLCOM_SHOW_FIELDS
Definition: my_sqlcommand.h:60
@ SQLCOM_SHOW_CREATE_USER
Definition: my_sqlcommand.h:183
@ SQLCOM_SHOW_STATUS
Definition: my_sqlcommand.h:63
@ SQLCOM_SHOW_BINLOG_STATUS
Definition: my_sqlcommand.h:68
@ SQLCOM_SHOW_ENGINE_STATUS
Definition: my_sqlcommand.h:65
@ SQLCOM_SHOW_EVENTS
Definition: my_sqlcommand.h:173
@ SQLCOM_SHOW_CREATE_PROC
Definition: my_sqlcommand.h:142
@ SQLCOM_SHOW_COLLATIONS
Definition: my_sqlcommand.h:73
@ SQLCOM_SHOW_KEYS
Definition: my_sqlcommand.h:61
@ SQLCOM_SHOW_STATUS_LIBRARY
Definition: my_sqlcommand.h:211
@ SQLCOM_SHOW_TABLES
Definition: my_sqlcommand.h:59
@ SQLCOM_SHOW_VARIABLES
Definition: my_sqlcommand.h:62
@ SQLCOM_SHOW_CREATE_EVENT
Definition: my_sqlcommand.h:172
@ SQLCOM_SHOW_PROCESSLIST
Definition: my_sqlcommand.h:67
@ SQLCOM_SHOW_RELAYLOG_EVENTS
Definition: my_sqlcommand.h:179
@ SQLCOM_SHOW_STORAGE_ENGINES
Definition: my_sqlcommand.h:128
@ SQLCOM_SHOW_CREATE_LIBRARY
Definition: my_sqlcommand.h:209
@ SQLCOM_SHOW_TRIGGERS
Definition: my_sqlcommand.h:76
@ SQLCOM_SHOW_CREATE
Definition: my_sqlcommand.h:71
@ SQLCOM_SHOW_PROFILES
Definition: my_sqlcommand.h:176
char * user
Definition: mysqladmin.cc:67
void error(const char *format,...)
static uint verbose
Definition: mysqlcheck.cc:66
uint16_t value_type
Definition: vt100.h:184
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1077
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
const std::string charset("charset")
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
static mysql_service_status_t create(my_h_string *) noexcept
Definition: mysql_string_all_empty.cc:43
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
const char * table_name
Definition: rules_table_service.cc:56
const char * db_name
Definition: rules_table_service.cc:55
bool is_null(poly_thread thread, poly_value value)
Definition: jit_executor_type_conversion.cc:46
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2884
required string type
Definition: replication_group_member_actions.proto:34
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:75
enum_var_type
Definition: set_var.h:92
enum_schema_tables
Definition: handler.h:945
bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
Send all notes, errors or warnings to the client in a result set.
Definition: sql_error.cc:815
ST_SCHEMA_TABLE * find_schema_table(THD *thd, const char *table_name)
Definition: sql_show.cc:5137
void reset_status_vars()
Definition: sql_show.cc:3944
enum enum_mysql_show_type SHOW_TYPE
Definition: sql_show.h:53
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
Definition: sql_show.cc:4444
int get_quote_char_for_identifier(const THD *thd, const char *name, size_t length)
Definition: sql_show.cc:1656
bool schema_table_store_record(THD *thd, TABLE *table)
Definition: sql_show.cc:4378
bool do_fill_information_schema_table(THD *thd, Table_ref *table_list, Item *condition)
Fill INFORMATION_SCHEMA-table, leave correct Diagnostics_area state after itself.
Definition: sql_show.cc:5514
void append_identifier(const THD *thd, String *packet, const char *name, size_t length, const CHARSET_INFO *from_cs=nullptr, const CHARSET_INFO *to_cs=nullptr)
Convert and quote the given identifier if needed and append it to the target string.
Definition: sql_show.cc:1568
const char * get_one_variable_ext(THD *running_thd, THD *target_thd, const SHOW_VAR *variable, enum_var_type value_type, SHOW_TYPE show_type, System_status_var *status_var, const CHARSET_INFO **charset, char *buff, size_t *length, bool *is_null=nullptr)
Returns the value of a system or a status variable.
Definition: sql_show.cc:4167
bool make_table_list(THD *thd, Query_block *sel, const LEX_CSTRING &db_name, const LEX_CSTRING &table_name)
Prepare a Table_ident and add a table_list into Query_block.
Definition: sql_show.cc:4434
void free_status_vars()
Definition: sql_show.cc:3968
void mysqld_list_processes(THD *thd, const char *user, bool verbose, bool has_cursor)
List running processes (actually connected sessions).
Definition: sql_show.cc:3580
void init_status_vars()
Definition: sql_show.cc:3938
std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp
Last time information_schema.processlist was used, as usec since epoch.
Definition: sql_show.cc:166
bool mysqld_show_privileges(THD *thd)
Definition: sql_show.cc:1014
ulonglong get_status_vars_version(void)
Definition: sql_show.cc:3957
TYPELIB grant_types
Definition: sql_show.cc:199
const char * get_one_variable(THD *thd, const SHOW_VAR *variable, enum_var_type value_type, SHOW_TYPE show_type, System_status_var *status_var, const CHARSET_INFO **charset, char *buff, size_t *length, bool *is_null=nullptr)
Returns the value of a system or a status variable.
Definition: sql_show.cc:4140
ST_SCHEMA_TABLE * get_schema_table(enum enum_schema_tables schema_table_idx)
Definition: sql_show.cc:5156
void view_store_options(const THD *thd, Table_ref *table, String *buff)
Definition: sql_show.cc:3252
void mysqld_list_fields(THD *thd, Table_ref *table, const char *wild)
Definition: sql_show.cc:1434
void calc_sum_of_all_status(System_status_var *to)
Definition: sql_show.cc:4352
bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error)
Convert HEAP table to InnoDB table if necessary.
Definition: sql_show.cc:4417
bool make_schema_query_block(THD *thd, Query_block *sel, enum enum_schema_tables schema_table_idx)
Generate select from information_schema table.
Definition: sql_show.cc:5443
bool mysql_schema_table(THD *thd, LEX *lex, Table_ref *table_list)
Create information_schema table.
Definition: sql_show.cc:5364
int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk)
Store record to I_S table, convert HEAP table to InnoDB table if necessary.
Definition: sql_show.cc:4399
std::atomic_ulong deprecated_use_i_s_processlist_count
Count number of times information_schema.processlist has been used.
Definition: sql_show.cc:163
void remove_status_vars(SHOW_VAR *list)
Definition: sql_show.cc:4089
void append_definer(const THD *thd, String *buffer, const LEX_CSTRING &definer_user, const LEX_CSTRING &definer_host)
Append DEFINER clause to the given buffer.
Definition: sql_show.cc:3300
bool get_recursive_status_var(THD *thd, const char *name, char *const value, enum_var_type var_type, size_t *length, const CHARSET_INFO **charset)
Get the string value of a status variable.
Definition: sql_show.cc:4063
bool add_status_vars(const SHOW_VAR *list)
Definition: sql_show.cc:3912
void show_sql_type(enum_field_types type, bool is_array, uint metadata, String *str, const CHARSET_INFO *field_cs=nullptr, unsigned int vector_dimensionality=0)
A field's SQL type printout.
Definition: sql_show.cc:6191
enum enum_schema_tables int enum constexpr enum_var_type int const size_t constexpr PROCESS_LIST_WIDTH const size_t PROCESS_LIST_INFO_WIDTH bool store_create_info(THD *thd, Table_ref *table_list, String *packet, HA_CREATE_INFO *create_info_arg, bool show_database, bool for_show_create_stmt)
Characters shown for the command in 'show processlist'.
Definition: sql_show.cc:2410
bool show_create_trigger(THD *thd, const sp_name *trg_name)
SHOW CREATE TRIGGER high-level implementation.
Definition: sql_show.cc:6010
void initialize_information_schema_acl()
Definition: sql_show.cc:6083
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create)
Definition: sql_show.cc:1321
bool mysqld_show_create(THD *thd, Table_ref *table_list)
Definition: sql_show.cc:1166
case opt name
Definition: sslopt-case.h:29
enum_mysql_show_type
Declarations for SHOW STATUS support in plugins.
Definition: status_variables_bits.h:32
Definition: m_ctype.h:421
Struct to hold information about the table that should be created.
Definition: handler.h:3355
Definition: table.h:2825
The LEX object currently serves three different purposes:
Definition: sql_lex.h:4002
Definition: mysql_lex_string.h:40
SHOW STATUS Server status variable.
Definition: status_variables_bits.h:81
Definition: table.h:2617
Per thread status variables.
Definition: system_variables.h:539
Definition: table.h:1456
Definition: typelib.h:35
static int is_view(cargo_type x)
Definition: xcom_base.cc:2165