~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_dictionary/dictionary.cc

  • Committer: Monty Taylor
  • Date: 2010-03-11 18:27:20 UTC
  • mfrom: (1333 staging)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: mordred@inaugust.com-20100311182720-hd1h87y6cb1b1mp0
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#include "plugin/schema_dictionary/dictionary.h"
 
23
 
 
24
using namespace drizzled;
 
25
 
 
26
static ColumnsTool *columns;
 
27
static IndexPartsTool *index_parts;
 
28
static IndexesTool *indexes;
 
29
static ReferentialConstraintsTool *referential_constraints;
 
30
static SchemasTool *schemas;
 
31
static SchemaNames *schema_names;
 
32
static ShowColumns *show_columns;
 
33
static ShowIndexes *show_indexes;
 
34
static TableConstraintsTool *table_constraints;
 
35
static TablesTool *tables;
 
36
static ShowTables *local_tables;
 
37
static ShowTableStatus *table_status;
 
38
static ShowTemporaryTables *show_temporary_tables;
 
39
 
 
40
 
 
41
static int init(drizzled::plugin::Registry &registry)
 
42
{
 
43
  columns= new(std::nothrow)ColumnsTool;
 
44
  index_parts= new(std::nothrow)IndexPartsTool;
 
45
  indexes= new(std::nothrow)IndexesTool;
 
46
  local_tables= new(std::nothrow)ShowTables;
 
47
  referential_constraints= new(std::nothrow)ReferentialConstraintsTool;
 
48
  schema_names= new(std::nothrow)SchemaNames;
 
49
  schemas= new(std::nothrow)SchemasTool;
 
50
  show_columns= new(std::nothrow)ShowColumns;
 
51
  show_indexes= new(std::nothrow)ShowIndexes;
 
52
  show_temporary_tables= new(std::nothrow)ShowTemporaryTables;
 
53
  table_constraints= new(std::nothrow)TableConstraintsTool;
 
54
  table_status= new(std::nothrow)ShowTableStatus;
 
55
  tables= new(std::nothrow)TablesTool;
 
56
 
 
57
  registry.add(columns);
 
58
  registry.add(index_parts);
 
59
  registry.add(indexes);
 
60
  registry.add(local_tables);
 
61
  registry.add(referential_constraints);
 
62
  registry.add(schema_names);
 
63
  registry.add(schemas);
 
64
  registry.add(show_columns);
 
65
  registry.add(show_indexes);
 
66
  registry.add(show_temporary_tables);
 
67
  registry.add(table_constraints);
 
68
  registry.add(table_status);
 
69
  registry.add(tables);
 
70
  
 
71
  return 0;
 
72
}
 
73
 
 
74
static int finalize(drizzled::plugin::Registry &registry)
 
75
{
 
76
  registry.remove(columns);
 
77
  registry.remove(index_parts);
 
78
  registry.remove(indexes);
 
79
  registry.remove(local_tables);
 
80
  registry.remove(referential_constraints);
 
81
  registry.remove(schema_names);
 
82
  registry.remove(schemas);
 
83
  registry.remove(show_columns);
 
84
  registry.remove(show_indexes);
 
85
  registry.remove(show_temporary_tables);
 
86
  registry.remove(table_constraints);
 
87
  registry.remove(table_status);
 
88
  registry.remove(tables);
 
89
  delete columns;
 
90
  delete index_parts;
 
91
  delete indexes;
 
92
  delete local_tables;
 
93
  delete referential_constraints;
 
94
  delete schema_names;
 
95
  delete schemas;
 
96
  delete show_columns;
 
97
  delete show_indexes;
 
98
  delete show_temporary_tables;
 
99
  delete table_constraints;
 
100
  delete table_status;
 
101
  delete tables;
 
102
 
 
103
  return 0;
 
104
}
 
105
 
 
106
DRIZZLE_DECLARE_PLUGIN
 
107
{
 
108
  DRIZZLE_VERSION_ID,
 
109
  "schema_dictionary",
 
110
  "1.0",
 
111
  "Brian Aker",
 
112
  "Data Dictionary for schema, table, column, indexes, etc",
 
113
  PLUGIN_LICENSE_GPL,
 
114
  init,
 
115
  finalize,
 
116
  NULL,
 
117
  NULL
 
118
}
 
119
DRIZZLE_DECLARE_PLUGIN_END;