~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/information_schema_dictionary/dictionary.cc

  • Committer: Brian Aker
  • Date: 2010-03-17 19:18:40 UTC
  • mto: This revision was merged to the branch mainline in revision 1354.
  • Revision ID: brian@gaz-20100317191840-9ro7fajqp6lhaqjo
Update, we now have all of the ANSI INFORMATION_SCHEMA listed.

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/information_schema_dictionary/dictionary.h"
 
23
 
 
24
using namespace drizzled;
 
25
 
 
26
static CheckConstraints *check_constraints;
 
27
static ColumnDomainUsage *column_domain_usage;
 
28
static ColumnPrivileges *column_privileges;
 
29
static Columns *columns;
 
30
static ConstraintColumnUsage *constraint_column_usage;
 
31
static ConstraintTableUsage *constraint_table_usage;
 
32
static DomainConstraints *domain_constraints;
 
33
static Domains *domains;
 
34
static KeyColumnUsage *key_column_usage;
 
35
static Parameters *parameters;
 
36
static ReferentialConstraints *referential_constraints;
 
37
static Routines *routines;
 
38
static RoutineColumns *routine_columns;
 
39
static Schemata *schemata;
 
40
static TableConstraints *table_constraints;
 
41
static TablePriviledges *table_privileges;
 
42
static Tables *tables;
 
43
static ViewColumnUsage *view_column_usage;
 
44
static ViewTableUsage *view_table_usage;
 
45
static Views *views;
 
46
 
 
47
static int init(drizzled::plugin::Registry &registry)
 
48
{
 
49
  check_constraints = new(std::nothrow)CheckConstraints;
 
50
  column_domain_usage = new(std::nothrow)ColumnDomainUsage;
 
51
  column_privileges = new(std::nothrow)ColumnPrivileges;
 
52
  columns = new(std::nothrow)Columns;
 
53
  constraint_column_usage = new(std::nothrow)ConstraintColumnUsage;
 
54
  constraint_table_usage = new(std::nothrow)ConstraintTableUsage;
 
55
  domain_constraints = new(std::nothrow)DomainConstraints;
 
56
  domains = new(std::nothrow)Domains;
 
57
  key_column_usage = new(std::nothrow)KeyColumnUsage;
 
58
  parameters = new(std::nothrow)Parameters;
 
59
  referential_constraints = new(std::nothrow)ReferentialConstraints;
 
60
  routines = new(std::nothrow)Routines;
 
61
  routine_columns = new(std::nothrow)RoutineColumns;
 
62
  schemata = new(std::nothrow)Schemata;
 
63
  table_constraints = new(std::nothrow)TableConstraints;
 
64
  table_privileges = new(std::nothrow)TablePriviledges;
 
65
  tables = new(std::nothrow)Tables;
 
66
  view_column_usage = new(std::nothrow)ViewColumnUsage;
 
67
  view_table_usage = new(std::nothrow)ViewTableUsage;
 
68
  views = new(std::nothrow)Views;
 
69
 
 
70
  registry.add(check_constraints);
 
71
  registry.add(column_domain_usage);
 
72
  registry.add(column_privileges);
 
73
  registry.add(columns);
 
74
  registry.add(constraint_column_usage);
 
75
  registry.add(constraint_table_usage);
 
76
  registry.add(domain_constraints);
 
77
  registry.add(domains);
 
78
  registry.add(key_column_usage);
 
79
  registry.add(parameters);
 
80
  registry.add(referential_constraints);
 
81
  registry.add(routines);
 
82
  registry.add(routine_columns);
 
83
  registry.add(schemata);
 
84
  registry.add(table_constraints);
 
85
  registry.add(table_privileges);
 
86
  registry.add(tables);
 
87
  registry.add(view_column_usage);
 
88
  registry.add(view_table_usage);
 
89
  registry.add(views);
 
90
 
 
91
  return 0;
 
92
}
 
93
 
 
94
static int finalize(drizzled::plugin::Registry &registry)
 
95
{
 
96
  registry.remove(check_constraints);
 
97
  registry.remove(column_domain_usage);
 
98
  registry.remove(column_privileges);
 
99
  registry.remove(columns);
 
100
  registry.remove(constraint_column_usage);
 
101
  registry.remove(constraint_table_usage);
 
102
  registry.remove(domain_constraints);
 
103
  registry.remove(domains);
 
104
  registry.remove(key_column_usage);
 
105
  registry.remove(parameters);
 
106
  registry.remove(referential_constraints);
 
107
  registry.remove(routines);
 
108
  registry.remove(routine_columns);
 
109
  registry.remove(schemata);
 
110
  registry.remove(table_constraints);
 
111
  registry.remove(table_privileges);
 
112
  registry.remove(tables);
 
113
  registry.remove(view_column_usage);
 
114
  registry.remove(view_table_usage);
 
115
  registry.remove(views);
 
116
 
 
117
  delete check_constraints;
 
118
  delete column_domain_usage;
 
119
  delete column_privileges;
 
120
  delete columns;
 
121
  delete constraint_column_usage;
 
122
  delete constraint_table_usage;
 
123
  delete domain_constraints;
 
124
  delete domains;
 
125
  delete key_column_usage;
 
126
  delete parameters;
 
127
  delete referential_constraints;
 
128
  delete routines;
 
129
  delete routine_columns;
 
130
  delete schemata;
 
131
  delete table_constraints;
 
132
  delete table_privileges;
 
133
  delete tables;
 
134
  delete view_column_usage;
 
135
  delete view_table_usage;
 
136
  delete views;
 
137
 
 
138
  return 0;
 
139
}
 
140
 
 
141
DRIZZLE_DECLARE_PLUGIN
 
142
{
 
143
  DRIZZLE_VERSION_ID,
 
144
  "information_schema_dictionary",
 
145
  "1.0",
 
146
  "Brian Aker",
 
147
  "Data Dictionary for ANSI information schema, etc",
 
148
  PLUGIN_LICENSE_GPL,
 
149
  init,
 
150
  finalize,
 
151
  NULL,
 
152
  NULL
 
153
}
 
154
DRIZZLE_DECLARE_PLUGIN_END;