MySQL 8.0.30
Source Code Documentation
sql_show.h
Go to the documentation of this file.
1/* Copyright (c) 2005, 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 SQL_SHOW_H
24#define SQL_SHOW_H
25
26#include <stddef.h>
27#include <sys/types.h>
28
29#include "field_types.h"
30#include "lex_string.h"
31#include "my_inttypes.h"
32#include "mysql/status_var.h"
33#include "sql/sql_select.h"
34#include "typelib.h"
35
36/* Forward declarations */
37class Item;
38class JOIN;
39class QEP_TAB;
40class Query_block;
41class String;
42class Table_ident;
43class THD;
44class sp_name;
45struct CHARSET_INFO;
46struct HA_CREATE_INFO;
47struct LEX;
48struct ST_SCHEMA_TABLE;
50struct TABLE;
51struct TABLE_LIST;
53enum enum_schema_tables : int;
54enum enum_var_type : int;
55
56/** Characters shown for the command in 'show processlist'. */
57constexpr const size_t PROCESS_LIST_WIDTH{100};
58/* Characters shown for the command in 'information_schema.processlist' */
59constexpr const size_t PROCESS_LIST_INFO_WIDTH{65535};
60
61bool store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
62 HA_CREATE_INFO *create_info_arg, bool show_database,
63 bool for_show_create_stmt);
64
65void append_identifier(const THD *thd, String *packet, const char *name,
66 size_t length, const CHARSET_INFO *from_cs,
67 const CHARSET_INFO *to_cs);
68
69void append_identifier(const THD *thd, String *packet, const char *name,
70 size_t length);
71
72void mysqld_list_fields(THD *thd, TABLE_LIST *table, const char *wild);
73bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
74bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
75
76void mysqld_list_processes(THD *thd, const char *user, bool verbose,
77 bool has_cursor);
80void append_definer(const THD *thd, String *buffer,
81 const LEX_CSTRING &definer_user,
82 const LEX_CSTRING &definer_host);
83bool add_status_vars(const SHOW_VAR *list);
85void init_status_vars();
86void free_status_vars();
87bool get_status_var(THD *thd, SHOW_VAR *list, const char *name,
88 char *const buff, enum_var_type var_type, size_t *length);
91bool show_create_trigger(THD *thd, const sp_name *trg_name);
92void view_store_options(const THD *thd, TABLE_LIST *table, String *buff);
93
95
96/**
97 Store record to I_S table, convert HEAP table to InnoDB table if necessary.
98
99 @param[in] thd thread handler
100 @param[in] table Information schema table to be updated
101 @param[in] make_ondisk if true, convert heap table to on disk table.
102 default value is true.
103 @return 0 on success
104 @return error code on failure.
105*/
106int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk);
107
108/**
109 Convert HEAP table to InnoDB table if necessary
110
111 @param[in] thd thread handler
112 @param[in] table Information schema table to be converted.
113 @param[in] error the error code returned previously.
114 @return false on success, true on error.
115*/
118bool make_table_list(THD *thd, Query_block *sel, const LEX_CSTRING &db_name,
119 const LEX_CSTRING &table_name);
120
124 enum enum_schema_tables schema_table_idx);
125bool mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
127
128const char *get_one_variable(THD *thd, const SHOW_VAR *variable,
130 System_status_var *status_var,
131 const CHARSET_INFO **charset, char *buff,
132 size_t *length, bool *is_null = nullptr);
133
134const char *get_one_variable_ext(THD *running_thd, THD *target_thd,
135 const SHOW_VAR *variable,
137 System_status_var *status_var,
138 const CHARSET_INFO **charset, char *buff,
139 size_t *length, bool *is_null = nullptr);
140
141/* These functions were under INNODB_COMPATIBILITY_HOOKS */
142int get_quote_char_for_identifier(const THD *thd, const char *name,
143 size_t length);
144
145void show_sql_type(enum_field_types type, bool is_array, uint metadata,
146 String *str, const CHARSET_INFO *field_cs = nullptr);
147
148bool do_fill_information_schema_table(THD *thd, TABLE_LIST *table_list,
149 Item *condition);
150
151extern TYPELIB grant_types;
152
153/**
154 Sql_cmd_show represents the SHOW statements that are implemented
155 as SELECT statements internally.
156 Normally, preparation and execution is the same as for regular SELECT
157 statements.
158*/
160 public:
162 : Sql_cmd_select(nullptr), m_sql_command(sql_command) {}
164 virtual bool check_parameters(THD *) { return false; }
165 /// Generally, the SHOW commands do not distinguish precheck and regular check
166 bool precheck(THD *thd) override { return check_privileges(thd); }
167 bool check_privileges(THD *) override;
168 bool execute(THD *thd) override;
169
170 protected:
172};
173
174/**
175 Common base class: Represents commands that are not represented by
176 a plan that iss equivalent to a SELECT statement.
177
178 This class has a common execution framework with an execute() function
179 that calls check_privileges() and execute_inner().
180*/
182 protected:
184 : Sql_cmd_show(sql_command) {}
185 bool execute(THD *thd) override {
186 lex = thd->lex;
187 if (check_privileges(thd)) return true;
188 if (execute_inner(thd)) return true;
189 return false;
190 }
191};
192
193/// Common base class: Represents commands that operate on a schema (database)
194
196 public:
198 bool check_privileges(THD *thd) override;
199 bool check_parameters(THD *thd) override;
200 bool set_metadata_lock(THD *thd);
201};
202
203/// Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
204
206 public:
208 bool check_privileges(THD *thd) override;
209 bool check_parameters(THD *thd) override;
210
211 bool m_temporary; ///< True if table to be analyzed is temporary
212};
213
214/// Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
215
217 public:
219 const sp_name *routine_name)
220 : Sql_cmd_show_noplan(sql_command), m_routine_name(routine_name) {}
221 bool check_privileges(THD *thd) override;
222 bool execute_inner(THD *thd) override;
223
224 private:
226};
227
228/// Following are all subclasses of class Sql_cmd_show, in alphabetical order
229
230/// Represents SHOW BINLOG EVENTS statement.
231
233 public:
236 bool check_privileges(THD *thd) override;
237 bool execute_inner(THD *thd) override;
238
239 private:
240 // binlog_in
241 // binlog_from
242 // opt_limit
243};
244
245/// Represents SHOW BINARY LOGS statement.
246
248 public:
250 bool check_privileges(THD *thd) override;
251 bool execute_inner(THD *thd) override;
252};
253
254/// Represents SHOW CHARACTER SET statement.
255
257 public:
259};
260
261/// Represents SHOW COLLATION statement.
262
264 public:
266};
267
268/// Represents SHOW COLUMNS statement.
269
271 public:
273};
274
275/// Represents SHOW CREATE DATABASE statement.
276
278 public:
280 bool check_privileges(THD *thd) override;
281 bool execute_inner(THD *thd) override;
282};
283
284/// Represents SHOW CREATE EVENT statement.
285
287 public:
289 bool check_privileges(THD *thd) override;
290 bool execute_inner(THD *thd) override;
291};
292
293/// Represents SHOW CREATE FUNCTION statement.
294
296 public:
299 bool check_privileges(THD *thd) override;
300 bool execute_inner(THD *thd) override;
301};
302
303/// Represents SHOW CREATE PROCEDURE statement.
304
306 public:
309 bool check_privileges(THD *thd) override;
310 bool execute_inner(THD *thd) override;
311};
312
313/// Represents SHOW CREATE TABLE/VIEW statement.
314
316 public:
320 m_table_ident(table_ident) {}
321 bool check_privileges(THD *thd) override;
322 bool execute_inner(THD *thd) override;
323
324 private:
325 const bool m_is_view;
327};
328
329/// Represents SHOW CREATE TRIGGER statement.
330
332 public:
335 bool check_privileges(THD *thd) override;
336 bool execute_inner(THD *thd) override;
337};
338
339/// Represents SHOW CREATE USER statement.
340
342 public:
344 bool check_privileges(THD *thd) override;
345 bool execute_inner(THD *thd) override;
346};
347
348/// Represents SHOW DATABASES statement.
349
351 public:
353 bool check_privileges(THD *thd) override;
354};
355
356/// Represents SHOW ENGINE LOGS statement.
357
359 public:
361 bool check_privileges(THD *thd) override;
362 bool execute_inner(THD *thd) override;
363};
364
365/// Represents SHOW ENGINE MUTEX statement.
366
368 public:
370 bool check_privileges(THD *thd) override;
371 bool execute_inner(THD *thd) override;
372};
373
374/// Represents SHOW ENGINE STATUS statement.
375
377 public:
380 bool check_privileges(THD *thd) override;
381 bool execute_inner(THD *thd) override;
382};
383
384/// Represents SHOW STORAGE ENGINES statement.
385
387 public:
389};
390
391/// Represents SHOW ERRORS statement.
392
394 public:
396 bool execute_inner(THD *thd) override {
398 }
399};
400
401/// Represents SHOW EVENTS statement.
402
404 public:
406 bool check_privileges(THD *thd) override;
407 // To enable error message for unknown database, delete the below function.
408 bool check_parameters(THD *) override { return false; }
409};
410
411/// Represents SHOW GRANTS statement.
412
414 public:
415 Sql_cmd_show_grants(const LEX_USER *for_user_arg,
416 const List<LEX_USER> *using_users_arg)
418 for_user(for_user_arg),
419 using_users(using_users_arg) {}
420
421 bool check_privileges(THD *thd) override;
422 bool execute_inner(THD *thd) override;
423
424 private:
427};
428
429/// Represents the SHOW INDEX statement.
430
432 public:
434};
435
436/// Represents SHOW MASTER STATUS statement.
437
439 public:
441 bool check_privileges(THD *thd) override;
442 bool execute_inner(THD *thd) override;
443};
444
445/// Represents SHOW OPEN TABLES statement.
446
448 public:
450};
451
452/// Represents SHOW PLUGINS statement.
453
455 public:
457};
458
459/// Represents SHOW PRIVILEGES statement.
460
462 public:
464 bool execute_inner(THD *thd) override;
465};
466
467/// Represents SHOW PROCESSLIST statement.
468
470 public:
474 bool check_privileges(THD *thd) override;
475 bool execute_inner(THD *thd) override;
476
478 bool verbose() const { return m_verbose; }
479
480 private:
481 bool use_pfs() { return m_use_pfs; }
482
483 const bool m_verbose{false};
484 bool m_use_pfs{false};
485};
486
487/// Represents SHOW PROFILE statement.
488
490 public:
492};
493
494/// Represents SHOW PROFILES statement.
495
497 public:
499 bool execute_inner(THD *thd) override;
500};
501
502/// Represents SHOW RELAYLOG EVENTS statement.
503
505 public:
508 bool check_privileges(THD *thd) override;
509 bool execute_inner(THD *thd) override;
510
511 private:
512 // binlog_in
513 // binlog_from
514 // opt_limit
515};
516
517/// Represents SHOW REPLICAS statement.
518
520 public:
522 bool check_privileges(THD *thd) override;
523 bool execute_inner(THD *thd) override;
524};
525
526/// Represents SHOW REPLICA STATUS statement.
527
529 public:
531 bool check_privileges(THD *thd) override;
532 bool execute_inner(THD *thd) override;
533};
534
535/// Represents SHOW STATUS statement.
536
538 public:
540 bool execute(THD *thd) override;
541};
542
543/// Represents SHOW STATUS FUNCTION statement.
544
546 public:
548};
549
550/// Represents SHOW STATUS PROCEDURE statement.
551
553 public:
555};
556
557/// Represents SHOW TABLE STATUS statement.
558
560 public:
563};
564
565/// Represents SHOW TABLES statement.
566
568 public:
570};
571
572/// Represents SHOW TRIGGERS statement.
573
575 public:
577};
578
579/// Represents SHOW VARIABLES statement.
580
582 public:
584};
585
586/// Represents SHOW WARNINGS statement.
587
589 public:
591 bool execute_inner(THD *thd) override {
592 return mysqld_show_warnings(thd,
593 (1UL << (uint)Sql_condition::SL_NOTE) |
595 (1UL << (uint)Sql_condition::SL_ERROR));
596 }
597};
598
599#endif /* SQL_SHOW_H */
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
Definition: sql_optimizer.h:125
Definition: sql_list.h:433
Definition: sql_executor.h:259
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1124
LEX * lex
Pointer to LEX for this statement.
Definition: sql_cmd_dml.h:212
Definition: sql_select.h:73
Following are all subclasses of class Sql_cmd_show, in alphabetical order.
Definition: sql_show.h:232
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:298
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:302
Sql_cmd_show_binlog_events()
Definition: sql_show.h:234
Represents SHOW BINARY LOGS statement.
Definition: sql_show.h:247
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:306
Sql_cmd_show_binlogs()
Definition: sql_show.h:249
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:310
Represents SHOW CHARACTER SET statement.
Definition: sql_show.h:256
Sql_cmd_show_charsets()
Definition: sql_show.h:258
Represents SHOW COLLATION statement.
Definition: sql_show.h:263
Sql_cmd_show_collations()
Definition: sql_show.h:265
Represents SHOW COLUMNS statement.
Definition: sql_show.h:270
Sql_cmd_show_columns()
Definition: sql_show.h:272
Represents SHOW CREATE DATABASE statement.
Definition: sql_show.h:277
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:312
Sql_cmd_show_create_database()
Definition: sql_show.h:279
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:314
Represents SHOW CREATE EVENT statement.
Definition: sql_show.h:286
Sql_cmd_show_create_event()
Definition: sql_show.h:288
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:324
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:322
Represents SHOW CREATE FUNCTION statement.
Definition: sql_show.h:295
Sql_cmd_show_create_function()
Definition: sql_show.h:297
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:329
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:331
Represents SHOW CREATE PROCEDURE statement.
Definition: sql_show.h:305
Sql_cmd_show_create_procedure()
Definition: sql_show.h:307
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:337
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:335
Represents SHOW CREATE TABLE/VIEW statement.
Definition: sql_show.h:315
const bool m_is_view
Definition: sql_show.h:325
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:341
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:346
Table_ident *const m_table_ident
Definition: sql_show.h:326
Sql_cmd_show_create_table(bool is_view, Table_ident *table_ident)
Definition: sql_show.h:317
Represents SHOW CREATE TRIGGER statement.
Definition: sql_show.h:331
Sql_cmd_show_create_trigger()
Definition: sql_show.h:333
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:414
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:416
Represents SHOW CREATE USER statement.
Definition: sql_show.h:341
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:425
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:427
Sql_cmd_show_create_user()
Definition: sql_show.h:343
Represents SHOW DATABASES statement.
Definition: sql_show.h:350
Sql_cmd_show_databases()
Definition: sql_show.h:352
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:440
Represents SHOW ENGINE LOGS statement.
Definition: sql_show.h:358
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:454
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:450
Sql_cmd_show_engine_logs()
Definition: sql_show.h:360
Represents SHOW ENGINE MUTEX statement.
Definition: sql_show.h:367
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:462
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:458
Sql_cmd_show_engine_mutex()
Definition: sql_show.h:369
Represents SHOW ENGINE STATUS statement.
Definition: sql_show.h:376
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:470
Sql_cmd_show_engine_status()
Definition: sql_show.h:378
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:466
Represents SHOW STORAGE ENGINES statement.
Definition: sql_show.h:386
Sql_cmd_show_engines()
Definition: sql_show.h:388
Represents SHOW ERRORS statement.
Definition: sql_show.h:393
Sql_cmd_show_errors()
Definition: sql_show.h:395
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:396
Represents SHOW EVENTS statement.
Definition: sql_show.h:403
Sql_cmd_show_events()
Definition: sql_show.h:405
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:474
bool check_parameters(THD *) override
Definition: sql_show.h:408
Represents SHOW GRANTS statement.
Definition: sql_show.h:413
const LEX_USER * for_user
Definition: sql_show.h:425
const List< LEX_USER > * using_users
Definition: sql_show.h:426
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:506
Sql_cmd_show_grants(const LEX_USER *for_user_arg, const List< LEX_USER > *using_users_arg)
Definition: sql_show.h:415
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:501
Represents the SHOW INDEX statement.
Definition: sql_show.h:431
Sql_cmd_show_keys()
Definition: sql_show.h:433
Represents SHOW MASTER STATUS statement.
Definition: sql_show.h:438
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:551
Sql_cmd_show_master_status()
Definition: sql_show.h:440
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:547
Common base class: Represents commands that are not represented by a plan that iss equivalent to a SE...
Definition: sql_show.h:181
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.h:185
Sql_cmd_show_noplan(enum_sql_command sql_command)
Definition: sql_show.h:183
Represents SHOW OPEN TABLES statement.
Definition: sql_show.h:447
Sql_cmd_show_open_tables()
Definition: sql_show.h:449
Represents SHOW PLUGINS statement.
Definition: sql_show.h:454
Sql_cmd_show_plugins()
Definition: sql_show.h:456
Represents SHOW PRIVILEGES statement.
Definition: sql_show.h:461
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:565
Sql_cmd_show_privileges()
Definition: sql_show.h:463
Represents SHOW PROCESSLIST statement.
Definition: sql_show.h:469
Sql_cmd_show_processlist(bool verbose)
Definition: sql_show.h:472
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:576
Sql_cmd_show_processlist()
Definition: sql_show.h:471
void set_use_pfs(bool use_pfs)
Definition: sql_show.h:477
const bool m_verbose
Definition: sql_show.h:483
bool use_pfs()
Definition: sql_show.h:481
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:569
bool verbose() const
Definition: sql_show.h:478
bool m_use_pfs
Definition: sql_show.h:484
Represents SHOW PROFILE statement.
Definition: sql_show.h:489
Sql_cmd_show_profile()
Definition: sql_show.h:491
Represents SHOW PROFILES statement.
Definition: sql_show.h:496
Sql_cmd_show_profiles()
Definition: sql_show.h:498
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:555
Represents SHOW RELAYLOG EVENTS statement.
Definition: sql_show.h:504
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:600
Sql_cmd_show_relaylog_events()
Definition: sql_show.h:506
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:596
Represents SHOW REPLICA STATUS statement.
Definition: sql_show.h:528
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:645
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:641
Sql_cmd_show_replica_status()
Definition: sql_show.h:530
Represents SHOW REPLICAS statement.
Definition: sql_show.h:519
Sql_cmd_show_replicas()
Definition: sql_show.h:521
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:637
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:633
Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
Definition: sql_show.h:216
const sp_name * m_routine_name
Definition: sql_show.h:225
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:608
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:603
Sql_cmd_show_routine_code(enum_sql_command sql_command, const sp_name *routine_name)
Definition: sql_show.h:218
Common base class: Represents commands that operate on a schema (database)
Definition: sql_show.h:195
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:227
bool check_parameters(THD *thd) override
Definition: sql_show.cc:256
bool set_metadata_lock(THD *thd)
Definition: sql_show.cc:210
Sql_cmd_show_schema_base(enum_sql_command command)
Definition: sql_show.h:197
Represents SHOW STATUS FUNCTION statement.
Definition: sql_show.h:545
Sql_cmd_show_status_func()
Definition: sql_show.h:547
Represents SHOW STATUS PROCEDURE statement.
Definition: sql_show.h:552
Sql_cmd_show_status_proc()
Definition: sql_show.h:554
Represents SHOW STATUS statement.
Definition: sql_show.h:537
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:746
Sql_cmd_show_status()
Definition: sql_show.h:539
Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
Definition: sql_show.h:205
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:273
bool check_parameters(THD *thd) override
Definition: sql_show.cc:696
bool m_temporary
True if table to be analyzed is temporary.
Definition: sql_show.h:211
Sql_cmd_show_table_base(enum_sql_command command)
Definition: sql_show.h:207
Represents SHOW TABLE STATUS statement.
Definition: sql_show.h:559
Sql_cmd_show_table_status()
Definition: sql_show.h:561
Represents SHOW TABLES statement.
Definition: sql_show.h:567
Sql_cmd_show_tables()
Definition: sql_show.h:569
Represents SHOW TRIGGERS statement.
Definition: sql_show.h:574
Sql_cmd_show_triggers()
Definition: sql_show.h:576
Represents SHOW VARIABLES statement.
Definition: sql_show.h:581
Sql_cmd_show_variables()
Definition: sql_show.h:583
Represents SHOW WARNINGS statement.
Definition: sql_show.h:588
Sql_cmd_show_warnings()
Definition: sql_show.h:590
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:591
Sql_cmd_show represents the SHOW statements that are implemented as SELECT statements internally.
Definition: sql_show.h:159
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:202
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_show.h:163
virtual bool check_parameters(THD *)
Definition: sql_show.h:164
Sql_cmd_show(enum_sql_command sql_command)
Definition: sql_show.h:161
enum_sql_command m_sql_command
Definition: sql_show.h:171
bool check_privileges(THD *) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:195
bool precheck(THD *thd) override
Generally, the SHOW commands do not distinguish precheck and regular check.
Definition: sql_show.h:166
@ SL_NOTE
Definition: sql_error.h:62
@ SL_ERROR
Definition: sql_error.h:62
@ SL_WARNING
Definition: sql_error.h:62
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:922
LEX * lex
Definition: sql_class.h:988
Definition: sql_lex.h:292
Definition: sp_head.h:119
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:52
virtual bool execute_inner(THD *thd)
The inner parts of query optimization and execution.
Definition: sql_select.cc:768
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
enum_sql_command
Definition: my_sqlcommand.h:45
@ SQLCOM_SHOW_ENGINE_LOGS
Definition: my_sqlcommand.h:63
@ SQLCOM_SHOW_GRANTS
Definition: my_sqlcommand.h:69
@ SQLCOM_SHOW_CREATE_DB
Definition: my_sqlcommand.h:73
@ SQLCOM_SHOW_STATUS_FUNC
Definition: my_sqlcommand.h:144
@ SQLCOM_SHOW_CREATE_FUNC
Definition: my_sqlcommand.h:142
@ SQLCOM_SHOW_SLAVE_HOSTS
Definition: my_sqlcommand.h:119
@ SQLCOM_SHOW_CREATE_TRIGGER
Definition: my_sqlcommand.h:173
@ SQLCOM_SHOW_ENGINE_MUTEX
Definition: my_sqlcommand.h:65
@ SQLCOM_SHOW_PRIVILEGES
Definition: my_sqlcommand.h:128
@ SQLCOM_SHOW_BINLOGS
Definition: my_sqlcommand.h:114
@ SQLCOM_SHOW_BINLOG_EVENTS
Definition: my_sqlcommand.h:122
@ SQLCOM_SHOW_WARNS
Definition: my_sqlcommand.h:124
@ SQLCOM_SHOW_STATUS_PROC
Definition: my_sqlcommand.h:143
@ SQLCOM_SHOW_PLUGINS
Definition: my_sqlcommand.h:164
@ SQLCOM_SHOW_PROFILE
Definition: my_sqlcommand.h:174
@ SQLCOM_SHOW_DATABASES
Definition: my_sqlcommand.h:57
@ SQLCOM_SHOW_CHARSETS
Definition: my_sqlcommand.h:71
@ SQLCOM_SHOW_OPEN_TABLES
Definition: my_sqlcommand.h:115
@ SQLCOM_SHOW_TABLE_STATUS
Definition: my_sqlcommand.h:74
@ SQLCOM_SHOW_ERRORS
Definition: my_sqlcommand.h:126
@ SQLCOM_SHOW_FIELDS
Definition: my_sqlcommand.h:59
@ SQLCOM_SHOW_CREATE_USER
Definition: my_sqlcommand.h:182
@ SQLCOM_SHOW_STATUS
Definition: my_sqlcommand.h:62
@ SQLCOM_SHOW_ENGINE_STATUS
Definition: my_sqlcommand.h:64
@ SQLCOM_SHOW_EVENTS
Definition: my_sqlcommand.h:172
@ SQLCOM_SHOW_CREATE_PROC
Definition: my_sqlcommand.h:141
@ SQLCOM_SHOW_COLLATIONS
Definition: my_sqlcommand.h:72
@ SQLCOM_SHOW_MASTER_STAT
Definition: my_sqlcommand.h:67
@ SQLCOM_SHOW_KEYS
Definition: my_sqlcommand.h:60
@ SQLCOM_SHOW_SLAVE_STAT
Definition: my_sqlcommand.h:68
@ SQLCOM_SHOW_TABLES
Definition: my_sqlcommand.h:58
@ SQLCOM_SHOW_VARIABLES
Definition: my_sqlcommand.h:61
@ SQLCOM_SHOW_CREATE_EVENT
Definition: my_sqlcommand.h:171
@ SQLCOM_SHOW_PROCESSLIST
Definition: my_sqlcommand.h:66
@ SQLCOM_SHOW_RELAYLOG_EVENTS
Definition: my_sqlcommand.h:178
@ SQLCOM_SHOW_STORAGE_ENGINES
Definition: my_sqlcommand.h:127
@ SQLCOM_SHOW_TRIGGERS
Definition: my_sqlcommand.h:75
@ SQLCOM_SHOW_CREATE
Definition: my_sqlcommand.h:70
@ SQLCOM_SHOW_PROFILES
Definition: my_sqlcommand.h:175
Log error(cerr, "ERROR")
char * user
Definition: mysqladmin.cc:59
static uint verbose
Definition: mysqlcheck.cc:64
uint16_t value_type
Definition: vt100.h:182
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1055
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:75
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:391
static mysql_service_status_t create(const char *service_names[], reference_caching_channel *out_channel) noexcept
Definition: component.cc:35
const char * table_name
Definition: rules_table_service.cc:55
const char * db_name
Definition: rules_table_service.cc:54
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2859
required string type
Definition: replication_group_member_actions.proto:33
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:72
enum_var_type
Definition: set_var.h:89
enum_schema_tables
Definition: handler.h:912
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:730
ST_SCHEMA_TABLE * find_schema_table(THD *thd, const char *table_name)
Definition: sql_show.cc:4352
void reset_status_vars()
Definition: sql_show.cc:3222
enum enum_mysql_show_type SHOW_TYPE
Definition: sql_show.h:52
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
Definition: sql_show.cc:3658
int get_quote_char_for_identifier(const THD *thd, const char *name, size_t length)
Definition: sql_show.cc:1585
bool schema_table_store_record(THD *thd, TABLE *table)
Definition: sql_show.cc:3592
bool do_fill_information_schema_table(THD *thd, TABLE_LIST *table_list, Item *condition)
Fill INFORMATION_SCHEMA-table, leave correct Diagnostics_area state after itself.
Definition: sql_show.cc:4720
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_LIST *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:1868
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:3381
bool mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
Create information_schema table.
Definition: sql_show.cc:4571
void show_sql_type(enum_field_types type, bool is_array, uint metadata, String *str, const CHARSET_INFO *field_cs=nullptr)
A field's SQL type printout.
Definition: sql_show.cc:5425
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:3648
void mysqld_list_fields(THD *thd, TABLE_LIST *table, const char *wild)
Definition: sql_show.cc:1368
void free_status_vars()
Definition: sql_show.cc:3246
bool get_status_var(THD *thd, SHOW_VAR *list, const char *name, char *const buff, enum_var_type var_type, size_t *length)
Get the value of given status variable.
Definition: sql_show.cc:3268
void mysqld_list_processes(THD *thd, const char *user, bool verbose, bool has_cursor)
List running processes (actually connected sessions).
Definition: sql_show.cc:2875
void init_status_vars()
Definition: sql_show.cc:3216
bool mysqld_show_privileges(THD *thd)
Definition: sql_show.cc:943
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list)
Definition: sql_show.cc:1095
ulonglong get_status_vars_version(void)
Definition: sql_show.cc:3235
TYPELIB grant_types
Definition: sql_show.cc:180
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:3354
ST_SCHEMA_TABLE * get_schema_table(enum enum_schema_tables schema_table_idx)
Definition: sql_show.cc:4371
void view_store_options(const THD *thd, TABLE_LIST *table, String *buff)
Definition: sql_show.cc:2572
void calc_sum_of_all_status(System_status_var *to)
Definition: sql_show.cc:3566
bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error)
Convert HEAP table to InnoDB table if necessary.
Definition: sql_show.cc:3631
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:4649
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:3613
void append_identifier(const THD *thd, String *packet, const char *name, size_t length, const CHARSET_INFO *from_cs, const CHARSET_INFO *to_cs)
Convert and quote the given identifier if needed and append it to the target string.
Definition: sql_show.cc:1500
void remove_status_vars(SHOW_VAR *list)
Definition: sql_show.cc:3303
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:2614
bool add_status_vars(const SHOW_VAR *list)
Definition: sql_show.cc:3190
bool show_create_trigger(THD *thd, const sp_name *trg_name)
SHOW CREATE TRIGGER high-level implementation.
Definition: sql_show.cc:5245
void initialize_information_schema_acl()
Definition: sql_show.cc:5318
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create)
Definition: sql_show.cc:1250
case opt name
Definition: sslopt-case.h:32
enum_mysql_show_type
Declarations for SHOW STATUS support in plugins.
Definition: status_var.h:29
Definition: m_ctype.h:354
Definition: handler.h:2923
Definition: table.h:2551
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3668
Definition: mysql_lex_string.h:39
SHOW STATUS Server status variable.
Definition: status_var.h:78
Definition: table.h:2351
Per thread status variables.
Definition: system_variables.h:479
Definition: table.h:2684
TABLE * table
Definition: table.h:3458
ST_SCHEMA_TABLE * schema_table
Definition: table.h:3512
Definition: table.h:1394
Definition: typelib.h:34
unsigned int uint
Definition: uca-dump.cc:29
command
Definition: version_token.cc:279
static int is_view(cargo_type x)
Definition: xcom_base.cc:2152