/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/**
@file Representation of an SQL command.
*/
#ifndef SQL_CMD_INCLUDED
#define SQL_CMD_INCLUDED
#include "sql_command.h"
class Storage_engine_name
{
protected:
LEX_CSTRING m_storage_engine_name;
public:
Storage_engine_name()
{
m_storage_engine_name.str= NULL;
m_storage_engine_name.length= 0;
}
Storage_engine_name(const LEX_CSTRING &name)
:m_storage_engine_name(name)
{ }
Storage_engine_name(const LEX_STRING &name)
{
m_storage_engine_name.str= name.str;
m_storage_engine_name.length= name.length;
}
bool resolve_storage_engine_with_error(THD *thd,
handlerton **ha,
bool tmp_table);
bool is_set() { return m_storage_engine_name.str != NULL; }
const LEX_CSTRING *name() const { return &m_storage_engine_name; }
};
/**
@class Sql_cmd - Representation of an SQL command.
This class is an interface between the parser and the runtime.
The parser builds the appropriate derived classes of Sql_cmd
to represent a SQL statement in the parsed tree.
The execute() method in the derived classes of Sql_cmd contain the runtime
implementation.
Note that this interface is used for SQL statements recently implemented,
the code for older statements tend to load the LEX structure with more
attributes instead.
Implement new statements by sub-classing Sql_cmd, as this improves
code modularity (see the 'big switch' in dispatch_command()), and decreases
the total size of the LEX structure (therefore saving memory in stored
programs).
The recommended name of a derived class of Sql_cmd is Sql_cmd_