1340.1.2
by Brian Aker
Merge of table cache/def DD. |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2010 Brian Aker
|
|
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 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
21 |
#include <config.h> |
1340.1.2
by Brian Aker
Merge of table cache/def DD. |
22 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
23 |
#include <plugin/table_cache_dictionary/dictionary.h> |
1340.1.2
by Brian Aker
Merge of table cache/def DD. |
24 |
|
25 |
using namespace drizzled; |
|
26 |
using namespace std; |
|
27 |
||
28 |
table_cache_dictionary::TableDefinitionCache::TableDefinitionCache() : |
|
29 |
plugin::TableFunction("DATA_DICTIONARY", "TABLE_DEFINITION_CACHE") |
|
30 |
{
|
|
31 |
add_field("TABLE_SCHEMA"); |
|
32 |
add_field("TABLE_NAME"); |
|
1643.3.10
by Brian Aker
Column support, clean up of IS/DD for NULL type. |
33 |
add_field("VERSION", plugin::TableFunction::NUMBER, 0, false); |
34 |
add_field("TABLE_COUNT", plugin::TableFunction::NUMBER, 0, false); |
|
35 |
add_field("IS_NAME_LOCKED", plugin::TableFunction::BOOLEAN, 0, false); |
|
1340.1.2
by Brian Aker
Merge of table cache/def DD. |
36 |
}
|
37 |
||
38 |
table_cache_dictionary::TableDefinitionCache::Generator::Generator(drizzled::Field **arg) : |
|
1938.4.3
by Brian Aker
Added generator for table_definition cache. Now no one can touch the guts :) |
39 |
drizzled::plugin::TableFunction::Generator(arg) |
1340.1.2
by Brian Aker
Merge of table cache/def DD. |
40 |
{
|
41 |
}
|
|
42 |
||
43 |
table_cache_dictionary::TableDefinitionCache::Generator::~Generator() |
|
44 |
{
|
|
45 |
}
|
|
46 |
||
47 |
bool table_cache_dictionary::TableDefinitionCache::Generator::populate() |
|
48 |
{
|
|
1938.4.3
by Brian Aker
Added generator for table_definition cache. Now no one can touch the guts :) |
49 |
drizzled::TableShare::shared_ptr share; |
50 |
||
51 |
while ((share= table_definition_cache_generator)) |
|
52 |
{
|
|
53 |
/**
|
|
54 |
For test cases use:
|
|
55 |
--replace_column 3 # 4 # 5 #
|
|
56 |
*/
|
|
57 |
||
58 |
/* TABLE_SCHEMA 1 */
|
|
59 |
string arg; |
|
60 |
push(share->getSchemaName(arg)); |
|
61 |
||
62 |
/* TABLE_NAME 2 */
|
|
63 |
push(share->getTableName(arg)); |
|
64 |
||
65 |
/* VERSION 3 */
|
|
66 |
push(static_cast<int64_t>(share->getVersion())); |
|
67 |
||
68 |
/* TABLE_COUNT 4 */
|
|
69 |
push(static_cast<uint64_t>(share->getTableCount())); |
|
70 |
||
71 |
/* IS_NAME_LOCKED */
|
|
72 |
push(false); |
|
73 |
||
74 |
return true; |
|
75 |
}
|
|
76 |
||
77 |
return false; |
|
1340.1.2
by Brian Aker
Merge of table cache/def DD. |
78 |
}
|