~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/info_schema.cc

Merge Padraig

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
/*
36
36
 * Vectors of columns for various I_S tables.
37
37
 */
 
38
static vector<const ColumnInfo *> char_set_columns;
 
39
static vector<const ColumnInfo *> collation_columns;
 
40
static vector<const ColumnInfo *> coll_char_columns;
38
41
static vector<const ColumnInfo *> processlist_columns;
39
42
 
40
43
/*
41
44
 * Methods for various I_S tables.
42
45
 */
 
46
static InfoSchemaMethods *char_set_methods= NULL;
 
47
static InfoSchemaMethods *collation_methods= NULL;
 
48
static InfoSchemaMethods *coll_char_methods= NULL;
43
49
static InfoSchemaMethods *processlist_methods= NULL;
44
50
 
45
51
/*
46
52
 * I_S tables.
47
53
 */
 
54
static InfoSchemaTable *char_set_table= NULL;
 
55
static InfoSchemaTable *collation_table= NULL;
 
56
static InfoSchemaTable *coll_char_set_table= NULL;
48
57
static InfoSchemaTable *processlist_table= NULL;
49
58
 
50
59
/**
54
63
 */
55
64
bool initTableColumns()
56
65
{
57
 
  createProcessListColumns(processlist_columns);
 
66
  bool retval= false;
 
67
 
 
68
  if ((retval= createCharSetColumns(char_set_columns)) == true)
 
69
  {
 
70
    return true;
 
71
  }
 
72
 
 
73
  if ((retval= createCollationColumns(collation_columns)) == true)
 
74
  {
 
75
    return true;
 
76
  }
 
77
 
 
78
  if ((retval= createCollCharSetColumns(coll_char_columns)) == true)
 
79
  {
 
80
    return true;
 
81
  }
 
82
 
 
83
  if ((retval= createProcessListColumns(processlist_columns)) == true)
 
84
  {
 
85
    return true;
 
86
  }
58
87
 
59
88
  return false;
60
89
}
64
93
 */
65
94
void cleanupTableColumns()
66
95
{
 
96
  clearColumns(char_set_columns);
 
97
  clearColumns(collation_columns);
 
98
  clearColumns(coll_char_columns);
67
99
  clearColumns(processlist_columns);
68
100
}
69
101
 
74
106
 */
75
107
bool initTableMethods()
76
108
{
77
 
  processlist_methods= new ProcessListISMethods();
 
109
  if ((char_set_methods= new(std::nothrow) CharSetISMethods()) == NULL)
 
110
  {
 
111
    return true;
 
112
  }
 
113
 
 
114
  if ((collation_methods= new(std::nothrow) CollationISMethods()) == NULL)
 
115
  {
 
116
    return true;
 
117
  }
 
118
 
 
119
  if ((coll_char_methods= new(std::nothrow) CollCharISMethods()) == NULL)
 
120
  {
 
121
    return true;
 
122
  }
 
123
 
 
124
  if ((processlist_methods= new(std::nothrow) ProcessListISMethods()) == NULL)
 
125
  {
 
126
    return true;
 
127
  }
78
128
 
79
129
  return false;
80
130
}
84
134
 */
85
135
void cleanupTableMethods()
86
136
{
 
137
  delete char_set_methods;
 
138
  delete collation_methods;
 
139
  delete coll_char_methods;
87
140
  delete processlist_methods;
88
141
}
89
142
 
95
148
bool initTables()
96
149
{
97
150
 
98
 
  processlist_table= new InfoSchemaTable("PROCESSLIST",
99
 
                                         processlist_columns,
100
 
                                         -1, -1, false, false, 0,
101
 
                                         processlist_methods);
 
151
  char_set_table= new(std::nothrow) InfoSchemaTable("CHARACTER_SETS",
 
152
                                                    char_set_columns,
 
153
                                                    -1, -1, false, false, 0,
 
154
                                                    char_set_methods);
 
155
  if (char_set_table == NULL)
 
156
  {
 
157
    return true;
 
158
  }
 
159
 
 
160
  collation_table= new(std::nothrow) InfoSchemaTable("COLLATIONS",
 
161
                                                     collation_columns,
 
162
                                                     -1, -1, false, false, 0,
 
163
                                                     collation_methods);
 
164
  if (collation_table == NULL)
 
165
  {
 
166
    return true;
 
167
  }
 
168
 
 
169
  coll_char_set_table= new(std::nothrow) InfoSchemaTable("COLLATION_CHARACTER_SET_APPLICABILITY",
 
170
                                                         coll_char_columns,
 
171
                                                         -1, -1, false, false, 0,
 
172
                                                         coll_char_methods);
 
173
  if (coll_char_set_table == NULL)
 
174
  {
 
175
    return true;
 
176
  }
 
177
 
 
178
  processlist_table= new(std::nothrow) InfoSchemaTable("PROCESSLIST",
 
179
                                                       processlist_columns,
 
180
                                                       -1, -1, false, false, 0,
 
181
                                                       processlist_methods);
 
182
  if (processlist_table == NULL)
 
183
  {
 
184
    return true;
 
185
  }
102
186
 
103
187
  return false;
104
188
}
108
192
 */
109
193
void cleanupTables()
110
194
{
 
195
  delete char_set_table;
 
196
  delete collation_table;
 
197
  delete coll_char_set_table;
111
198
  delete processlist_table;
112
199
}
113
200
 
136
223
    return 1;
137
224
  }
138
225
 
 
226
  registry.add(char_set_table);
 
227
  registry.add(collation_table);
 
228
  registry.add(coll_char_set_table);
139
229
  registry.add(processlist_table);
140
230
 
141
231
  return 0;
149
239
 */
150
240
int infoSchemaDone(PluginRegistry& registry)
151
241
{
 
242
  registry.remove(char_set_table);
 
243
  registry.remove(collation_table);
 
244
  registry.remove(coll_char_set_table);
152
245
  registry.remove(processlist_table);
153
246
 
154
247
  cleanupTableMethods();