MySQL 9.1.0
Source Code Documentation
sql_show.h
Go to the documentation of this file.
1/* Copyright (c) 2005, 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 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,
68 const CHARSET_INFO *to_cs);
69
70void append_identifier(const THD *thd, String *packet, const char *name,
71 size_t length);
72
73void mysqld_list_fields(THD *thd, Table_ref *table, const char *wild);
74bool mysqld_show_create(THD *thd, Table_ref *table_list);
75bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
76
77void mysqld_list_processes(THD *thd, const char *user, bool verbose,
78 bool has_cursor);
81void append_definer(const THD *thd, String *buffer,
82 const LEX_CSTRING &definer_user,
83 const LEX_CSTRING &definer_host);
84bool add_status_vars(const SHOW_VAR *list);
86void init_status_vars();
87void free_status_vars();
88bool get_recursive_status_var(THD *thd, const char *name, char *const value,
89 enum_var_type var_type, size_t *length,
90 const CHARSET_INFO **charset);
93bool show_create_trigger(THD *thd, const sp_name *trg_name);
94void view_store_options(const THD *thd, Table_ref *table, String *buff);
95
97
98/**
99 Store record to I_S table, convert HEAP table to InnoDB table if necessary.
100
101 @param[in] thd thread handler
102 @param[in] table Information schema table to be updated
103 @param[in] make_ondisk if true, convert heap table to on disk table.
104 default value is true.
105 @return 0 on success
106 @return error code on failure.
107*/
108int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk);
109
110/**
111 Convert HEAP table to InnoDB table if necessary
112
113 @param[in] thd thread handler
114 @param[in] table Information schema table to be converted.
115 @param[in] error the error code returned previously.
116 @return false on success, true on error.
117*/
120bool make_table_list(THD *thd, Query_block *sel, const LEX_CSTRING &db_name,
121 const LEX_CSTRING &table_name);
122
126 enum enum_schema_tables schema_table_idx);
127bool mysql_schema_table(THD *thd, LEX *lex, Table_ref *table_list);
129
130const char *get_one_variable(THD *thd, const SHOW_VAR *variable,
132 System_status_var *status_var,
133 const CHARSET_INFO **charset, char *buff,
134 size_t *length, bool *is_null = nullptr);
135
136const char *get_one_variable_ext(THD *running_thd, THD *target_thd,
137 const SHOW_VAR *variable,
139 System_status_var *status_var,
140 const CHARSET_INFO **charset, char *buff,
141 size_t *length, bool *is_null = nullptr);
142
143/* These functions were under INNODB_COMPATIBILITY_HOOKS */
144int get_quote_char_for_identifier(const THD *thd, const char *name,
145 size_t length);
146
147void show_sql_type(enum_field_types type, bool is_array, uint metadata,
148 String *str, const CHARSET_INFO *field_cs = nullptr,
149 unsigned int vector_dimensionality = 0);
150
151bool do_fill_information_schema_table(THD *thd, Table_ref *table_list,
152 Item *condition);
153
154extern std::atomic_ulong deprecated_use_i_s_processlist_count;
155extern std::atomic_ullong deprecated_use_i_s_processlist_last_timestamp;
156extern TYPELIB grant_types;
157
158/**
159 Sql_cmd_show represents the SHOW statements that are implemented
160 as SELECT statements internally.
161 Normally, preparation and execution is the same as for regular SELECT
162 statements.
163*/
165 public:
167 : Sql_cmd_select(nullptr), m_sql_command(sql_command) {}
169 virtual bool check_parameters(THD *) { return false; }
170 /// Generally, the SHOW commands do not distinguish precheck and regular check
171 bool precheck(THD *thd) override { return check_privileges(thd); }
172 bool check_privileges(THD *) override;
173 bool execute(THD *thd) override;
174
175 protected:
177};
178
179/**
180 Common base class: Represents commands that are not represented by
181 a plan that is equivalent to a SELECT statement.
182
183 This class has a common execution framework with an execute() function
184 that calls check_privileges() and execute_inner().
185*/
187 protected:
189 : Sql_cmd_show(sql_command) {}
190 bool execute(THD *thd) override {
191 lex = thd->lex;
192 if (check_privileges(thd)) return true;
193 if (execute_inner(thd)) return true;
194 return false;
195 }
196};
197
198/// Common base class: Represents commands that operate on a schema (database)
199
201 public:
203 bool check_privileges(THD *thd) override;
204 bool check_parameters(THD *thd) override;
205 bool set_metadata_lock(THD *thd);
206};
207
208/// Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
209
211 public:
213 bool check_privileges(THD *thd) override;
214 bool check_parameters(THD *thd) override;
215
216 bool m_temporary; ///< True if table to be analyzed is temporary
217};
218
219/// Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
220
222 public:
224 const sp_name *routine_name)
225 : Sql_cmd_show_noplan(sql_command), m_routine_name(routine_name) {}
226 bool check_privileges(THD *thd) override;
227 bool execute_inner(THD *thd) override;
228
229 private:
231};
232
233/// Following are all subclasses of class Sql_cmd_show, in alphabetical order
234
235/// Represents SHOW BINLOG EVENTS statement.
236
238 public:
241 bool check_privileges(THD *thd) override;
242 bool execute_inner(THD *thd) override;
243
244 private:
245 // binlog_in
246 // binlog_from
247 // opt_limit
248};
249
250/// Represents SHOW BINARY LOGS statement.
251
253 public:
255 bool check_privileges(THD *thd) override;
256 bool execute_inner(THD *thd) override;
257};
258
259/// Represents SHOW CHARACTER SET statement.
260
262 public:
264};
265
266/// Represents SHOW COLLATION statement.
267
269 public:
271};
272
273/// Represents SHOW COLUMNS statement.
274
276 public:
278};
279
280/// Represents SHOW CREATE DATABASE statement.
281
283 public:
285 bool check_privileges(THD *thd) override;
286 bool execute_inner(THD *thd) override;
287};
288
289/// Represents SHOW CREATE EVENT statement.
290
292 public:
294 bool check_privileges(THD *thd) override;
295 bool execute_inner(THD *thd) override;
296};
297
298/// Represents SHOW CREATE FUNCTION statement.
299
301 public:
304 bool check_privileges(THD *thd) override;
305 bool execute_inner(THD *thd) override;
306};
307
308/// Represents SHOW CREATE PROCEDURE statement.
309
311 public:
314 bool check_privileges(THD *thd) override;
315 bool execute_inner(THD *thd) override;
316};
317
318/// Represents SHOW CREATE TABLE/VIEW statement.
319
321 public:
325 m_table_ident(table_ident) {}
326 bool check_privileges(THD *thd) override;
327 bool execute_inner(THD *thd) override;
328
329 private:
330 const bool m_is_view;
332};
333
334/// Represents SHOW CREATE TRIGGER statement.
335
337 public:
340 bool check_privileges(THD *thd) override;
341 bool execute_inner(THD *thd) override;
342};
343
344/// Represents SHOW CREATE USER statement.
345
347 public:
349 bool check_privileges(THD *thd) override;
350 bool execute_inner(THD *thd) override;
351};
352
353/// Represents SHOW DATABASES statement.
354
356 public:
358 bool check_privileges(THD *thd) override;
359};
360
361/// Represents SHOW ENGINE LOGS statement.
362
364 public:
366 bool check_privileges(THD *thd) override;
367 bool execute_inner(THD *thd) override;
368};
369
370/// Represents SHOW ENGINE MUTEX statement.
371
373 public:
375 bool check_privileges(THD *thd) override;
376 bool execute_inner(THD *thd) override;
377};
378
379/// Represents SHOW ENGINE STATUS statement.
380
382 public:
385 bool check_privileges(THD *thd) override;
386 bool execute_inner(THD *thd) override;
387};
388
389/// Represents SHOW STORAGE ENGINES statement.
390
392 public:
394};
395
396/// Represents SHOW ERRORS statement.
397
399 public:
401 bool execute_inner(THD *thd) override {
402 return mysqld_show_warnings(thd, 1UL << (uint)Sql_condition::SL_ERROR);
403 }
404};
405
406/// Represents SHOW EVENTS statement.
407
409 public:
411 bool check_privileges(THD *thd) override;
412 // To enable error message for unknown database, delete the below function.
413 bool check_parameters(THD *) override { return false; }
414};
415
416/// Represents SHOW GRANTS statement.
417
419 public:
420 Sql_cmd_show_grants(const LEX_USER *for_user_arg,
421 const List<LEX_USER> *using_users_arg)
423 for_user(for_user_arg),
424 using_users(using_users_arg) {}
425
426 bool check_privileges(THD *thd) override;
427 bool execute_inner(THD *thd) override;
428
429 private:
432};
433
434/// Represents the SHOW INDEX statement.
435
437 public:
439};
440
441/// Represents SHOW BINARY LOG STATUS statement.
442
444 public:
447 bool check_privileges(THD *thd) override;
448 bool execute_inner(THD *thd) override;
449};
450
451/// Represents SHOW OPEN TABLES statement.
452
454 public:
456};
457
458/// Represents SHOW PLUGINS statement.
459
461 public:
463};
464
465/// Represents SHOW PRIVILEGES statement.
466
468 public:
470 bool execute_inner(THD *thd) override;
471};
472
473/// Represents SHOW PROCESSLIST statement.
474
476 public:
480 bool check_privileges(THD *thd) override;
481 bool execute_inner(THD *thd) override;
482
484 bool verbose() const { return m_verbose; }
485
486 private:
487 bool use_pfs() { return m_use_pfs; }
488
489 const bool m_verbose{false};
490 bool m_use_pfs{false};
491};
492
493/// Represents SHOW PARSE_TREE statement.
494
496 public:
498};
499
500/// Represents SHOW PROFILE statement.
501
503 public:
505};
506
507/// Represents SHOW PROFILES statement.
508
510 public:
512 bool execute_inner(THD *thd) override;
513};
514
515/// Represents SHOW RELAYLOG EVENTS statement.
516
518 public:
521 bool check_privileges(THD *thd) override;
522 bool execute_inner(THD *thd) override;
523
524 private:
525 // binlog_in
526 // binlog_from
527 // opt_limit
528};
529
530/// Represents SHOW REPLICAS statement.
531
533 public:
535 bool check_privileges(THD *thd) override;
536 bool execute_inner(THD *thd) override;
537};
538
539/// Represents SHOW REPLICA STATUS statement.
540
542 public:
545 bool check_privileges(THD *thd) override;
546 bool execute_inner(THD *thd) override;
547};
548
549/// Represents SHOW STATUS statement.
550
552 public:
554 bool execute(THD *thd) override;
555};
556
557/// Represents SHOW STATUS FUNCTION statement.
558
560 public:
562};
563
564/// Represents SHOW STATUS PROCEDURE statement.
565
567 public:
569};
570
571/// Represents SHOW TABLE STATUS statement.
572
574 public:
577};
578
579/// Represents SHOW TABLES statement.
580
582 public:
584};
585
586/// Represents SHOW TRIGGERS statement.
587
589 public:
591};
592
593/// Represents SHOW VARIABLES statement.
594
596 public:
598};
599
600/// Represents SHOW WARNINGS statement.
601
603 public:
605 bool execute_inner(THD *thd) override {
606 return mysqld_show_warnings(thd,
607 (1UL << (uint)Sql_condition::SL_NOTE) |
608 (1UL << (uint)Sql_condition::SL_WARNING) |
609 (1UL << (uint)Sql_condition::SL_ERROR));
610 }
611};
612
613#endif /* SQL_SHOW_H */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
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:1159
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:443
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:566
Sql_cmd_show_binary_log_status()
Definition: sql_show.h:445
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:562
Following are all subclasses of class Sql_cmd_show, in alphabetical order.
Definition: sql_show.h:237
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:312
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:316
Sql_cmd_show_binlog_events()
Definition: sql_show.h:239
Represents SHOW BINARY LOGS statement.
Definition: sql_show.h:252
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:320
Sql_cmd_show_binlogs()
Definition: sql_show.h:254
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:324
Represents SHOW CHARACTER SET statement.
Definition: sql_show.h:261
Sql_cmd_show_charsets()
Definition: sql_show.h:263
Represents SHOW COLLATION statement.
Definition: sql_show.h:268
Sql_cmd_show_collations()
Definition: sql_show.h:270
Represents SHOW COLUMNS statement.
Definition: sql_show.h:275
Sql_cmd_show_columns()
Definition: sql_show.h:277
Represents SHOW CREATE DATABASE statement.
Definition: sql_show.h:282
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:326
Sql_cmd_show_create_database()
Definition: sql_show.h:284
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:328
Represents SHOW CREATE EVENT statement.
Definition: sql_show.h:291
Sql_cmd_show_create_event()
Definition: sql_show.h:293
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:338
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:336
Represents SHOW CREATE FUNCTION statement.
Definition: sql_show.h:300
Sql_cmd_show_create_function()
Definition: sql_show.h:302
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:343
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:345
Represents SHOW CREATE PROCEDURE statement.
Definition: sql_show.h:310
Sql_cmd_show_create_procedure()
Definition: sql_show.h:312
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:351
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:349
Represents SHOW CREATE TABLE/VIEW statement.
Definition: sql_show.h:320
const bool m_is_view
Definition: sql_show.h:330
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:355
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:360
Table_ident *const m_table_ident
Definition: sql_show.h:331
Sql_cmd_show_create_table(bool is_view, Table_ident *table_ident)
Definition: sql_show.h:322
Represents SHOW CREATE TRIGGER statement.
Definition: sql_show.h:336
Sql_cmd_show_create_trigger()
Definition: sql_show.h:338
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:429
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:431
Represents SHOW CREATE USER statement.
Definition: sql_show.h:346
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
Sql_cmd_show_create_user()
Definition: sql_show.h:348
Represents SHOW DATABASES statement.
Definition: sql_show.h:355
Sql_cmd_show_databases()
Definition: sql_show.h:357
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:455
Represents SHOW ENGINE LOGS statement.
Definition: sql_show.h:363
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:469
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:465
Sql_cmd_show_engine_logs()
Definition: sql_show.h:365
Represents SHOW ENGINE MUTEX statement.
Definition: sql_show.h:372
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:477
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:473
Sql_cmd_show_engine_mutex()
Definition: sql_show.h:374
Represents SHOW ENGINE STATUS statement.
Definition: sql_show.h:381
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:485
Sql_cmd_show_engine_status()
Definition: sql_show.h:383
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:481
Represents SHOW STORAGE ENGINES statement.
Definition: sql_show.h:391
Sql_cmd_show_engines()
Definition: sql_show.h:393
Represents SHOW ERRORS statement.
Definition: sql_show.h:398
Sql_cmd_show_errors()
Definition: sql_show.h:400
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:401
Represents SHOW EVENTS statement.
Definition: sql_show.h:408
Sql_cmd_show_events()
Definition: sql_show.h:410
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:489
bool check_parameters(THD *) override
Definition: sql_show.h:413
Represents SHOW GRANTS statement.
Definition: sql_show.h:418
const LEX_USER * for_user
Definition: sql_show.h:430
const List< LEX_USER > * using_users
Definition: sql_show.h:431
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:521
Sql_cmd_show_grants(const LEX_USER *for_user_arg, const List< LEX_USER > *using_users_arg)
Definition: sql_show.h:420
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:516
Represents the SHOW INDEX statement.
Definition: sql_show.h:436
Sql_cmd_show_keys()
Definition: sql_show.h:438
Common base class: Represents commands that are not represented by a plan that is equivalent to a SEL...
Definition: sql_show.h:186
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.h:190
Sql_cmd_show_noplan(enum_sql_command sql_command)
Definition: sql_show.h:188
Represents SHOW OPEN TABLES statement.
Definition: sql_show.h:453
Sql_cmd_show_open_tables()
Definition: sql_show.h:455
Represents SHOW PARSE_TREE statement.
Definition: sql_show.h:495
Sql_cmd_show_parse_tree()
Definition: sql_show.h:497
Represents SHOW PLUGINS statement.
Definition: sql_show.h:460
Sql_cmd_show_plugins()
Definition: sql_show.h:462
Represents SHOW PRIVILEGES statement.
Definition: sql_show.h:467
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:580
Sql_cmd_show_privileges()
Definition: sql_show.h:469
Represents SHOW PROCESSLIST statement.
Definition: sql_show.h:475
Sql_cmd_show_processlist(bool verbose)
Definition: sql_show.h:478
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:591
Sql_cmd_show_processlist()
Definition: sql_show.h:477
void set_use_pfs(bool use_pfs)
Definition: sql_show.h:483
const bool m_verbose
Definition: sql_show.h:489
bool use_pfs()
Definition: sql_show.h:487
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:584
bool verbose() const
Definition: sql_show.h:484
bool m_use_pfs
Definition: sql_show.h:490
Represents SHOW PROFILE statement.
Definition: sql_show.h:502
Sql_cmd_show_profile()
Definition: sql_show.h:504
Represents SHOW PROFILES statement.
Definition: sql_show.h:509
Sql_cmd_show_profiles()
Definition: sql_show.h:511
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:570
Represents SHOW RELAYLOG EVENTS statement.
Definition: sql_show.h:517
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:615
Sql_cmd_show_relaylog_events()
Definition: sql_show.h:519
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:611
Represents SHOW REPLICA STATUS statement.
Definition: sql_show.h:541
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:660
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:656
Sql_cmd_show_replica_status()
Definition: sql_show.h:543
Represents SHOW REPLICAS statement.
Definition: sql_show.h:532
Sql_cmd_show_replicas()
Definition: sql_show.h:534
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:652
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:648
Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
Definition: sql_show.h:221
const sp_name * m_routine_name
Definition: sql_show.h:230
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:623
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:618
Sql_cmd_show_routine_code(enum_sql_command sql_command, const sp_name *routine_name)
Definition: sql_show.h:223
Common base class: Represents commands that operate on a schema (database)
Definition: sql_show.h:200
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:241
bool check_parameters(THD *thd) override
Definition: sql_show.cc:270
bool set_metadata_lock(THD *thd)
Definition: sql_show.cc:224
Sql_cmd_show_schema_base(enum_sql_command command)
Definition: sql_show.h:202
Represents SHOW STATUS FUNCTION statement.
Definition: sql_show.h:559
Sql_cmd_show_status_func()
Definition: sql_show.h:561
Represents SHOW STATUS PROCEDURE statement.
Definition: sql_show.h:566
Sql_cmd_show_status_proc()
Definition: sql_show.h:568
Represents SHOW STATUS statement.
Definition: sql_show.h:551
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:761
Sql_cmd_show_status()
Definition: sql_show.h:553
Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
Definition: sql_show.h:210
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:287
bool check_parameters(THD *thd) override
Definition: sql_show.cc:711
bool m_temporary
True if table to be analyzed is temporary.
Definition: sql_show.h:216
Sql_cmd_show_table_base(enum_sql_command command)
Definition: sql_show.h:212
Represents SHOW TABLE STATUS statement.
Definition: sql_show.h:573
Sql_cmd_show_table_status()
Definition: sql_show.h:575
Represents SHOW TABLES statement.
Definition: sql_show.h:581
Sql_cmd_show_tables()
Definition: sql_show.h:583
Represents SHOW TRIGGERS statement.
Definition: sql_show.h:588
Sql_cmd_show_triggers()
Definition: sql_show.h:590
Represents SHOW VARIABLES statement.
Definition: sql_show.h:595
Sql_cmd_show_variables()
Definition: sql_show.h:597
Represents SHOW WARNINGS statement.
Definition: sql_show.h:602
Sql_cmd_show_warnings()
Definition: sql_show.h:604
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:605
Sql_cmd_show represents the SHOW statements that are implemented as SELECT statements internally.
Definition: sql_show.h:164
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:216
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_show.h:168
virtual bool check_parameters(THD *)
Definition: sql_show.h:169
Sql_cmd_show(enum_sql_command sql_command)
Definition: sql_show.h:166
enum_sql_command m_sql_command
Definition: sql_show.h:176
bool check_privileges(THD *) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:209
bool precheck(THD *thd) override
Generally, the SHOW commands do not distinguish precheck and regular check.
Definition: sql_show.h:171
@ SL_NOTE
Definition: sql_error.h:63
@ SL_ERROR
Definition: sql_error.h:63
@ SL_WARNING
Definition: sql_error.h:63
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
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:1001
Definition: sql_lex.h:297
Definition: table.h:2900
ST_SCHEMA_TABLE * schema_table
Definition: table.h:3757
Definition: sp_head.h:123
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:1091
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_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_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_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:66
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:1105
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
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
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2880
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:922
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:742
ST_SCHEMA_TABLE * find_schema_table(THD *thd, const char *table_name)
Definition: sql_show.cc:4524
void reset_status_vars()
Definition: sql_show.cc:3331
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:3831
int get_quote_char_for_identifier(const THD *thd, const char *name, size_t length)
Definition: sql_show.cc:1594
bool schema_table_store_record(THD *thd, TABLE *table)
Definition: sql_show.cc:3765
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:4899
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:3554
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:3821
void free_status_vars()
Definition: sql_show.cc:3355
void mysqld_list_processes(THD *thd, const char *user, bool verbose, bool has_cursor)
List running processes (actually connected sessions).
Definition: sql_show.cc:2967
void init_status_vars()
Definition: sql_show.cc:3325
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:161
bool mysqld_show_privileges(THD *thd)
Definition: sql_show.cc:958
ulonglong get_status_vars_version(void)
Definition: sql_show.cc:3344
TYPELIB grant_types
Definition: sql_show.cc:194
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:3527
ST_SCHEMA_TABLE * get_schema_table(enum enum_schema_tables schema_table_idx)
Definition: sql_show.cc:4543
void view_store_options(const THD *thd, Table_ref *table, String *buff)
Definition: sql_show.cc:2650
void mysqld_list_fields(THD *thd, Table_ref *table, const char *wild)
Definition: sql_show.cc:1378
void calc_sum_of_all_status(System_status_var *to)
Definition: sql_show.cc:3739
bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error)
Convert HEAP table to InnoDB table if necessary.
Definition: sql_show.cc:3804
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:4828
bool mysql_schema_table(THD *thd, LEX *lex, Table_ref *table_list)
Create information_schema table.
Definition: sql_show.cc:4749
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:3786
std::atomic_ulong deprecated_use_i_s_processlist_count
Count number of times information_schema.processlist has been used.
Definition: sql_show.cc:158
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:1509
void remove_status_vars(SHOW_VAR *list)
Definition: sql_show.cc:3476
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:2692
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:3450
bool add_status_vars(const SHOW_VAR *list)
Definition: sql_show.cc:3299
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:5581
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:1945
bool show_create_trigger(THD *thd, const sp_name *trg_name)
SHOW CREATE TRIGGER high-level implementation.
Definition: sql_show.cc:5400
void initialize_information_schema_acl()
Definition: sql_show.cc:5473
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create)
Definition: sql_show.cc:1265
bool mysqld_show_create(THD *thd, Table_ref *table_list)
Definition: sql_show.cc:1110
case opt name
Definition: sslopt-case.h:29
enum_mysql_show_type
Declarations for SHOW STATUS support in plugins.
Definition: status_var.h:30
Definition: m_ctype.h:421
Struct to hold information about the table that should be created.
Definition: handler.h:3210
Definition: table.h:2767
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3844
Definition: mysql_lex_string.h:40
SHOW STATUS Server status variable.
Definition: status_var.h:79
Definition: table.h:2565
Per thread status variables.
Definition: system_variables.h:525
Definition: table.h:1421
Definition: typelib.h:35
command
Definition: version_token.cc:280
static int is_view(cargo_type x)
Definition: xcom_base.cc:2160