MySQL 8.0.29
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 "lex_string.h"
30#include "my_inttypes.h"
31#include "mysql/status_var.h"
32#include "sql/sql_select.h"
33#include "typelib.h"
34
35/* Forward declarations */
36class Item;
37class JOIN;
38class QEP_TAB;
39class Query_block;
40class String;
41class Table_ident;
42class THD;
43class sp_name;
44struct CHARSET_INFO;
45struct HA_CREATE_INFO;
46struct LEX;
47struct ST_SCHEMA_TABLE;
49struct TABLE;
50struct TABLE_LIST;
52enum enum_schema_tables : int;
53enum enum_var_type : int;
54enum enum_field_types : 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
64void append_identifier(const THD *thd, String *packet, const char *name,
65 size_t length, const CHARSET_INFO *from_cs,
66 const CHARSET_INFO *to_cs);
67
68void append_identifier(const THD *thd, String *packet, const char *name,
69 size_t length);
70
71void mysqld_list_fields(THD *thd, TABLE_LIST *table, const char *wild);
72bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
73bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
74
75void mysqld_list_processes(THD *thd, const char *user, bool verbose,
76 bool has_cursor);
79void append_definer(const THD *thd, String *buffer,
80 const LEX_CSTRING &definer_user,
81 const LEX_CSTRING &definer_host);
82bool add_status_vars(const SHOW_VAR *list);
84void init_status_vars();
85void free_status_vars();
86bool get_status_var(THD *thd, SHOW_VAR *list, const char *name,
87 char *const buff, enum_var_type var_type, size_t *length);
90bool show_create_trigger(THD *thd, const sp_name *trg_name);
91void view_store_options(const THD *thd, TABLE_LIST *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_LIST *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
147bool do_fill_information_schema_table(THD *thd, TABLE_LIST *table_list,
148 Item *condition);
149
150extern TYPELIB grant_types;
151
152/**
153 Sql_cmd_show represents the SHOW statements that are implemented
154 as SELECT statements internally.
155 Normally, preparation and execution is the same as for regular SELECT
156 statements.
157*/
159 public:
161 : Sql_cmd_select(nullptr), m_sql_command(sql_command) {}
163 virtual bool check_parameters(THD *) { return false; }
164 /// Generally, the SHOW commands do not distinguish precheck and regular check
165 bool precheck(THD *thd) override { return check_privileges(thd); }
166 bool check_privileges(THD *) override;
167 bool execute(THD *thd) override;
168
169 protected:
171};
172
173/**
174 Common base class: Represents commands that are not represented by
175 a plan that iss equivalent to a SELECT statement.
176
177 This class has a common execution framework with an execute() function
178 that calls check_privileges() and execute_inner().
179*/
181 protected:
183 : Sql_cmd_show(sql_command) {}
184 bool execute(THD *thd) override {
185 lex = thd->lex;
186 if (check_privileges(thd)) return true;
187 if (execute_inner(thd)) return true;
188 return false;
189 }
190};
191
192/// Common base class: Represents commands that operate on a schema (database)
193
195 public:
197 bool check_privileges(THD *thd) override;
198 bool check_parameters(THD *thd) override;
199 bool set_metadata_lock(THD *thd);
200};
201
202/// Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
203
205 public:
207 bool check_privileges(THD *thd) override;
208 bool check_parameters(THD *thd) override;
209
210 bool m_temporary; ///< True if table to be analyzed is temporary
211};
212
213/// Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
214
216 public:
218 const sp_name *routine_name)
219 : Sql_cmd_show_noplan(sql_command), m_routine_name(routine_name) {}
220 bool check_privileges(THD *thd) override;
221 bool execute_inner(THD *thd) override;
222
223 private:
225};
226
227/// Following are all subclasses of class Sql_cmd_show, in alphabetical order
228
229/// Represents SHOW BINLOG EVENTS statement.
230
232 public:
235 bool check_privileges(THD *thd) override;
236 bool execute_inner(THD *thd) override;
237
238 private:
239 // binlog_in
240 // binlog_from
241 // opt_limit
242};
243
244/// Represents SHOW BINARY LOGS statement.
245
247 public:
249 bool check_privileges(THD *thd) override;
250 bool execute_inner(THD *thd) override;
251};
252
253/// Represents SHOW CHARACTER SET statement.
254
256 public:
258};
259
260/// Represents SHOW COLLATION statement.
261
263 public:
265};
266
267/// Represents SHOW COLUMNS statement.
268
270 public:
272};
273
274/// Represents SHOW CREATE DATABASE statement.
275
277 public:
279 bool check_privileges(THD *thd) override;
280 bool execute_inner(THD *thd) override;
281};
282
283/// Represents SHOW CREATE EVENT statement.
284
286 public:
288 bool check_privileges(THD *thd) override;
289 bool execute_inner(THD *thd) override;
290};
291
292/// Represents SHOW CREATE FUNCTION statement.
293
295 public:
298 bool check_privileges(THD *thd) override;
299 bool execute_inner(THD *thd) override;
300};
301
302/// Represents SHOW CREATE PROCEDURE statement.
303
305 public:
308 bool check_privileges(THD *thd) override;
309 bool execute_inner(THD *thd) override;
310};
311
312/// Represents SHOW CREATE TABLE/VIEW statement.
313
315 public:
319 m_table_ident(table_ident) {}
320 bool check_privileges(THD *thd) override;
321 bool execute_inner(THD *thd) override;
322
323 private:
324 const bool m_is_view;
326};
327
328/// Represents SHOW CREATE TRIGGER statement.
329
331 public:
334 bool check_privileges(THD *thd) override;
335 bool execute_inner(THD *thd) override;
336};
337
338/// Represents SHOW CREATE USER statement.
339
341 public:
343 bool check_privileges(THD *thd) override;
344 bool execute_inner(THD *thd) override;
345};
346
347/// Represents SHOW DATABASES statement.
348
350 public:
352 bool check_privileges(THD *thd) override;
353};
354
355/// Represents SHOW ENGINE LOGS statement.
356
358 public:
360 bool check_privileges(THD *thd) override;
361 bool execute_inner(THD *thd) override;
362};
363
364/// Represents SHOW ENGINE MUTEX statement.
365
367 public:
369 bool check_privileges(THD *thd) override;
370 bool execute_inner(THD *thd) override;
371};
372
373/// Represents SHOW ENGINE STATUS statement.
374
376 public:
379 bool check_privileges(THD *thd) override;
380 bool execute_inner(THD *thd) override;
381};
382
383/// Represents SHOW STORAGE ENGINES statement.
384
386 public:
388};
389
390/// Represents SHOW ERRORS statement.
391
393 public:
395 bool execute_inner(THD *thd) override {
397 }
398};
399
400/// Represents SHOW EVENTS statement.
401
403 public:
405 bool check_privileges(THD *thd) override;
406 // To enable error message for unknown database, delete the below function.
407 bool check_parameters(THD *) override { return false; }
408};
409
410/// Represents SHOW GRANTS statement.
411
413 public:
414 Sql_cmd_show_grants(const LEX_USER *for_user_arg,
415 const List<LEX_USER> *using_users_arg)
417 for_user(for_user_arg),
418 using_users(using_users_arg) {}
419
420 bool check_privileges(THD *thd) override;
421 bool execute_inner(THD *thd) override;
422
423 private:
426};
427
428/// Represents the SHOW INDEX statement.
429
431 public:
433};
434
435/// Represents SHOW MASTER STATUS statement.
436
438 public:
440 bool check_privileges(THD *thd) override;
441 bool execute_inner(THD *thd) override;
442};
443
444/// Represents SHOW OPEN TABLES statement.
445
447 public:
449};
450
451/// Represents SHOW PLUGINS statement.
452
454 public:
456};
457
458/// Represents SHOW PRIVILEGES statement.
459
461 public:
463 bool execute_inner(THD *thd) override;
464};
465
466/// Represents SHOW PROCESSLIST statement.
467
469 public:
473 bool check_privileges(THD *thd) override;
474 bool execute_inner(THD *thd) override;
475
477 bool verbose() const { return m_verbose; }
478
479 private:
480 bool use_pfs() { return m_use_pfs; }
481
482 const bool m_verbose{false};
483 bool m_use_pfs{false};
484};
485
486/// Represents SHOW PROFILE statement.
487
489 public:
491};
492
493/// Represents SHOW PROFILES statement.
494
496 public:
498 bool execute_inner(THD *thd) override;
499};
500
501/// Represents SHOW RELAYLOG EVENTS statement.
502
504 public:
507 bool check_privileges(THD *thd) override;
508 bool execute_inner(THD *thd) override;
509
510 private:
511 // binlog_in
512 // binlog_from
513 // opt_limit
514};
515
516/// Represents SHOW REPLICAS statement.
517
519 public:
521 bool check_privileges(THD *thd) override;
522 bool execute_inner(THD *thd) override;
523};
524
525/// Represents SHOW REPLICA STATUS statement.
526
528 public:
530 bool check_privileges(THD *thd) override;
531 bool execute_inner(THD *thd) override;
532};
533
534/// Represents SHOW STATUS statement.
535
537 public:
539 bool execute(THD *thd) override;
540};
541
542/// Represents SHOW STATUS FUNCTION statement.
543
545 public:
547};
548
549/// Represents SHOW STATUS PROCEDURE statement.
550
552 public:
554};
555
556/// Represents SHOW TABLE STATUS statement.
557
559 public:
562};
563
564/// Represents SHOW TABLES statement.
565
567 public:
569};
570
571/// Represents SHOW TRIGGERS statement.
572
574 public:
576};
577
578/// Represents SHOW VARIABLES statement.
579
581 public:
583};
584
585/// Represents SHOW WARNINGS statement.
586
588 public:
590 bool execute_inner(THD *thd) override {
591 return mysqld_show_warnings(thd,
592 (1UL << (uint)Sql_condition::SL_NOTE) |
594 (1UL << (uint)Sql_condition::SL_ERROR));
595 }
596};
597
598#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:231
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:297
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:301
Sql_cmd_show_binlog_events()
Definition: sql_show.h:233
Represents SHOW BINARY LOGS statement.
Definition: sql_show.h:246
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:305
Sql_cmd_show_binlogs()
Definition: sql_show.h:248
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:309
Represents SHOW CHARACTER SET statement.
Definition: sql_show.h:255
Sql_cmd_show_charsets()
Definition: sql_show.h:257
Represents SHOW COLLATION statement.
Definition: sql_show.h:262
Sql_cmd_show_collations()
Definition: sql_show.h:264
Represents SHOW COLUMNS statement.
Definition: sql_show.h:269
Sql_cmd_show_columns()
Definition: sql_show.h:271
Represents SHOW CREATE DATABASE statement.
Definition: sql_show.h:276
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:311
Sql_cmd_show_create_database()
Definition: sql_show.h:278
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:313
Represents SHOW CREATE EVENT statement.
Definition: sql_show.h:285
Sql_cmd_show_create_event()
Definition: sql_show.h:287
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:323
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:321
Represents SHOW CREATE FUNCTION statement.
Definition: sql_show.h:294
Sql_cmd_show_create_function()
Definition: sql_show.h:296
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:328
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:330
Represents SHOW CREATE PROCEDURE statement.
Definition: sql_show.h:304
Sql_cmd_show_create_procedure()
Definition: sql_show.h:306
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:336
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:334
Represents SHOW CREATE TABLE/VIEW statement.
Definition: sql_show.h:314
const bool m_is_view
Definition: sql_show.h:324
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:340
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:345
Table_ident *const m_table_ident
Definition: sql_show.h:325
Sql_cmd_show_create_table(bool is_view, Table_ident *table_ident)
Definition: sql_show.h:316
Represents SHOW CREATE TRIGGER statement.
Definition: sql_show.h:330
Sql_cmd_show_create_trigger()
Definition: sql_show.h:332
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:413
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:415
Represents SHOW CREATE USER statement.
Definition: sql_show.h:340
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:424
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:426
Sql_cmd_show_create_user()
Definition: sql_show.h:342
Represents SHOW DATABASES statement.
Definition: sql_show.h:349
Sql_cmd_show_databases()
Definition: sql_show.h:351
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:439
Represents SHOW ENGINE LOGS statement.
Definition: sql_show.h:357
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:453
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:449
Sql_cmd_show_engine_logs()
Definition: sql_show.h:359
Represents SHOW ENGINE MUTEX statement.
Definition: sql_show.h:366
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:461
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:457
Sql_cmd_show_engine_mutex()
Definition: sql_show.h:368
Represents SHOW ENGINE STATUS statement.
Definition: sql_show.h:375
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:469
Sql_cmd_show_engine_status()
Definition: sql_show.h:377
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:465
Represents SHOW STORAGE ENGINES statement.
Definition: sql_show.h:385
Sql_cmd_show_engines()
Definition: sql_show.h:387
Represents SHOW ERRORS statement.
Definition: sql_show.h:392
Sql_cmd_show_errors()
Definition: sql_show.h:394
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:395
Represents SHOW EVENTS statement.
Definition: sql_show.h:402
Sql_cmd_show_events()
Definition: sql_show.h:404
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:473
bool check_parameters(THD *) override
Definition: sql_show.h:407
Represents SHOW GRANTS statement.
Definition: sql_show.h:412
const LEX_USER * for_user
Definition: sql_show.h:424
const List< LEX_USER > * using_users
Definition: sql_show.h:425
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:505
Sql_cmd_show_grants(const LEX_USER *for_user_arg, const List< LEX_USER > *using_users_arg)
Definition: sql_show.h:414
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:500
Represents the SHOW INDEX statement.
Definition: sql_show.h:430
Sql_cmd_show_keys()
Definition: sql_show.h:432
Represents SHOW MASTER STATUS statement.
Definition: sql_show.h:437
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:550
Sql_cmd_show_master_status()
Definition: sql_show.h:439
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:546
Common base class: Represents commands that are not represented by a plan that iss equivalent to a SE...
Definition: sql_show.h:180
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.h:184
Sql_cmd_show_noplan(enum_sql_command sql_command)
Definition: sql_show.h:182
Represents SHOW OPEN TABLES statement.
Definition: sql_show.h:446
Sql_cmd_show_open_tables()
Definition: sql_show.h:448
Represents SHOW PLUGINS statement.
Definition: sql_show.h:453
Sql_cmd_show_plugins()
Definition: sql_show.h:455
Represents SHOW PRIVILEGES statement.
Definition: sql_show.h:460
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:564
Sql_cmd_show_privileges()
Definition: sql_show.h:462
Represents SHOW PROCESSLIST statement.
Definition: sql_show.h:468
Sql_cmd_show_processlist(bool verbose)
Definition: sql_show.h:471
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:575
Sql_cmd_show_processlist()
Definition: sql_show.h:470
void set_use_pfs(bool use_pfs)
Definition: sql_show.h:476
const bool m_verbose
Definition: sql_show.h:482
bool use_pfs()
Definition: sql_show.h:480
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:568
bool verbose() const
Definition: sql_show.h:477
bool m_use_pfs
Definition: sql_show.h:483
Represents SHOW PROFILE statement.
Definition: sql_show.h:488
Sql_cmd_show_profile()
Definition: sql_show.h:490
Represents SHOW PROFILES statement.
Definition: sql_show.h:495
Sql_cmd_show_profiles()
Definition: sql_show.h:497
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:554
Represents SHOW RELAYLOG EVENTS statement.
Definition: sql_show.h:503
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:599
Sql_cmd_show_relaylog_events()
Definition: sql_show.h:505
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:595
Represents SHOW REPLICA STATUS statement.
Definition: sql_show.h:527
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:644
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:640
Sql_cmd_show_replica_status()
Definition: sql_show.h:529
Represents SHOW REPLICAS statement.
Definition: sql_show.h:518
Sql_cmd_show_replicas()
Definition: sql_show.h:520
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:636
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:632
Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
Definition: sql_show.h:215
const sp_name * m_routine_name
Definition: sql_show.h:224
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:607
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:602
Sql_cmd_show_routine_code(enum_sql_command sql_command, const sp_name *routine_name)
Definition: sql_show.h:217
Common base class: Represents commands that operate on a schema (database)
Definition: sql_show.h:194
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:226
bool check_parameters(THD *thd) override
Definition: sql_show.cc:255
bool set_metadata_lock(THD *thd)
Definition: sql_show.cc:209
Sql_cmd_show_schema_base(enum_sql_command command)
Definition: sql_show.h:196
Represents SHOW STATUS FUNCTION statement.
Definition: sql_show.h:544
Sql_cmd_show_status_func()
Definition: sql_show.h:546
Represents SHOW STATUS PROCEDURE statement.
Definition: sql_show.h:551
Sql_cmd_show_status_proc()
Definition: sql_show.h:553
Represents SHOW STATUS statement.
Definition: sql_show.h:536
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:745
Sql_cmd_show_status()
Definition: sql_show.h:538
Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
Definition: sql_show.h:204
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:272
bool check_parameters(THD *thd) override
Definition: sql_show.cc:695
bool m_temporary
True if table to be analyzed is temporary.
Definition: sql_show.h:210
Sql_cmd_show_table_base(enum_sql_command command)
Definition: sql_show.h:206
Represents SHOW TABLE STATUS statement.
Definition: sql_show.h:558
Sql_cmd_show_table_status()
Definition: sql_show.h:560
Represents SHOW TABLES statement.
Definition: sql_show.h:566
Sql_cmd_show_tables()
Definition: sql_show.h:568
Represents SHOW TRIGGERS statement.
Definition: sql_show.h:573
Sql_cmd_show_triggers()
Definition: sql_show.h:575
Represents SHOW VARIABLES statement.
Definition: sql_show.h:580
Sql_cmd_show_variables()
Definition: sql_show.h:582
Represents SHOW WARNINGS statement.
Definition: sql_show.h:587
Sql_cmd_show_warnings()
Definition: sql_show.h:589
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:590
Sql_cmd_show represents the SHOW statements that are implemented as SELECT statements internally.
Definition: sql_show.h:158
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:201
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_show.h:162
virtual bool check_parameters(THD *)
Definition: sql_show.h:163
Sql_cmd_show(enum_sql_command sql_command)
Definition: sql_show.h:160
enum_sql_command m_sql_command
Definition: sql_show.h:170
bool check_privileges(THD *) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:194
bool precheck(THD *thd) override
Generally, the SHOW commands do not distinguish precheck and regular check.
Definition: sql_show.h:165
@ 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:945
LEX * lex
Definition: sql_class.h:1003
Definition: sql_lex.h:292
Definition: sp_head.h:119
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
enum_field_types
Column types for MySQL.
Definition: field_types.h:57
virtual bool execute_inner(THD *thd)
The inner parts of query optimization and execution.
Definition: sql_select.cc:766
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
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:4280
void reset_status_vars()
Definition: sql_show.cc:3184
enum enum_mysql_show_type SHOW_TYPE
Definition: sql_show.h:51
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
Definition: sql_show.cc:3620
int get_quote_char_for_identifier(const THD *thd, const char *name, size_t length)
Definition: sql_show.cc:1583
bool schema_table_store_record(THD *thd, TABLE *table)
Definition: sql_show.cc:3554
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:4648
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:3343
bool mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
Create information_schema table.
Definition: sql_show.cc:4499
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:5355
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:3610
void mysqld_list_fields(THD *thd, TABLE_LIST *table, const char *wild)
Definition: sql_show.cc:1366
void free_status_vars()
Definition: sql_show.cc:3208
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:3230
void mysqld_list_processes(THD *thd, const char *user, bool verbose, bool has_cursor)
List running processes (actually connected sessions).
Definition: sql_show.cc:2837
enum enum_schema_tables int enum enum_var_type int enum constexpr enum_field_types 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)
Characters shown for the command in 'show processlist'.
Definition: sql_show.cc:1861
void init_status_vars()
Definition: sql_show.cc:3178
bool mysqld_show_privileges(THD *thd)
Definition: sql_show.cc:942
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list)
Definition: sql_show.cc:1094
ulonglong get_status_vars_version(void)
Definition: sql_show.cc:3197
TYPELIB grant_types
Definition: sql_show.cc:179
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:3316
ST_SCHEMA_TABLE * get_schema_table(enum enum_schema_tables schema_table_idx)
Definition: sql_show.cc:4299
void view_store_options(const THD *thd, TABLE_LIST *table, String *buff)
Definition: sql_show.cc:2529
void calc_sum_of_all_status(System_status_var *to)
Definition: sql_show.cc:3528
bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error)
Convert HEAP table to InnoDB table if necessary.
Definition: sql_show.cc:3593
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:4577
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:3575
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:1498
void remove_status_vars(SHOW_VAR *list)
Definition: sql_show.cc:3265
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:2571
bool add_status_vars(const SHOW_VAR *list)
Definition: sql_show.cc:3152
bool show_create_trigger(THD *thd, const sp_name *trg_name)
SHOW CREATE TRIGGER high-level implementation.
Definition: sql_show.cc:5174
void initialize_information_schema_acl()
Definition: sql_show.cc:5247
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create)
Definition: sql_show.cc:1248
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:2790
Definition: table.h:2551
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3659
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:467
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:2150