~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_dictionary/dictionary.cc

  • Committer: Brian Aker
  • Date: 2010-02-14 02:02:48 UTC
  • mfrom: (1273.13.64 fix_is)
  • Revision ID: brian@gaz-20100214020248-bhovaejhz9fmer3q
MergeĀ inĀ data_dictionary.

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 TableConstraintsTool *table_constraints;
 
33
static TablesTool *tables;
 
34
static TableNames *local_tables;
 
35
static TableStatus *table_status;
 
36
 
 
37
 
 
38
static int init(drizzled::plugin::Registry &registry)
 
39
{
 
40
  columns= new(std::nothrow)ColumnsTool;
 
41
  index_parts= new(std::nothrow)IndexPartsTool;
 
42
  indexes= new(std::nothrow)IndexesTool;
 
43
  referential_constraints= new(std::nothrow)ReferentialConstraintsTool;
 
44
  schemas= new(std::nothrow)SchemasTool;
 
45
  local_tables= new(std::nothrow)TableNames;
 
46
  schema_names= new(std::nothrow)SchemaNames;
 
47
  table_constraints= new(std::nothrow)TableConstraintsTool;
 
48
  table_status= new(std::nothrow)TableStatus;
 
49
  tables= new(std::nothrow)TablesTool;
 
50
 
 
51
  registry.add(columns);
 
52
  registry.add(index_parts);
 
53
  registry.add(indexes);
 
54
  registry.add(local_tables);
 
55
  registry.add(referential_constraints);
 
56
  registry.add(schema_names);
 
57
  registry.add(schemas);
 
58
  registry.add(table_constraints);
 
59
  registry.add(table_status);
 
60
  registry.add(tables);
 
61
  
 
62
  return 0;
 
63
}
 
64
 
 
65
static int finalize(drizzled::plugin::Registry &registry)
 
66
{
 
67
  registry.remove(columns);
 
68
  registry.remove(index_parts);
 
69
  registry.remove(indexes);
 
70
  registry.remove(local_tables);
 
71
  registry.remove(referential_constraints);
 
72
  registry.remove(schema_names);
 
73
  registry.remove(schemas);
 
74
  registry.remove(table_constraints);
 
75
  registry.remove(table_status);
 
76
  registry.remove(tables);
 
77
  delete columns;
 
78
  delete index_parts;
 
79
  delete indexes;
 
80
  delete local_tables;
 
81
  delete referential_constraints;
 
82
  delete schema_names;
 
83
  delete schemas;
 
84
  delete table_constraints;
 
85
  delete table_status;
 
86
  delete tables;
 
87
 
 
88
  return 0;
 
89
}
 
90
 
 
91
DRIZZLE_DECLARE_PLUGIN
 
92
{
 
93
  DRIZZLE_VERSION_ID,
 
94
  "schema_dictionary",
 
95
  "1.0",
 
96
  "Brian Aker",
 
97
  "Data Dictionary for schema, table, column, indexes, etc",
 
98
  PLUGIN_LICENSE_GPL,
 
99
  init,
 
100
  finalize,
 
101
  NULL,
 
102
  NULL,
 
103
  NULL
 
104
}
 
105
DRIZZLE_DECLARE_PLUGIN_END;