Drizzled Public API Documentation

internal_dictionary.cc

00001 /*****************************************************************************
00002 
00003 Copyright (C) 2007, 2009, Innobase Oy. All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify it under
00006 the terms of the GNU General Public License as published by the Free Software
00007 Foundation; version 2 of the License.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with
00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
00015 St, Fifth Floor, Boston, MA 02110-1301 USA
00016 
00017 *****************************************************************************/
00018 
00019 #include <config.h>
00020 
00021 #include "internal_dictionary.h"
00022 
00023 #include <drizzled/current_session.h>
00024 
00025 #include "univ.i"
00026 #include "btr0sea.h"
00027 #include "os0file.h"
00028 #include "os0thread.h"
00029 #include "srv0start.h"
00030 #include "srv0srv.h"
00031 #include "trx0roll.h"
00032 #include "trx0trx.h"
00033 #include "trx0sys.h"
00034 #include "mtr0mtr.h"
00035 #include "row0ins.h"
00036 #include "row0mysql.h"
00037 #include "row0sel.h"
00038 #include "row0upd.h"
00039 #include "log0log.h"
00040 #include "lock0lock.h"
00041 #include "dict0crea.h"
00042 #include "btr0cur.h"
00043 #include "btr0btr.h"
00044 #include "fsp0fsp.h"
00045 #include "sync0sync.h"
00046 #include "fil0fil.h"
00047 #include "trx0xa.h"
00048 #include "row0merge.h"
00049 #include "thr0loc.h"
00050 #include "dict0boot.h"
00051 #include "ha_prototypes.h"
00052 #include "ut0mem.h"
00053 #include "ibuf0ibuf.h"
00054 #include "handler0vars.h"
00055 
00056 using namespace drizzled;
00057 
00058 /*
00059  * Fill the dynamic table data_dictionary.INNODB_CMP and INNODB_CMP_RESET
00060  *
00061  */
00062 InnodbInternalTables::InnodbInternalTables() :
00063   plugin::TableFunction("DATA_DICTIONARY", "INNODB_INTERNAL_TABLES")
00064 {
00065   add_field("TABLE_NAME");
00066 }
00067 
00068 static void my_dict_print_callback(void *ptr, const char *table_name)
00069 {
00070   Recorder *myrec= static_cast<Recorder *>(ptr);
00071 
00072   myrec->push(table_name);
00073 }
00074 
00075 InnodbInternalTables::Generator::Generator(Field **arg) :
00076   plugin::TableFunction::Generator(arg)
00077 {
00078   dict_print_with_callback(my_dict_print_callback, &recorder);
00079   recorder.start();
00080 }
00081 
00082 bool InnodbInternalTables::Generator::populate()
00083 {
00084   std::string table_name;
00085   bool more= recorder.next(table_name);
00086 
00087   if (not more)
00088     return false;
00089 
00090   /* TABLE_NAME */
00091   push(table_name);
00092 
00093   return true;
00094 }