Drizzled Public API Documentation

internal_dictionary.cc
1 /*****************************************************************************
2 
3 Copyright (C) 2007, 2009, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 #include <config.h>
20 
21 #include "internal_dictionary.h"
22 
23 #include <drizzled/current_session.h>
24 
25 #include "univ.i"
26 #include "btr0sea.h"
27 #include "os0file.h"
28 #include "os0thread.h"
29 #include "srv0start.h"
30 #include "srv0srv.h"
31 #include "trx0roll.h"
32 #include "trx0trx.h"
33 #include "trx0sys.h"
34 #include "mtr0mtr.h"
35 #include "row0ins.h"
36 #include "row0mysql.h"
37 #include "row0sel.h"
38 #include "row0upd.h"
39 #include "log0log.h"
40 #include "lock0lock.h"
41 #include "dict0crea.h"
42 #include "btr0cur.h"
43 #include "btr0btr.h"
44 #include "fsp0fsp.h"
45 #include "sync0sync.h"
46 #include "fil0fil.h"
47 #include "trx0xa.h"
48 #include "row0merge.h"
49 #include "thr0loc.h"
50 #include "dict0boot.h"
51 #include "ha_prototypes.h"
52 #include "ut0mem.h"
53 #include "ibuf0ibuf.h"
54 #include "handler0vars.h"
55 
56 using namespace drizzled;
57 
58 /*
59  * Fill the dynamic table data_dictionary.INNODB_CMP and INNODB_CMP_RESET
60  *
61  */
62 InnodbInternalTables::InnodbInternalTables() :
63  plugin::TableFunction("DATA_DICTIONARY", "INNODB_INTERNAL_TABLES")
64 {
65  add_field("TABLE_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
66 }
67 
68 static void my_dict_print_callback(void *ptr, const char *table_name)
69 {
70  Recorder *myrec= static_cast<Recorder *>(ptr);
71 
72  myrec->push(table_name);
73 }
74 
75 InnodbInternalTables::Generator::Generator(Field **arg) :
76  plugin::TableFunction::Generator(arg)
77 {
78  dict_print_with_callback(my_dict_print_callback, &recorder);
79  recorder.start();
80 }
81 
82 bool InnodbInternalTables::Generator::populate()
83 {
84  std::string table_name;
85  bool more= recorder.next(table_name);
86 
87  if (not more)
88  return false;
89 
90  /* TABLE_NAME */
91  push(table_name);
92 
93  return true;
94 }