MySQL  8.0.27
Source Code Documentation
sql_show.h
Go to the documentation of this file.
1 /* Copyright (c) 2005, 2021, 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 */
36 class Item;
37 class JOIN;
38 class QEP_TAB;
39 class Query_block;
40 class String;
41 class Table_ident;
42 class THD;
43 class sp_name;
44 struct CHARSET_INFO;
45 struct HA_CREATE_INFO;
46 struct LEX;
47 struct ST_SCHEMA_TABLE;
48 struct System_status_var;
49 struct TABLE;
50 struct TABLE_LIST;
51 typedef enum enum_mysql_show_type SHOW_TYPE;
52 enum enum_schema_tables : int;
53 enum enum_var_type : int;
54 enum enum_field_types : int;
55 
56 bool store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
57  HA_CREATE_INFO *create_info_arg, bool show_database);
58 
59 void append_identifier(const THD *thd, String *packet, const char *name,
60  size_t length, const CHARSET_INFO *from_cs,
61  const CHARSET_INFO *to_cs);
62 
63 void append_identifier(const THD *thd, String *packet, const char *name,
64  size_t length);
65 
66 void mysqld_list_fields(THD *thd, TABLE_LIST *table, const char *wild);
67 bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
68 bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
69 
70 void mysqld_list_processes(THD *thd, const char *user, bool verbose);
71 bool mysqld_show_privileges(THD *thd);
73 void append_definer(const THD *thd, String *buffer,
74  const LEX_CSTRING &definer_user,
75  const LEX_CSTRING &definer_host);
76 bool add_status_vars(const SHOW_VAR *list);
77 void remove_status_vars(SHOW_VAR *list);
78 void init_status_vars();
79 void free_status_vars();
80 bool get_status_var(THD *thd, SHOW_VAR *list, const char *name,
81  char *const buff, enum_var_type var_type, size_t *length);
82 void reset_status_vars();
84 bool show_create_trigger(THD *thd, const sp_name *trg_name);
85 void view_store_options(const THD *thd, TABLE_LIST *table, String *buff);
86 
88 
89 /**
90  Store record to I_S table, convert HEAP table to InnoDB table if necessary.
91 
92  @param[in] thd thread handler
93  @param[in] table Information schema table to be updated
94  @param[in] make_ondisk if true, convert heap table to on disk table.
95  default value is true.
96  @return 0 on success
97  @return error code on failure.
98 */
99 int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk);
100 
101 /**
102  Convert HEAP table to InnoDB table if necessary
103 
104  @param[in] thd thread handler
105  @param[in] table Information schema table to be converted.
106  @param[in] error the error code returned previously.
107  @return false on success, true on error.
108 */
111 bool make_table_list(THD *thd, Query_block *sel, const LEX_CSTRING &db_name,
112  const LEX_CSTRING &table_name);
113 
114 ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char *table_name);
115 ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
116 bool make_schema_query_block(THD *thd, Query_block *sel,
117  enum enum_schema_tables schema_table_idx);
118 bool mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list);
120 
121 const char *get_one_variable(THD *thd, const SHOW_VAR *variable,
123  System_status_var *status_var,
124  const CHARSET_INFO **charset, char *buff,
125  size_t *length, bool *is_null = nullptr);
126 
127 const char *get_one_variable_ext(THD *running_thd, THD *target_thd,
128  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 
134 /* These functions were under INNODB_COMPATIBILITY_HOOKS */
135 int get_quote_char_for_identifier(const THD *thd, const char *name,
136  size_t length);
137 
138 void show_sql_type(enum_field_types type, bool is_array, uint metadata,
139  String *str, const CHARSET_INFO *field_cs = nullptr);
140 
141 bool do_fill_information_schema_table(THD *thd, TABLE_LIST *table_list,
142  Item *condition);
143 
144 extern TYPELIB grant_types;
145 
146 /**
147  Sql_cmd_show represents the SHOW statements that are implemented
148  as SELECT statements internally.
149  Normally, preparation and execution is the same as for regular SELECT
150  statements.
151 */
152 class Sql_cmd_show : public Sql_cmd_select {
153  public:
155  : Sql_cmd_select(nullptr), m_sql_command(sql_command) {}
156  enum_sql_command sql_command_code() const override { return m_sql_command; }
157  virtual bool check_parameters(THD *) { return false; }
158  /// Generally, the SHOW commands do not distinguish precheck and regular check
159  bool precheck(THD *thd) override { return check_privileges(thd); }
160  bool check_privileges(THD *) override;
161  bool execute(THD *thd) override;
162 
163  protected:
164  // Use for SHOW commands that operate on a single table.
165  bool check_privileges_for_table(THD *thd, bool is_temporary);
167 };
168 
169 /**
170  Common base class: Represents commands that are not represented by
171  a plan that iss equivalent to a SELECT statement.
172 
173  This class has a common execution framework with an execute() function
174  that calls check_privileges() and execute_inner().
175 */
177  protected:
179  : Sql_cmd_show(sql_command) {}
180  bool execute(THD *thd) override {
181  lex = thd->lex;
182  if (check_privileges(thd)) return true;
183  if (execute_inner(thd)) return true;
184  return false;
185  }
186 };
187 
188 /// Common base class: Represents commands that operate on a schema (database)
189 
191  public:
193  bool check_privileges(THD *thd) override;
194  bool check_parameters(THD *thd) override;
195  bool set_metadata_lock(THD *thd);
196 };
197 
198 /// Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
199 
201  public:
203  bool check_privileges(THD *thd) override;
204  bool check_parameters(THD *thd) override;
205 
206  bool m_temporary; ///< True if table to be analyzed is temporary
207 };
208 
209 /// Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
210 
212  public:
214  const sp_name *routine_name)
215  : Sql_cmd_show_noplan(sql_command), m_routine_name(routine_name) {}
216  bool check_privileges(THD *thd) override;
217  bool execute_inner(THD *thd) override;
218 
219  private:
221 };
222 
223 /// Following are all subclasses of class Sql_cmd_show, in alphabetical order
224 
225 /// Represents SHOW BINLOG EVENTS statement.
226 
228  public:
231  bool check_privileges(THD *thd) override;
232  bool execute_inner(THD *thd) override;
233 
234  private:
235  // binlog_in
236  // binlog_from
237  // opt_limit
238 };
239 
240 /// Represents SHOW BINARY LOGS statement.
241 
243  public:
245  bool check_privileges(THD *thd) override;
246  bool execute_inner(THD *thd) override;
247 };
248 
249 /// Represents SHOW CHARACTER SET statement.
250 
252  public:
254 };
255 
256 /// Represents SHOW COLLATION statement.
257 
259  public:
261 };
262 
263 /// Represents SHOW COLUMNS statement.
264 
266  public:
268 };
269 
270 /// Represents SHOW CREATE DATABASE statement.
271 
273  public:
275  bool check_privileges(THD *thd) override;
276  bool execute_inner(THD *thd) override;
277 };
278 
279 /// Represents SHOW CREATE EVENT statement.
280 
282  public:
284  bool check_privileges(THD *thd) override;
285  bool execute_inner(THD *thd) override;
286 };
287 
288 /// Represents SHOW CREATE FUNCTION statement.
289 
291  public:
294  bool check_privileges(THD *thd) override;
295  bool execute_inner(THD *thd) override;
296 };
297 
298 /// Represents SHOW CREATE PROCEDURE statement.
299 
301  public:
304  bool check_privileges(THD *thd) override;
305  bool execute_inner(THD *thd) override;
306 };
307 
308 /// Represents SHOW CREATE TABLE/VIEW statement.
309 
311  public:
315  m_table_ident(table_ident) {}
316  bool check_privileges(THD *thd) override;
317  bool execute_inner(THD *thd) override;
318 
319  private:
320  const bool m_is_view;
322 };
323 
324 /// Represents SHOW CREATE TRIGGER statement.
325 
327  public:
330  bool check_privileges(THD *thd) override;
331  bool execute_inner(THD *thd) override;
332 };
333 
334 /// Represents SHOW CREATE USER statement.
335 
337  public:
339  bool check_privileges(THD *thd) override;
340  bool execute_inner(THD *thd) override;
341 };
342 
343 /// Represents SHOW DATABASES statement.
344 
346  public:
348  bool check_privileges(THD *thd) override;
349 };
350 
351 /// Represents SHOW ENGINE LOGS statement.
352 
354  public:
356  bool check_privileges(THD *thd) override;
357  bool execute_inner(THD *thd) override;
358 };
359 
360 /// Represents SHOW ENGINE MUTEX statement.
361 
363  public:
365  bool check_privileges(THD *thd) override;
366  bool execute_inner(THD *thd) override;
367 };
368 
369 /// Represents SHOW ENGINE STATUS statement.
370 
372  public:
375  bool check_privileges(THD *thd) override;
376  bool execute_inner(THD *thd) override;
377 };
378 
379 /// Represents SHOW STORAGE ENGINES statement.
380 
382  public:
384 };
385 
386 /// Represents SHOW ERRORS statement.
387 
389  public:
391  bool execute_inner(THD *thd) override {
393  }
394 };
395 
396 /// Represents SHOW EVENTS statement.
397 
399  public:
401  bool check_privileges(THD *thd) override;
402  // To enable error message for unknown database, delete the below function.
403  bool check_parameters(THD *) override { return false; }
404 };
405 
406 /// Represents SHOW GRANTS statement.
407 
409  public:
410  Sql_cmd_show_grants(const LEX_USER *for_user_arg,
411  const List<LEX_USER> *using_users_arg)
413  for_user(for_user_arg),
414  using_users(using_users_arg) {}
415 
416  bool check_privileges(THD *thd) override;
417  bool execute_inner(THD *thd) override;
418 
419  private:
422 };
423 
424 /// Represents the SHOW INDEX statement.
425 
427  public:
429 };
430 
431 /// Represents SHOW MASTER STATUS statement.
432 
434  public:
436  bool check_privileges(THD *thd) override;
437  bool execute_inner(THD *thd) override;
438 };
439 
440 /// Represents SHOW OPEN TABLES statement.
441 
443  public:
445 };
446 
447 /// Represents SHOW PLUGINS statement.
448 
450  public:
452 };
453 
454 /// Represents SHOW PRIVILEGES statement.
455 
457  public:
459  bool execute_inner(THD *thd) override;
460 };
461 
462 /// Represents SHOW PROCESSLIST statement.
463 
465  public:
469  bool check_privileges(THD *thd) override;
470  bool execute_inner(THD *thd) override;
471 
473  bool verbose() const { return m_verbose; }
474 
475  private:
476  bool use_pfs() { return m_use_pfs; }
478 
479  const bool m_verbose{false};
480  bool m_use_pfs{false};
481 };
482 
483 /// Represents SHOW PROFILE statement.
484 
486  public:
488 };
489 
490 /// Represents SHOW PROFILES statement.
491 
493  public:
495  bool execute_inner(THD *thd) override;
496 };
497 
498 /// Represents SHOW RELAYLOG EVENTS statement.
499 
501  public:
504  bool check_privileges(THD *thd) override;
505  bool execute_inner(THD *thd) override;
506 
507  private:
508  // binlog_in
509  // binlog_from
510  // opt_limit
511 };
512 
513 /// Represents SHOW REPLICAS statement.
514 
516  public:
518  bool check_privileges(THD *thd) override;
519  bool execute_inner(THD *thd) override;
520 };
521 
522 /// Represents SHOW REPLICA STATUS statement.
523 
525  public:
527  bool check_privileges(THD *thd) override;
528  bool execute_inner(THD *thd) override;
529 };
530 
531 /// Represents SHOW STATUS statement.
532 
534  public:
536  bool execute(THD *thd) override;
537 };
538 
539 /// Represents SHOW STATUS FUNCTION statement.
540 
542  public:
544 };
545 
546 /// Represents SHOW STATUS PROCEDURE statement.
547 
549  public:
551 };
552 
553 /// Represents SHOW TABLE STATUS statement.
554 
556  public:
559 };
560 
561 /// Represents SHOW TABLES statement.
562 
564  public:
566 };
567 
568 /// Represents SHOW TRIGGERS statement.
569 
571  public:
573 };
574 
575 /// Represents SHOW VARIABLES statement.
576 
578  public:
580 };
581 
582 /// Represents SHOW WARNINGS statement.
583 
585  public:
587  bool execute_inner(THD *thd) override {
588  return mysqld_show_warnings(thd,
589  (1UL << (uint)Sql_condition::SL_NOTE) |
590  (1UL << (uint)Sql_condition::SL_WARNING) |
591  (1UL << (uint)Sql_condition::SL_ERROR));
592  }
593 };
594 
595 #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_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:1123
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:227
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:296
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:300
Sql_cmd_show_binlog_events()
Definition: sql_show.h:229
Represents SHOW BINARY LOGS statement.
Definition: sql_show.h:242
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:304
Sql_cmd_show_binlogs()
Definition: sql_show.h:244
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:308
Represents SHOW CHARACTER SET statement.
Definition: sql_show.h:251
Sql_cmd_show_charsets()
Definition: sql_show.h:253
Represents SHOW COLLATION statement.
Definition: sql_show.h:258
Sql_cmd_show_collations()
Definition: sql_show.h:260
Represents SHOW COLUMNS statement.
Definition: sql_show.h:265
Sql_cmd_show_columns()
Definition: sql_show.h:267
Represents SHOW CREATE DATABASE statement.
Definition: sql_show.h:272
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:310
Sql_cmd_show_create_database()
Definition: sql_show.h:274
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:312
Represents SHOW CREATE EVENT statement.
Definition: sql_show.h:281
Sql_cmd_show_create_event()
Definition: sql_show.h:283
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:322
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:320
Represents SHOW CREATE FUNCTION statement.
Definition: sql_show.h:290
Sql_cmd_show_create_function()
Definition: sql_show.h:292
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:327
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:329
Represents SHOW CREATE PROCEDURE statement.
Definition: sql_show.h:300
Sql_cmd_show_create_procedure()
Definition: sql_show.h:302
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:335
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:333
Represents SHOW CREATE TABLE/VIEW statement.
Definition: sql_show.h:310
const bool m_is_view
Definition: sql_show.h:320
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:339
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:344
Table_ident *const m_table_ident
Definition: sql_show.h:321
Sql_cmd_show_create_table(bool is_view, Table_ident *table_ident)
Definition: sql_show.h:312
Represents SHOW CREATE TRIGGER statement.
Definition: sql_show.h:326
Sql_cmd_show_create_trigger()
Definition: sql_show.h:328
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:412
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:414
Represents SHOW CREATE USER statement.
Definition: sql_show.h:336
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:423
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:425
Sql_cmd_show_create_user()
Definition: sql_show.h:338
Represents SHOW DATABASES statement.
Definition: sql_show.h:345
Sql_cmd_show_databases()
Definition: sql_show.h:347
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:438
Represents SHOW ENGINE LOGS statement.
Definition: sql_show.h:353
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:452
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:448
Sql_cmd_show_engine_logs()
Definition: sql_show.h:355
Represents SHOW ENGINE MUTEX statement.
Definition: sql_show.h:362
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:460
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:456
Sql_cmd_show_engine_mutex()
Definition: sql_show.h:364
Represents SHOW ENGINE STATUS statement.
Definition: sql_show.h:371
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:468
Sql_cmd_show_engine_status()
Definition: sql_show.h:373
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:464
Represents SHOW STORAGE ENGINES statement.
Definition: sql_show.h:381
Sql_cmd_show_engines()
Definition: sql_show.h:383
Represents SHOW ERRORS statement.
Definition: sql_show.h:388
Sql_cmd_show_errors()
Definition: sql_show.h:390
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:391
Represents SHOW EVENTS statement.
Definition: sql_show.h:398
Sql_cmd_show_events()
Definition: sql_show.h:400
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:472
bool check_parameters(THD *) override
Definition: sql_show.h:403
Represents SHOW GRANTS statement.
Definition: sql_show.h:408
const LEX_USER * for_user
Definition: sql_show.h:420
const List< LEX_USER > * using_users
Definition: sql_show.h:421
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:504
Sql_cmd_show_grants(const LEX_USER *for_user_arg, const List< LEX_USER > *using_users_arg)
Definition: sql_show.h:410
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:499
Represents the SHOW INDEX statement.
Definition: sql_show.h:426
Sql_cmd_show_keys()
Definition: sql_show.h:428
Represents SHOW MASTER STATUS statement.
Definition: sql_show.h:433
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:549
Sql_cmd_show_master_status()
Definition: sql_show.h:435
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:545
Common base class: Represents commands that are not represented by a plan that iss equivalent to a SE...
Definition: sql_show.h:176
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.h:180
Sql_cmd_show_noplan(enum_sql_command sql_command)
Definition: sql_show.h:178
Represents SHOW OPEN TABLES statement.
Definition: sql_show.h:442
Sql_cmd_show_open_tables()
Definition: sql_show.h:444
Represents SHOW PLUGINS statement.
Definition: sql_show.h:449
Sql_cmd_show_plugins()
Definition: sql_show.h:451
Represents SHOW PRIVILEGES statement.
Definition: sql_show.h:456
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:563
Sql_cmd_show_privileges()
Definition: sql_show.h:458
Represents SHOW PROCESSLIST statement.
Definition: sql_show.h:464
Sql_cmd_show_processlist(bool verbose)
Definition: sql_show.h:467
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:574
Sql_cmd_show_processlist()
Definition: sql_show.h:466
void set_use_pfs(bool use_pfs)
Definition: sql_show.h:472
const bool m_verbose
Definition: sql_show.h:479
bool use_pfs()
Definition: sql_show.h:476
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:567
bool execute_with_performance_schema(THD *thd)
bool verbose() const
Definition: sql_show.h:473
bool m_use_pfs
Definition: sql_show.h:480
Represents SHOW PROFILE statement.
Definition: sql_show.h:485
Sql_cmd_show_profile()
Definition: sql_show.h:487
Represents SHOW PROFILES statement.
Definition: sql_show.h:492
Sql_cmd_show_profiles()
Definition: sql_show.h:494
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:553
Represents SHOW RELAYLOG EVENTS statement.
Definition: sql_show.h:500
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:598
Sql_cmd_show_relaylog_events()
Definition: sql_show.h:502
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:594
Represents SHOW REPLICA STATUS statement.
Definition: sql_show.h:524
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:643
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:639
Sql_cmd_show_replica_status()
Definition: sql_show.h:526
Represents SHOW REPLICAS statement.
Definition: sql_show.h:515
Sql_cmd_show_replicas()
Definition: sql_show.h:517
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:635
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:631
Represents SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements.
Definition: sql_show.h:211
const sp_name * m_routine_name
Definition: sql_show.h:220
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.cc:606
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:601
Sql_cmd_show_routine_code(enum_sql_command sql_command, const sp_name *routine_name)
Definition: sql_show.h:213
Common base class: Represents commands that operate on a schema (database)
Definition: sql_show.h:190
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:225
bool check_parameters(THD *thd) override
Definition: sql_show.cc:254
bool set_metadata_lock(THD *thd)
Definition: sql_show.cc:208
Sql_cmd_show_schema_base(enum_sql_command command)
Definition: sql_show.h:192
Represents SHOW STATUS FUNCTION statement.
Definition: sql_show.h:541
Sql_cmd_show_status_func()
Definition: sql_show.h:543
Represents SHOW STATUS PROCEDURE statement.
Definition: sql_show.h:548
Sql_cmd_show_status_proc()
Definition: sql_show.h:550
Represents SHOW STATUS statement.
Definition: sql_show.h:533
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:744
Sql_cmd_show_status()
Definition: sql_show.h:535
Common base class: Represents the SHOW COLUMNS and SHOW KEYS statements.
Definition: sql_show.h:200
bool check_privileges(THD *thd) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:271
bool check_parameters(THD *thd) override
Definition: sql_show.cc:694
bool m_temporary
True if table to be analyzed is temporary.
Definition: sql_show.h:206
Sql_cmd_show_table_base(enum_sql_command command)
Definition: sql_show.h:202
Represents SHOW TABLE STATUS statement.
Definition: sql_show.h:555
Sql_cmd_show_table_status()
Definition: sql_show.h:557
Represents SHOW TABLES statement.
Definition: sql_show.h:563
Sql_cmd_show_tables()
Definition: sql_show.h:565
Represents SHOW TRIGGERS statement.
Definition: sql_show.h:570
Sql_cmd_show_triggers()
Definition: sql_show.h:572
Represents SHOW VARIABLES statement.
Definition: sql_show.h:577
Sql_cmd_show_variables()
Definition: sql_show.h:579
Represents SHOW WARNINGS statement.
Definition: sql_show.h:584
Sql_cmd_show_warnings()
Definition: sql_show.h:586
bool execute_inner(THD *thd) override
The inner parts of query optimization and execution.
Definition: sql_show.h:587
Sql_cmd_show represents the SHOW statements that are implemented as SELECT statements internally.
Definition: sql_show.h:152
bool execute(THD *thd) override
Execute a DML statement.
Definition: sql_show.cc:200
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_show.h:156
virtual bool check_parameters(THD *)
Definition: sql_show.h:157
Sql_cmd_show(enum_sql_command sql_command)
Definition: sql_show.h:154
enum_sql_command m_sql_command
Definition: sql_show.h:166
bool check_privileges(THD *) override
Perform an authorization check for a prepared SELECT statement.
Definition: sql_show.cc:193
bool precheck(THD *thd) override
Generally, the SHOW commands do not distinguish precheck and regular check.
Definition: sql_show.h:159
bool check_privileges_for_table(THD *thd, bool is_temporary)
@ SL_NOTE
Definition: sql_error.h:59
@ SL_ERROR
Definition: sql_error.h:59
@ SL_WARNING
Definition: sql_error.h:59
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:165
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
LEX * lex
Definition: sql_class.h:879
Definition: sql_lex.h:292
Definition: sp_head.h:119
Dialog Client Authentication nullptr
Definition: dialog.cc:352
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:761
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:1056
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
const string metadata("\"Metadata\"")
required string type
Definition: replication_group_member_actions.proto:33
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:68
enum_var_type
Definition: set_var.h:87
enum_schema_tables
Definition: handler.h:906
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:732
void reset_status_vars()
Definition: sql_show.cc:3140
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:3579
ST_SCHEMA_TABLE * get_schema_table(enum enum_schema_tables schema_table_idx)
Definition: sql_show.cc:4257
int get_quote_char_for_identifier(const THD *thd, const char *name, size_t length)
Definition: sql_show.cc:1580
bool schema_table_store_record(THD *thd, TABLE *table)
Definition: sql_show.cc:3513
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:4606
bool mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
Create information_schema table.
Definition: sql_show.cc:4457
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:5313
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:3569
void mysqld_list_fields(THD *thd, TABLE_LIST *table, const char *wild)
Definition: sql_show.cc:1363
void free_status_vars()
Definition: sql_show.cc:3164
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:3186
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:3299
enum enum_schema_tables int enum enum_var_type int enum enum_field_types int bool store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, HA_CREATE_INFO *create_info_arg, bool show_database)
Build a CREATE TABLE statement for a table.
Definition: sql_show.cc:1858
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:3272
void init_status_vars()
Definition: sql_show.cc:3134
bool mysqld_show_privileges(THD *thd)
Definition: sql_show.cc:941
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list)
Definition: sql_show.cc:1093
ulonglong get_status_vars_version(void)
Definition: sql_show.cc:3153
TYPELIB grant_types
Definition: sql_show.cc:178
void view_store_options(const THD *thd, TABLE_LIST *table, String *buff)
Definition: sql_show.cc:2526
void calc_sum_of_all_status(System_status_var *to)
Definition: sql_show.cc:3487
bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error)
Convert HEAP table to InnoDB table if necessary.
Definition: sql_show.cc:3552
ST_SCHEMA_TABLE * find_schema_table(THD *thd, const char *table_name)
Definition: sql_show.cc:4238
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:4535
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:3534
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:1495
void remove_status_vars(SHOW_VAR *list)
Definition: sql_show.cc:3221
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:2568
void mysqld_list_processes(THD *thd, const char *user, bool verbose)
Definition: sql_show.cc:2814
bool add_status_vars(const SHOW_VAR *list)
Definition: sql_show.cc:3108
bool show_create_trigger(THD *thd, const sp_name *trg_name)
SHOW CREATE TRIGGER high-level implementation.
Definition: sql_show.cc:5132
void initialize_information_schema_acl()
Definition: sql_show.cc:5205
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create)
Definition: sql_show.cc:1246
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:2764
Definition: table.h:2561
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3654
Definition: mysql_lex_string.h:39
SHOW STATUS Server status variable.
Definition: status_var.h:78
Definition: table.h:2361
Per thread status variables.
Definition: system_variables.h:437
Definition: table.h:2694
TABLE * table
Definition: table.h:3470
ST_SCHEMA_TABLE * schema_table
Definition: table.h:3524
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:2138