drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
table_definition_cache.cc
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
21#include <config.h>
22
23#include <plugin/table_cache_dictionary/dictionary.h>
24
25using namespace drizzled;
26using namespace std;
27
28table_cache_dictionary::TableDefinitionCache::TableDefinitionCache() :
29 plugin::TableFunction("DATA_DICTIONARY", "TABLE_DEFINITION_CACHE")
30{
31 add_field("TABLE_SCHEMA", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
32 add_field("TABLE_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
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);
36}
37
38table_cache_dictionary::TableDefinitionCache::Generator::Generator(drizzled::Field **arg) :
39 drizzled::plugin::TableFunction::Generator(arg)
40{
41}
42
44{
45 while (drizzled::TableShare::shared_ptr share= table_definition_cache_generator)
46 {
51
52 /* TABLE_SCHEMA 1 */
53 push(share->getSchemaNameRef());
54
55 /* TABLE_NAME 2 */
56 push(share->getTableNameRef());
57
58 /* VERSION 3 */
59 push(static_cast<int64_t>(share->getVersion()));
60
61 /* TABLE_COUNT 4 */
62 push(static_cast<uint64_t>(share->getTableCount()));
63
64 /* IS_NAME_LOCKED */
65 push(false);
66
67 return true;
68 }
69
70 return false;
71}
TODO: Rename this file - func.h is stupid.
STL namespace.