Drizzled Public API Documentation

select_create.h

00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 #include <drizzled/select_insert.h>
00023 
00024 namespace drizzled
00025 {
00026 
00027 class select_create: public select_insert {
00028   Order *group;
00029   TableList *create_table;
00030   bool is_if_not_exists;
00031   HA_CREATE_INFO *create_info;
00032   message::Table &table_proto;
00033   TableList *select_tables;
00034   AlterInfo *alter_info;
00035   Field **field;
00036   /* lock data for tmp table */
00037   DrizzleLock *m_lock;
00038   /* m_lock or session->extra_lock */
00039   DrizzleLock **m_plock;
00040   identifier::Table::const_reference identifier;
00041 
00042 public:
00043   select_create (TableList *table_arg,
00044                  bool is_if_not_exists_arg,
00045                  HA_CREATE_INFO *create_info_par,
00046                  message::Table &proto,
00047                  AlterInfo *alter_info_arg,
00048                  List<Item> &select_fields,enum_duplicates duplic, bool ignore,
00049                  TableList *select_tables_arg,
00050                  identifier::Table::const_reference identifier_arg)
00051     :select_insert (NULL, NULL, &select_fields, 0, 0, duplic, ignore),
00052     create_table(table_arg),
00053     is_if_not_exists(is_if_not_exists_arg),
00054     create_info(create_info_par),
00055     table_proto(proto),
00056     select_tables(select_tables_arg),
00057     alter_info(alter_info_arg),
00058     m_plock(NULL),
00059     identifier(identifier_arg)
00060     {}
00061   int prepare(List<Item> &list, Select_Lex_Unit *u);
00062 
00063   void store_values(List<Item> &values);
00064   void send_error(drizzled::error_t errcode,const char *err);
00065   bool send_eof();
00066   void abort();
00067   virtual bool can_rollback_data() { return true; }
00068 
00069   // Needed for access from local class MY_HOOKS in prepare(), since session is proteted.
00070   const Session *get_session(void) { return session; }
00071   const HA_CREATE_INFO *get_create_info() { return create_info; }
00072   int prepare2(void) { return 0; }
00073 };
00074 
00075 } /* namespace drizzled */
00076