drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
foreign_keys.h
1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2010 Sun Microsystems, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#pragma once
22
23class ForeignKeysTool : public drizzled::plugin::TableFunction
24{
25public:
26
27 ForeignKeysTool();
28
29 ForeignKeysTool(const char *schema_arg, const char *table_arg) :
30 drizzled::plugin::TableFunction(schema_arg, table_arg)
31 { }
32
33 ForeignKeysTool(const char *table_arg) :
34 drizzled::plugin::TableFunction("DATA_DICTIONARY", table_arg)
35 { }
36
38 {
39 drizzled::generator::AllTables all_tables_generator;
40 drizzled::message::Table table_message;
41 drizzled::message::Table::ForeignKeyConstraint fkey;
42 int keyPos;
43 bool firstFill;
44
45 virtual void fill();
46
47 public:
48 Generator(drizzled::Field **arg);
49
50 bool nextTable();
51 bool fillFkey();
52
53 const std::string &table_name()
54 {
55 return table_message.name();
56 }
57
58 const drizzled::message::Table& getTableProto()
59 {
60 return table_message;
61 }
62
63 const drizzled::message::Table& getTableMessage()
64 {
65 return table_message;
66 }
67
68 bool isTablesPrimed()
69 {
70 return true;
71 }
72
73 bool populate();
74
75 };
76
77 Generator *generator(drizzled::Field **arg)
78 {
79 return new Generator(arg);
80 }
81};
82