My Project
|
00001 /* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00015 00020 #ifndef SQL_CMD_INCLUDED 00021 #define SQL_CMD_INCLUDED 00022 00023 /* 00024 When a command is added here, be sure it's also added in mysqld.cc 00025 in "struct show_var_st status_vars[]= {" ... 00026 00027 If the command returns a result set or is not allowed in stored 00028 functions or triggers, please also make sure that 00029 sp_get_flags_for_command (sp_head.cc) returns proper flags for the 00030 added SQLCOM_. 00031 */ 00032 00033 enum enum_sql_command { 00034 SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_ALTER_TABLE, 00035 SQLCOM_UPDATE, SQLCOM_INSERT, SQLCOM_INSERT_SELECT, 00036 SQLCOM_DELETE, SQLCOM_TRUNCATE, SQLCOM_DROP_TABLE, SQLCOM_DROP_INDEX, 00037 00038 SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS, 00039 SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_STATUS, 00040 SQLCOM_SHOW_ENGINE_LOGS, SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_MUTEX, 00041 SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT, 00042 SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS, 00043 SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS, 00044 SQLCOM_SHOW_TRIGGERS, 00045 00046 SQLCOM_LOAD,SQLCOM_SET_OPTION,SQLCOM_LOCK_TABLES,SQLCOM_UNLOCK_TABLES, 00047 SQLCOM_GRANT, 00048 SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB, 00049 SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT, 00050 SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION, 00051 SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK, 00052 SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_PRELOAD_KEYS, 00053 SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE, 00054 SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT, 00055 SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT, 00056 SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP, 00057 SQLCOM_BEGIN, SQLCOM_CHANGE_MASTER, 00058 SQLCOM_RENAME_TABLE, 00059 SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS, 00060 SQLCOM_SHOW_OPEN_TABLES, 00061 SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ, 00062 SQLCOM_SHOW_SLAVE_HOSTS, SQLCOM_DELETE_MULTI, SQLCOM_UPDATE_MULTI, 00063 SQLCOM_SHOW_BINLOG_EVENTS, SQLCOM_DO, 00064 SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS, 00065 SQLCOM_SHOW_STORAGE_ENGINES, SQLCOM_SHOW_PRIVILEGES, 00066 SQLCOM_HELP, SQLCOM_CREATE_USER, SQLCOM_DROP_USER, SQLCOM_RENAME_USER, 00067 SQLCOM_REVOKE_ALL, SQLCOM_CHECKSUM, 00068 SQLCOM_CREATE_PROCEDURE, SQLCOM_CREATE_SPFUNCTION, SQLCOM_CALL, 00069 SQLCOM_DROP_PROCEDURE, SQLCOM_ALTER_PROCEDURE,SQLCOM_ALTER_FUNCTION, 00070 SQLCOM_SHOW_CREATE_PROC, SQLCOM_SHOW_CREATE_FUNC, 00071 SQLCOM_SHOW_STATUS_PROC, SQLCOM_SHOW_STATUS_FUNC, 00072 SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE, 00073 SQLCOM_CREATE_VIEW, SQLCOM_DROP_VIEW, 00074 SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER, 00075 SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE, 00076 SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER, 00077 SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE, 00078 SQLCOM_ALTER_TABLESPACE, 00079 SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN, 00080 SQLCOM_BINLOG_BASE64_EVENT, 00081 SQLCOM_SHOW_PLUGINS, 00082 SQLCOM_CREATE_SERVER, SQLCOM_DROP_SERVER, SQLCOM_ALTER_SERVER, 00083 SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT, 00084 SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS, 00085 SQLCOM_SHOW_CREATE_TRIGGER, 00086 SQLCOM_ALTER_DB_UPGRADE, 00087 SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, 00088 SQLCOM_SIGNAL, SQLCOM_RESIGNAL, 00089 SQLCOM_SHOW_RELAYLOG_EVENTS, 00090 SQLCOM_GET_DIAGNOSTICS, 00091 SQLCOM_ALTER_USER, 00092 00093 /* 00094 When a command is added here, be sure it's also added in mysqld.cc 00095 in "struct show_var_st status_vars[]= {" ... 00096 */ 00097 /* This should be the last !!! */ 00098 SQLCOM_END 00099 }; 00100 00123 class Sql_cmd : public Sql_alloc 00124 { 00125 private: 00126 Sql_cmd(const Sql_cmd &); // No copy constructor wanted 00127 void operator=(Sql_cmd &); // No assignment operator wanted 00128 00129 public: 00133 virtual enum_sql_command sql_command_code() const = 0; 00134 00141 virtual bool execute(THD *thd) = 0; 00142 00143 protected: 00144 Sql_cmd() 00145 {} 00146 00147 virtual ~Sql_cmd() 00148 { 00149 /* 00150 Sql_cmd objects are allocated in thd->mem_root. 00151 In MySQL, the C++ destructor is never called, the underlying MEM_ROOT is 00152 simply destroyed instead. 00153 Do not rely on the destructor for any cleanup. 00154 */ 00155 DBUG_ASSERT(FALSE); 00156 } 00157 }; 00158 00159 #endif // SQL_CMD_INCLUDED