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 "dict0boot.h"
50 #include "ha_prototypes.h"
51 #include "ut0mem.h"
52 #include "ibuf0ibuf.h"
53 #include "handler0vars.h"
54 
55 using namespace drizzled;
56 
57 /*
58  * Fill the dynamic table data_dictionary.INNODB_CMP and INNODB_CMP_RESET
59  *
60  */
61 InnodbInternalTables::InnodbInternalTables() :
62  plugin::TableFunction("DATA_DICTIONARY", "INNODB_INTERNAL_TABLES")
63 {
64  add_field("TABLE_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
65 }
66 
67 static void my_dict_print_callback(void *ptr, const char *table_name)
68 {
69  Recorder *myrec= static_cast<Recorder *>(ptr);
70 
71  myrec->push(table_name);
72 }
73 
74 InnodbInternalTables::Generator::Generator(Field **arg) :
75  plugin::TableFunction::Generator(arg)
76 {
77  dict_print_with_callback(my_dict_print_callback, &recorder);
78  recorder.start();
79 }
80 
81 bool InnodbInternalTables::Generator::populate()
82 {
83  std::string table_name;
84  bool more= recorder.next(table_name);
85 
86  if (not more)
87  return false;
88 
89  /* TABLE_NAME */
90  push(table_name);
91 
92  return true;
93 }
TODO: Rename this file - func.h is stupid.
Definition: engine.cc:41