My Project
sql_handler.h
00001 /* Copyright (c) 2006, 2011, 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 
00016 #ifndef SQL_HANDLER_INCLUDED
00017 #define SQL_HANDLER_INCLUDED
00018 
00019 #include "sql_class.h"                 /* enum_ha_read_mode */
00020 #include "my_base.h"                   /* ha_rkey_function, ha_rows */
00021 #include "sql_list.h"                  /* List */
00022 
00023 class THD;
00024 struct TABLE_LIST;
00025 
00033 class Sql_cmd_handler_open : public Sql_cmd
00034 {
00035 public:
00036   Sql_cmd_handler_open()
00037   {}
00038 
00039   virtual ~Sql_cmd_handler_open()
00040   {}
00041 
00042   virtual enum_sql_command sql_command_code() const
00043   {
00044     return SQLCOM_HA_OPEN;
00045   }
00046 
00047   virtual bool execute(THD *thd);
00048 };
00049 
00050 
00059 class Sql_cmd_handler_read : public Sql_cmd
00060 {
00061 public:
00062   Sql_cmd_handler_read(enum_ha_read_modes read_mode,
00063                        const char *key_name,
00064                        List<Item> *key_expr,
00065                        ha_rkey_function rkey_mode)
00066     : m_read_mode(read_mode), m_key_name(key_name), m_key_expr(key_expr),
00067       m_rkey_mode(rkey_mode)
00068   {}
00069 
00070   virtual ~Sql_cmd_handler_read()
00071   {}
00072 
00073   virtual enum_sql_command sql_command_code() const
00074   {
00075     return SQLCOM_HA_READ;
00076   }
00077 
00078   virtual bool execute(THD *thd);
00079 
00080 private:
00082   enum enum_ha_read_modes m_read_mode;
00083 
00088   const char *m_key_name;
00089 
00091   List<Item> *m_key_expr;
00092 
00094   enum ha_rkey_function m_rkey_mode;
00095 };
00096 
00097 
00105 class Sql_cmd_handler_close : public Sql_cmd
00106 {
00107 public:
00108   Sql_cmd_handler_close()
00109   {}
00110 
00111   virtual ~Sql_cmd_handler_close()
00112   {}
00113 
00114   virtual enum_sql_command sql_command_code() const
00115   {
00116     return SQLCOM_HA_CLOSE;
00117   }
00118 
00119   virtual bool execute(THD *thd);
00120 };
00121 
00122 
00123 void mysql_ha_flush(THD *thd);
00124 void mysql_ha_flush_tables(THD *thd, TABLE_LIST *all_tables);
00125 void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables);
00126 void mysql_ha_rm_temporary_tables(THD *thd);
00127 void mysql_ha_cleanup(THD *thd);
00128 void mysql_ha_set_explicit_lock_duration(THD *thd);
00129 
00130 typedef bool Log_func(THD*, TABLE*, bool,
00131                       const uchar*, const uchar*);
00132 
00133 int  binlog_log_row(TABLE* table,
00134                           const uchar *before_record,
00135                           const uchar *after_record,
00136                           Log_func *log_func);
00137 
00138 #endif /* SQL_HANDLER_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines