MySQL 8.3.0
Source Code Documentation
sql_cmd_ddl.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2023, 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_CMD_DDL_INCLUDED
24#define SQL_CMD_DDL_INCLUDED
25
26#include "sql/sql_cmd.h"
27
28class Sql_cmd_ddl : public Sql_cmd {
29 public:
30 enum enum_sql_cmd_type sql_cmd_type() const override {
31 /*
32 Somewhat unsurprisingly, anything sub-classed to Sql_cmd_ddl
33 identifies as DDL by default.
34 */
35 return SQL_CMD_DDL;
36 }
37};
38
39/**
40 This is a dummy class for old-style commands whose code is in sql_parse.cc,
41 not in the execute() function. This Sql_cmd sub-class presently exists
42 solely to provide a correct sql_cmd_type() for the command; it does nothing
43 else.
44*/
45class Sql_cmd_ddl_dummy final : public Sql_cmd_ddl {
46 private:
48
49 public:
51 assert(my_sql_command == SQLCOM_END); // ensure value was not set up yet
52 my_sql_command = scc;
53 }
54
56 assert(my_sql_command != SQLCOM_END); // ensure value was set up
57 return my_sql_command;
58 }
59
60 // Error: we should never get here! (see explanation above)
61 bool execute(THD *thd [[maybe_unused]]) override {
62 assert(false);
63 return false;
64 }
65};
66
67#endif // SQL_CMD_DDL_INCLUDED
This is a dummy class for old-style commands whose code is in sql_parse.cc, not in the execute() func...
Definition: sql_cmd_ddl.h:45
bool execute(THD *thd) override
Execute this SQL statement.
Definition: sql_cmd_ddl.h:61
enum_sql_command sql_command_code() const override
Return the command code for this statement.
Definition: sql_cmd_ddl.h:55
enum_sql_command my_sql_command
Definition: sql_cmd_ddl.h:47
void set_sql_command_code(enum_sql_command scc)
Definition: sql_cmd_ddl.h:50
Definition: sql_cmd_ddl.h:28
enum enum_sql_cmd_type sql_cmd_type() const override
Definition: sql_cmd_ddl.h:30
Representation of an SQL command.
Definition: sql_cmd.h:82
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
enum_sql_command
Definition: my_sqlcommand.h:45
@ SQLCOM_END
Definition: my_sqlcommand.h:207
Representation of an SQL command.
enum_sql_cmd_type
What type of Sql_cmd we're dealing with (DML, DDL, ...).
Definition: sql_cmd.h:52
@ SQL_CMD_DDL
Definition: sql_cmd.h:54