1273.13.5
by Brian Aker
Additional definitions. |
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
|
|
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 |
||
1273.13.50
by Brian Aker
Additional plugins. |
21 |
#ifndef PLUGIN_SCHEMA_DICTIONARY_SCHEMAS_H
|
22 |
#define PLUGIN_SCHEMA_DICTIONARY_SCHEMAS_H
|
|
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
23 |
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
24 |
class SchemasTool : public drizzled::plugin::TableFunction |
1273.13.5
by Brian Aker
Additional definitions. |
25 |
{
|
26 |
public: |
|
27 |
||
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
28 |
SchemasTool(); |
1273.13.25
by Brian Aker
Updates for table functions to insert tables into additional schemas; |
29 |
|
30 |
SchemasTool(const char *schema_arg, const char *table_arg) : |
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
31 |
drizzled::plugin::TableFunction(schema_arg, table_arg) |
1273.13.25
by Brian Aker
Updates for table functions to insert tables into additional schemas; |
32 |
{ } |
33 |
||
34 |
SchemasTool(const char *table_arg) : |
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
35 |
drizzled::plugin::TableFunction("data_dictionary", table_arg) |
1273.13.13
by Brian Aker
Clean up schemata |
36 |
{ } |
37 |
||
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
38 |
class Generator : public drizzled::plugin::TableFunction::Generator |
1273.13.13
by Brian Aker
Clean up schemata |
39 |
{
|
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
40 |
drizzled::message::Schema schema; |
41 |
std::set<std::string> schema_names; |
|
42 |
std::set<std::string>::const_iterator schema_iterator; |
|
43 |
bool is_schema_primed; |
|
44 |
bool is_schema_parsed; |
|
45 |
||
1273.13.36
by Brian Aker
Adding support for LOCAL_TABLE_NAMES and SCHEMA_NAMES |
46 |
virtual void fill(); |
47 |
virtual bool checkSchema(); |
|
1273.13.13
by Brian Aker
Clean up schemata |
48 |
|
49 |
public: |
|
1273.14.5
by Monty Taylor
Merged trunk. |
50 |
Generator(drizzled::Field **arg); |
1273.13.13
by Brian Aker
Clean up schemata |
51 |
|
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
52 |
const std::string &schema_name() |
1273.13.13
by Brian Aker
Clean up schemata |
53 |
{
|
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
54 |
assert(is_schema_primed); |
55 |
return is_schema_parsed ? schema.name() : (*schema_iterator); |
|
1273.13.13
by Brian Aker
Clean up schemata |
56 |
}
|
57 |
||
1273.13.21
by Brian Aker
Fix interface (we no longer need Fields passed around). |
58 |
bool populate(); |
1273.13.36
by Brian Aker
Adding support for LOCAL_TABLE_NAMES and SCHEMA_NAMES |
59 |
bool nextSchemaCore(); |
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
60 |
bool nextSchema(); |
61 |
bool isSchemaPrimed() |
|
62 |
{
|
|
63 |
return is_schema_primed; |
|
64 |
}
|
|
65 |
};
|
|
66 |
||
1273.14.5
by Monty Taylor
Merged trunk. |
67 |
Generator *generator(drizzled::Field **arg) |
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
68 |
{
|
69 |
return new Generator(arg); |
|
70 |
}
|
|
71 |
};
|
|
72 |
||
1273.13.36
by Brian Aker
Adding support for LOCAL_TABLE_NAMES and SCHEMA_NAMES |
73 |
class SchemaNames : public SchemasTool |
74 |
{
|
|
75 |
public: |
|
76 |
SchemaNames() : |
|
77 |
SchemasTool("SCHEMA_NAMES") |
|
78 |
{
|
|
79 |
add_field("SCHEMA_NAME"); |
|
80 |
}
|
|
81 |
||
82 |
class Generator : public SchemasTool::Generator |
|
83 |
{
|
|
84 |
void fill() |
|
85 |
{
|
|
86 |
/* SCHEMA_NAME */
|
|
87 |
push(schema_name()); |
|
88 |
}
|
|
89 |
||
90 |
public: |
|
1273.14.5
by Monty Taylor
Merged trunk. |
91 |
Generator(drizzled::Field **arg) : |
1273.13.36
by Brian Aker
Adding support for LOCAL_TABLE_NAMES and SCHEMA_NAMES |
92 |
SchemasTool::Generator(arg) |
93 |
{ } |
|
94 |
};
|
|
95 |
||
1273.14.5
by Monty Taylor
Merged trunk. |
96 |
Generator *generator(drizzled::Field **arg) |
1273.13.36
by Brian Aker
Adding support for LOCAL_TABLE_NAMES and SCHEMA_NAMES |
97 |
{
|
98 |
return new Generator(arg); |
|
99 |
}
|
|
100 |
};
|
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
101 |
|
102 |
||
1273.13.65
by Brian Aker
Lint fixes. |
103 |
#endif /* PLUGIN_SCHEMA_DICTIONARY_SCHEMAS_H */ |