~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/info_schema.cc

  • Committer: Brian Aker
  • Date: 2009-06-30 00:17:07 UTC
  • mfrom: (1079.2.9 info-schema-plugin)
  • Revision ID: brian@gaz-20090630001707-33byyr838fb60u9m
MergeĀ PadraigĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
static vector<const ColumnInfo *> char_set_columns;
39
39
static vector<const ColumnInfo *> collation_columns;
40
40
static vector<const ColumnInfo *> coll_char_columns;
 
41
static vector<const ColumnInfo *> key_col_usage_columns;
 
42
static vector<const ColumnInfo *> plugin_columns;
41
43
static vector<const ColumnInfo *> processlist_columns;
 
44
static vector<const ColumnInfo *> ref_constraint_columns;
 
45
static vector<const ColumnInfo *> tab_constraints_columns;
42
46
 
43
47
/*
44
48
 * Methods for various I_S tables.
46
50
static InfoSchemaMethods *char_set_methods= NULL;
47
51
static InfoSchemaMethods *collation_methods= NULL;
48
52
static InfoSchemaMethods *coll_char_methods= NULL;
 
53
static InfoSchemaMethods *key_col_usage_methods= NULL;
 
54
static InfoSchemaMethods *plugins_methods= NULL;
49
55
static InfoSchemaMethods *processlist_methods= NULL;
 
56
static InfoSchemaMethods *ref_constraint_methods= NULL;
 
57
static InfoSchemaMethods *tab_constraints_methods= NULL;
50
58
 
51
59
/*
52
60
 * I_S tables.
54
62
static InfoSchemaTable *char_set_table= NULL;
55
63
static InfoSchemaTable *collation_table= NULL;
56
64
static InfoSchemaTable *coll_char_set_table= NULL;
 
65
static InfoSchemaTable *key_col_usage_table= NULL;
 
66
static InfoSchemaTable *plugins_table= NULL;
57
67
static InfoSchemaTable *processlist_table= NULL;
 
68
static InfoSchemaTable *ref_constraint_table= NULL;
 
69
static InfoSchemaTable *tab_constraints_table= NULL;
58
70
 
59
71
/**
60
72
 * Populate the vectors of columns for each I_S table.
80
92
    return true;
81
93
  }
82
94
 
 
95
  if ((retval= createKeyColUsageColumns(key_col_usage_columns)) == true)
 
96
  {
 
97
    return true;
 
98
  }
 
99
 
 
100
  if ((retval= createPluginsColumns(plugin_columns)) == true)
 
101
  {
 
102
    return true;
 
103
  }
 
104
 
83
105
  if ((retval= createProcessListColumns(processlist_columns)) == true)
84
106
  {
85
107
    return true;
86
108
  }
87
109
 
 
110
  if ((retval= createRefConstraintColumns(ref_constraint_columns)) == true)
 
111
  {
 
112
    return true;
 
113
  }
 
114
 
 
115
  if ((retval= createTabConstraintsColumns(tab_constraints_columns)) == true)
 
116
  {
 
117
    return true;
 
118
  }
 
119
 
88
120
  return false;
89
121
}
90
122
 
96
128
  clearColumns(char_set_columns);
97
129
  clearColumns(collation_columns);
98
130
  clearColumns(coll_char_columns);
 
131
  clearColumns(key_col_usage_columns);
 
132
  clearColumns(plugin_columns);
99
133
  clearColumns(processlist_columns);
 
134
  clearColumns(ref_constraint_columns);
 
135
  clearColumns(tab_constraints_columns);
100
136
}
101
137
 
102
138
/**
121
157
    return true;
122
158
  }
123
159
 
 
160
  if ((key_col_usage_methods= new(std::nothrow) KeyColUsageISMethods()) == NULL)
 
161
  {
 
162
    return true;
 
163
  }
 
164
 
 
165
  if ((plugins_methods= new(std::nothrow) PluginsISMethods()) == NULL)
 
166
  {
 
167
    return true;
 
168
  }
 
169
 
124
170
  if ((processlist_methods= new(std::nothrow) ProcessListISMethods()) == NULL)
125
171
  {
126
172
    return true;
127
173
  }
128
174
 
 
175
  if ((ref_constraint_methods= new(std::nothrow) RefConstraintsISMethods()) == NULL)
 
176
  {
 
177
    return true;
 
178
  }
 
179
 
 
180
  if ((tab_constraints_methods= new(std::nothrow) TabConstraintsISMethods()) == NULL)
 
181
  {
 
182
    return true;
 
183
  }
 
184
 
129
185
  return false;
130
186
}
131
187
 
137
193
  delete char_set_methods;
138
194
  delete collation_methods;
139
195
  delete coll_char_methods;
 
196
  delete key_col_usage_methods;
 
197
  delete plugins_methods;
140
198
  delete processlist_methods;
 
199
  delete ref_constraint_methods;
 
200
  delete tab_constraints_methods;
141
201
}
142
202
 
143
203
/**
175
235
    return true;
176
236
  }
177
237
 
 
238
  key_col_usage_table= new(std::nothrow) InfoSchemaTable("KEY_COLUMN_USAGE",
 
239
                                                         key_col_usage_columns,
 
240
                                                         4, 5, false, true,
 
241
                                                         OPEN_TABLE_ONLY,
 
242
                                                         key_col_usage_methods);
 
243
  if (key_col_usage_table == NULL)
 
244
  {
 
245
    return true;
 
246
  }
 
247
 
 
248
  plugins_table= new(std::nothrow) InfoSchemaTable("PLUGINS",
 
249
                                                   plugin_columns,
 
250
                                                   -1, -1, false, false, 0,
 
251
                                                   plugins_methods);
 
252
  if (plugins_table == NULL)
 
253
  {
 
254
    return true;
 
255
  }
 
256
 
178
257
  processlist_table= new(std::nothrow) InfoSchemaTable("PROCESSLIST",
179
258
                                                       processlist_columns,
180
259
                                                       -1, -1, false, false, 0,
184
263
    return true;
185
264
  }
186
265
 
 
266
  ref_constraint_table= new(std::nothrow) InfoSchemaTable("REFERENTIAL_CONSTRAINTS",
 
267
                                                          ref_constraint_columns,
 
268
                                                          1, 9, false, true,
 
269
                                                          OPEN_TABLE_ONLY,
 
270
                                                          ref_constraint_methods);
 
271
  if (ref_constraint_table == NULL)
 
272
  {
 
273
    return true;
 
274
  }
 
275
 
 
276
  tab_constraints_table= new(std::nothrow) InfoSchemaTable("TABLE_CONSTRAINTS",
 
277
                                                           tab_constraints_columns,
 
278
                                                           3, 4, false, true,
 
279
                                                           OPEN_TABLE_ONLY,
 
280
                                                           tab_constraints_methods);
 
281
  if (tab_constraints_table == NULL)
 
282
  {
 
283
    return true;
 
284
  }
 
285
 
187
286
  return false;
188
287
}
189
288
 
195
294
  delete char_set_table;
196
295
  delete collation_table;
197
296
  delete coll_char_set_table;
 
297
  delete key_col_usage_table;
 
298
  delete plugins_table;
198
299
  delete processlist_table;
 
300
  delete ref_constraint_table;
 
301
  delete tab_constraints_table;
199
302
}
200
303
 
201
304
/**
226
329
  registry.add(char_set_table);
227
330
  registry.add(collation_table);
228
331
  registry.add(coll_char_set_table);
 
332
  registry.add(key_col_usage_table);
 
333
  registry.add(plugins_table);
229
334
  registry.add(processlist_table);
 
335
  registry.add(ref_constraint_table);
 
336
  registry.add(tab_constraints_table);
230
337
 
231
338
  return 0;
232
339
}
242
349
  registry.remove(char_set_table);
243
350
  registry.remove(collation_table);
244
351
  registry.remove(coll_char_set_table);
 
352
  registry.remove(key_col_usage_table);
 
353
  registry.remove(plugins_table);
245
354
  registry.remove(processlist_table);
 
355
  registry.remove(ref_constraint_table);
 
356
  registry.remove(tab_constraints_table);
246
357
 
247
358
  cleanupTableMethods();
248
359
  cleanupTableColumns();