~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/info_schema_columns.cc

  • Committer: Brian Aker
  • Date: 2009-11-18 23:28:30 UTC
  • mfrom: (1215.2.25 is-split)
  • Revision ID: brian@gaz-20091118232830-v28y7o26squz3c9c
Merge of Padraig

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) 2009 Sun Microsystems
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
 
/**
22
 
 * @file
23
 
 *   Contains methods for creating the various columns for 
24
 
 *   each I_S table.
25
 
 */
26
 
 
27
 
#include <drizzled/server_includes.h>
28
 
#include <drizzled/session.h>
29
 
#include <drizzled/show.h>
30
 
 
31
 
#include "info_schema_columns.h"
32
 
 
33
 
#define LIST_PROCESS_HOST_LEN 64
34
 
 
35
 
using namespace std;
36
 
 
37
 
bool createCharSetColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
38
 
{
39
 
  /*
40
 
   * Create each column for the CHARACTER_SET table.
41
 
   */
42
 
  const drizzled::plugin::ColumnInfo *name_col= new(std::nothrow) drizzled::plugin::ColumnInfo("CHARACTER_SET_NAME",
43
 
                                                           64,
44
 
                                                           DRIZZLE_TYPE_VARCHAR,
45
 
                                                           0,
46
 
                                                           0,
47
 
                                                           "Charset",
48
 
                                                           SKIP_OPEN_TABLE);
49
 
  if (name_col == NULL)
50
 
  {
51
 
    return true;
52
 
  }
53
 
 
54
 
  const drizzled::plugin::ColumnInfo *collate_col= new(std::nothrow) drizzled::plugin::ColumnInfo("DEFAULT_COLLATE_NAME",
55
 
                                                              64,
56
 
                                                              DRIZZLE_TYPE_VARCHAR,
57
 
                                                              0,
58
 
                                                              0,
59
 
                                                              "Default collation",
60
 
                                                              SKIP_OPEN_TABLE);
61
 
  if (collate_col == NULL)
62
 
  {
63
 
    return true;
64
 
  }
65
 
 
66
 
  const drizzled::plugin::ColumnInfo *descrip_col= new(std::nothrow) drizzled::plugin::ColumnInfo("DESCRIPTION",
67
 
                                                              60,
68
 
                                                              DRIZZLE_TYPE_VARCHAR,
69
 
                                                              0,
70
 
                                                              0,
71
 
                                                              "Description",
72
 
                                                              SKIP_OPEN_TABLE);
73
 
  if (descrip_col == NULL)
74
 
  {
75
 
    return true;
76
 
  }
77
 
 
78
 
  const drizzled::plugin::ColumnInfo *len_col= new(std::nothrow) drizzled::plugin::ColumnInfo("MAXLEN",
79
 
                                                          3,
80
 
                                                          DRIZZLE_TYPE_LONGLONG,
81
 
                                                          0,
82
 
                                                          0,
83
 
                                                          "Maxlen",
84
 
                                                          SKIP_OPEN_TABLE);
85
 
  if (len_col == NULL)
86
 
  {
87
 
    return true;
88
 
  }
89
 
 
90
 
  /*
91
 
   * Add the columns to the vector.
92
 
   */
93
 
  cols.push_back(name_col);
94
 
  cols.push_back(collate_col);
95
 
  cols.push_back(descrip_col);
96
 
  cols.push_back(len_col);
97
 
 
98
 
  return false;
99
 
}
100
 
 
101
 
bool createCollationColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
102
 
{
103
 
  /*
104
 
   * Create each column for the COLLATION table.
105
 
   */
106
 
  const drizzled::plugin::ColumnInfo *name_col= new(std::nothrow) drizzled::plugin::ColumnInfo("COLLATION_NAME",
107
 
                                                           64,
108
 
                                                           DRIZZLE_TYPE_VARCHAR,
109
 
                                                           0,
110
 
                                                           0,
111
 
                                                           "Collation",
112
 
                                                           SKIP_OPEN_TABLE);
113
 
  if (name_col == NULL)
114
 
  {
115
 
    return true;
116
 
  }
117
 
 
118
 
  const drizzled::plugin::ColumnInfo *char_set_col= new(std::nothrow) drizzled::plugin::ColumnInfo("CHARACTER_SET_NAME",
119
 
                                                               64,
120
 
                                                               DRIZZLE_TYPE_VARCHAR,
121
 
                                                               0,
122
 
                                                               0,
123
 
                                                               "Default collation",
124
 
                                                               SKIP_OPEN_TABLE);
125
 
  if (char_set_col == NULL)
126
 
  {
127
 
    return true;
128
 
  }
129
 
 
130
 
  const drizzled::plugin::ColumnInfo *descrip_col= new(std::nothrow) drizzled::plugin::ColumnInfo("DESCRIPTION",
131
 
                                                              60,
132
 
                                                              DRIZZLE_TYPE_VARCHAR,
133
 
                                                              0,
134
 
                                                              0,
135
 
                                                              "Charset",
136
 
                                                              SKIP_OPEN_TABLE);
137
 
  if (descrip_col == NULL)
138
 
  {
139
 
    return true;
140
 
  }
141
 
 
142
 
  const drizzled::plugin::ColumnInfo *id_col= new(std::nothrow) drizzled::plugin::ColumnInfo("ID",
143
 
                                                         MY_INT32_NUM_DECIMAL_DIGITS,
144
 
                                                         DRIZZLE_TYPE_LONGLONG,
145
 
                                                         0,
146
 
                                                         0,
147
 
                                                         "Id",
148
 
                                                         SKIP_OPEN_TABLE);
149
 
  if (id_col == NULL)
150
 
  {
151
 
    return true;
152
 
  }
153
 
 
154
 
  const drizzled::plugin::ColumnInfo *default_col= new(std::nothrow) drizzled::plugin::ColumnInfo("IS_DEFAULT",
155
 
                                                              3,
156
 
                                                              DRIZZLE_TYPE_VARCHAR,
157
 
                                                              0,
158
 
                                                              0,
159
 
                                                              "Default",
160
 
                                                              SKIP_OPEN_TABLE);
161
 
  if (default_col == NULL)
162
 
  {
163
 
    return true;
164
 
  }
165
 
 
166
 
  const drizzled::plugin::ColumnInfo *compiled_col= new(std::nothrow) drizzled::plugin::ColumnInfo("IS_COMPILED",
167
 
                                                               3,
168
 
                                                               DRIZZLE_TYPE_VARCHAR,
169
 
                                                               0,
170
 
                                                               0,
171
 
                                                               "Compiled",
172
 
                                                               SKIP_OPEN_TABLE);
173
 
  if (compiled_col == NULL)
174
 
  {
175
 
    return true;
176
 
  }
177
 
 
178
 
  const drizzled::plugin::ColumnInfo *sortlen_col= new(std::nothrow) drizzled::plugin::ColumnInfo("SORTLEN",
179
 
                                                              3,
180
 
                                                              DRIZZLE_TYPE_LONGLONG,
181
 
                                                              0,
182
 
                                                              0,
183
 
                                                              "Sortlen",
184
 
                                                              SKIP_OPEN_TABLE);
185
 
  if (sortlen_col == NULL)
186
 
  {
187
 
    return true;
188
 
  }
189
 
 
190
 
  /*
191
 
   * Add the columns to the vector.
192
 
   */
193
 
  cols.push_back(name_col);
194
 
  cols.push_back(char_set_col);
195
 
  cols.push_back(descrip_col);
196
 
  cols.push_back(id_col);
197
 
  cols.push_back(default_col);
198
 
  cols.push_back(compiled_col);
199
 
  cols.push_back(sortlen_col);
200
 
 
201
 
  return false;
202
 
}
203
 
 
204
 
bool createCollCharSetColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
205
 
{
206
 
  /*
207
 
   * Create each column for the table.
208
 
   */
209
 
  const drizzled::plugin::ColumnInfo *name_col= new(std::nothrow) drizzled::plugin::ColumnInfo("COLLATION_NAME",
210
 
                                                           64,
211
 
                                                           DRIZZLE_TYPE_VARCHAR,
212
 
                                                           0,
213
 
                                                           0,
214
 
                                                           "",
215
 
                                                           SKIP_OPEN_TABLE);
216
 
  if (name_col == NULL)
217
 
  {
218
 
    return true;
219
 
  }
220
 
 
221
 
  const drizzled::plugin::ColumnInfo *char_set_col= new(std::nothrow) drizzled::plugin::ColumnInfo("CHARACTER_SET_NAME",
222
 
                                                               64,
223
 
                                                               DRIZZLE_TYPE_VARCHAR,
224
 
                                                               0,
225
 
                                                               0,
226
 
                                                               "",
227
 
                                                               SKIP_OPEN_TABLE);
228
 
  if (char_set_col == NULL)
229
 
  {
230
 
    return true;
231
 
  }
232
 
 
233
 
  /*
234
 
   * Add the columns to the vector.
235
 
   */
236
 
  cols.push_back(name_col);
237
 
  cols.push_back(char_set_col);
238
 
 
239
 
  return false;
240
 
}
241
 
 
242
 
bool createColColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
243
 
{
244
 
  /*
245
 
   * Create each column for the COLUMNS table.
246
 
   */
247
 
  const drizzled::plugin::ColumnInfo *tab_cat= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_CATALOG",
248
 
                                                          FN_REFLEN,
249
 
                                                          DRIZZLE_TYPE_VARCHAR,
250
 
                                                          0,
251
 
                                                          1,
252
 
                                                          "",
253
 
                                                          OPEN_FRM_ONLY);
254
 
  if (tab_cat == NULL)
255
 
  {
256
 
    return true;
257
 
  }
258
 
 
259
 
  const drizzled::plugin::ColumnInfo *tab_sch= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_SCHEMA",
260
 
                                                          NAME_CHAR_LEN,
261
 
                                                          DRIZZLE_TYPE_VARCHAR,
262
 
                                                          0,
263
 
                                                          0,
264
 
                                                          "",
265
 
                                                          OPEN_FRM_ONLY);
266
 
  if (tab_sch == NULL)
267
 
  {
268
 
    return true;
269
 
  }
270
 
 
271
 
  const drizzled::plugin::ColumnInfo *tab_name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
272
 
                                                           NAME_CHAR_LEN,
273
 
                                                           DRIZZLE_TYPE_VARCHAR,
274
 
                                                           0,
275
 
                                                           0,
276
 
                                                           "",
277
 
                                                           OPEN_FRM_ONLY);
278
 
  if (tab_name == NULL)
279
 
  {
280
 
    return true;
281
 
  }
282
 
 
283
 
  const drizzled::plugin::ColumnInfo *col_name= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_NAME",
284
 
                                                           NAME_CHAR_LEN,
285
 
                                                           DRIZZLE_TYPE_VARCHAR,
286
 
                                                           0,
287
 
                                                           0,
288
 
                                                           "Field",
289
 
                                                           OPEN_FRM_ONLY);
290
 
  if (col_name == NULL)
291
 
  {
292
 
    return true;
293
 
  }
294
 
 
295
 
  const drizzled::plugin::ColumnInfo *ord_pos= new(std::nothrow) drizzled::plugin::ColumnInfo("ORDINAL_POSITION",
296
 
                                                          MY_INT64_NUM_DECIMAL_DIGITS,
297
 
                                                          DRIZZLE_TYPE_LONGLONG,
298
 
                                                          0,
299
 
                                                          MY_I_S_UNSIGNED,
300
 
                                                          "",
301
 
                                                          OPEN_FRM_ONLY);
302
 
  if (ord_pos == NULL)
303
 
  {
304
 
    return true;
305
 
  }
306
 
 
307
 
  const drizzled::plugin::ColumnInfo *col_def= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_DEFAULT",
308
 
                                                          MAX_FIELD_VARCHARLENGTH,
309
 
                                                          DRIZZLE_TYPE_VARCHAR,
310
 
                                                          0,
311
 
                                                          1,
312
 
                                                          "Default",
313
 
                                                          OPEN_FRM_ONLY);
314
 
  if (col_def == NULL)
315
 
  {
316
 
    return true;
317
 
  }
318
 
 
319
 
  const drizzled::plugin::ColumnInfo *is_nullable= new(std::nothrow) drizzled::plugin::ColumnInfo("IS_NULLABLE",
320
 
                                                              3,
321
 
                                                              DRIZZLE_TYPE_VARCHAR,
322
 
                                                              0,
323
 
                                                              0,
324
 
                                                              "Null",
325
 
                                                              OPEN_FRM_ONLY);
326
 
  if (is_nullable == NULL)
327
 
  {
328
 
    return true;
329
 
  }
330
 
 
331
 
  const drizzled::plugin::ColumnInfo *data_type= new(std::nothrow) drizzled::plugin::ColumnInfo("DATA_TYPE",
332
 
                                                            NAME_CHAR_LEN,
333
 
                                                            DRIZZLE_TYPE_VARCHAR,
334
 
                                                            0,
335
 
                                                            0,
336
 
                                                            "",
337
 
                                                            OPEN_FRM_ONLY);
338
 
  if (data_type == NULL)
339
 
  {
340
 
    return true;
341
 
  }
342
 
 
343
 
  const drizzled::plugin::ColumnInfo *max_len= new(std::nothrow) drizzled::plugin::ColumnInfo("CHARACTER_MAXIMUM_LENGTH",
344
 
                                                          MY_INT64_NUM_DECIMAL_DIGITS,
345
 
                                                          DRIZZLE_TYPE_LONGLONG,
346
 
                                                          0,
347
 
                                                          (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
348
 
                                                          "",
349
 
                                                          OPEN_FRM_ONLY);
350
 
  if (max_len == NULL)
351
 
  {
352
 
    return true;
353
 
  }
354
 
 
355
 
  const drizzled::plugin::ColumnInfo *octet_len= new(std::nothrow) drizzled::plugin::ColumnInfo("CHARACTER_OCTET_LENGTH",
356
 
                                                            MY_INT64_NUM_DECIMAL_DIGITS,
357
 
                                                            DRIZZLE_TYPE_LONGLONG,
358
 
                                                            0,
359
 
                                                            (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
360
 
                                                            "",
361
 
                                                            OPEN_FRM_ONLY);
362
 
  if (octet_len == NULL)
363
 
  {
364
 
    return true;
365
 
  }
366
 
 
367
 
  const drizzled::plugin::ColumnInfo *num_prec= new(std::nothrow) drizzled::plugin::ColumnInfo("NUMERIC_PRECISION",
368
 
                                                           MY_INT64_NUM_DECIMAL_DIGITS,
369
 
                                                           DRIZZLE_TYPE_LONGLONG,
370
 
                                                           0,
371
 
                                                           (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
372
 
                                                           "",
373
 
                                                           OPEN_FRM_ONLY);
374
 
  if (num_prec == NULL)
375
 
  {
376
 
    return true;
377
 
  }
378
 
 
379
 
  const drizzled::plugin::ColumnInfo *num_scale= new(std::nothrow) drizzled::plugin::ColumnInfo("NUMERIC_SCALE",
380
 
                                                            MY_INT64_NUM_DECIMAL_DIGITS,
381
 
                                                            DRIZZLE_TYPE_LONGLONG,
382
 
                                                            0,
383
 
                                                            (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
384
 
                                                            "",
385
 
                                                            OPEN_FRM_ONLY);
386
 
  if (num_scale == NULL)
387
 
  {
388
 
    return true;
389
 
  }
390
 
 
391
 
  const drizzled::plugin::ColumnInfo *char_set_name= new(std::nothrow) drizzled::plugin::ColumnInfo("CHARACTER_SET_NAME",
392
 
                                                                64,
393
 
                                                                DRIZZLE_TYPE_VARCHAR,
394
 
                                                                0,
395
 
                                                                1,
396
 
                                                                "",
397
 
                                                                OPEN_FRM_ONLY);
398
 
  if (char_set_name == NULL)
399
 
  {
400
 
    return true;
401
 
  }
402
 
 
403
 
  const drizzled::plugin::ColumnInfo *coll_name= new(std::nothrow) drizzled::plugin::ColumnInfo("COLLATION_NAME",
404
 
                                                            64,
405
 
                                                            DRIZZLE_TYPE_VARCHAR,
406
 
                                                            0,
407
 
                                                            1,
408
 
                                                            "Collation",
409
 
                                                            OPEN_FRM_ONLY);
410
 
  if (coll_name == NULL)
411
 
  {
412
 
    return true;
413
 
  }
414
 
 
415
 
  const drizzled::plugin::ColumnInfo *col_type= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_TYPE",
416
 
                                                           65535,
417
 
                                                           DRIZZLE_TYPE_VARCHAR,
418
 
                                                           0,
419
 
                                                           0,
420
 
                                                           "Type",
421
 
                                                           OPEN_FRM_ONLY);
422
 
  if (col_type == NULL)
423
 
  {
424
 
    return true;
425
 
  }
426
 
 
427
 
  const drizzled::plugin::ColumnInfo *col_key= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_KEY",
428
 
                                                          3,
429
 
                                                          DRIZZLE_TYPE_VARCHAR,
430
 
                                                          0,
431
 
                                                          0,
432
 
                                                          "Key",
433
 
                                                          OPEN_FRM_ONLY);
434
 
  if (col_key == NULL)
435
 
  {
436
 
    return true;
437
 
  }
438
 
 
439
 
  const drizzled::plugin::ColumnInfo *extra= new(std::nothrow) drizzled::plugin::ColumnInfo("EXTRA",
440
 
                                                        27,
441
 
                                                        DRIZZLE_TYPE_VARCHAR,
442
 
                                                        0,
443
 
                                                        0,
444
 
                                                        "Extra",
445
 
                                                        OPEN_FRM_ONLY);
446
 
  if (extra == NULL)
447
 
  {
448
 
    return true;
449
 
  }
450
 
 
451
 
  const drizzled::plugin::ColumnInfo *priv= new(std::nothrow) drizzled::plugin::ColumnInfo("PRIVILEGES",
452
 
                                                       80,
453
 
                                                       DRIZZLE_TYPE_VARCHAR,
454
 
                                                       0,
455
 
                                                       0,
456
 
                                                       "Privileges",
457
 
                                                       OPEN_FRM_ONLY);
458
 
  if (priv == NULL)
459
 
  {
460
 
    return true;
461
 
  }
462
 
 
463
 
  const drizzled::plugin::ColumnInfo *col_comment= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_COMMENT",
464
 
                                                              COLUMN_COMMENT_MAXLEN,
465
 
                                                              DRIZZLE_TYPE_VARCHAR,
466
 
                                                              0,
467
 
                                                              0,
468
 
                                                              "Comment",
469
 
                                                              OPEN_FRM_ONLY);
470
 
  if (col_comment == NULL)
471
 
  {
472
 
    return true;
473
 
  }
474
 
 
475
 
  const drizzled::plugin::ColumnInfo *storage= new(std::nothrow) drizzled::plugin::ColumnInfo("STORAGE",
476
 
                                                          8,
477
 
                                                          DRIZZLE_TYPE_VARCHAR,
478
 
                                                          0,
479
 
                                                          0,
480
 
                                                          "Storage",
481
 
                                                          OPEN_FRM_ONLY);
482
 
  if (storage == NULL)
483
 
  {
484
 
    return true;
485
 
  }
486
 
 
487
 
  const drizzled::plugin::ColumnInfo *format= new(std::nothrow) drizzled::plugin::ColumnInfo("FORMAT",
488
 
                                                         8,
489
 
                                                         DRIZZLE_TYPE_VARCHAR,
490
 
                                                         0,
491
 
                                                         0,
492
 
                                                         "Format",
493
 
                                                         OPEN_FRM_ONLY);
494
 
  if (format == NULL)
495
 
  {
496
 
    return true;
497
 
  }
498
 
 
499
 
  /*
500
 
   * Add the columns to the vector.
501
 
   */
502
 
  cols.push_back(tab_cat);
503
 
  cols.push_back(tab_sch);
504
 
  cols.push_back(tab_name);
505
 
  cols.push_back(col_name);
506
 
  cols.push_back(ord_pos);
507
 
  cols.push_back(col_def);
508
 
  cols.push_back(is_nullable);
509
 
  cols.push_back(data_type);
510
 
  cols.push_back(max_len);
511
 
  cols.push_back(octet_len);
512
 
  cols.push_back(num_prec);
513
 
  cols.push_back(num_scale);
514
 
  cols.push_back(char_set_name);
515
 
  cols.push_back(coll_name);
516
 
  cols.push_back(col_type);
517
 
  cols.push_back(col_key);
518
 
  cols.push_back(extra);
519
 
  cols.push_back(priv);
520
 
  cols.push_back(col_comment);
521
 
  cols.push_back(storage);
522
 
  cols.push_back(format);
523
 
 
524
 
  return false;
525
 
}
526
 
 
527
 
bool createKeyColUsageColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
528
 
{
529
 
  const drizzled::plugin::ColumnInfo *cat= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_CATALOG",
530
 
                                                      FN_REFLEN,
531
 
                                                      DRIZZLE_TYPE_VARCHAR,
532
 
                                                      0,
533
 
                                                      1,
534
 
                                                      "",
535
 
                                                      OPEN_FULL_TABLE);
536
 
  if (cat == NULL)
537
 
  {
538
 
    return true;
539
 
  }
540
 
 
541
 
  const drizzled::plugin::ColumnInfo *sch= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_SCHEMA",
542
 
                                                      NAME_CHAR_LEN,
543
 
                                                      DRIZZLE_TYPE_VARCHAR,
544
 
                                                      0,
545
 
                                                      0,
546
 
                                                      "",
547
 
                                                      OPEN_FULL_TABLE);
548
 
  if (sch == NULL)
549
 
  {
550
 
    return true;
551
 
  }
552
 
 
553
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_NAME",
554
 
                                                       NAME_CHAR_LEN,
555
 
                                                       DRIZZLE_TYPE_VARCHAR,
556
 
                                                       0,
557
 
                                                       0,
558
 
                                                       "",
559
 
                                                       OPEN_FULL_TABLE);
560
 
  if (name == NULL)
561
 
  {
562
 
    return true;
563
 
  }
564
 
 
565
 
  const drizzled::plugin::ColumnInfo *tab_cat= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_CATALOG",
566
 
                                                          FN_REFLEN,
567
 
                                                          DRIZZLE_TYPE_VARCHAR,
568
 
                                                          0,
569
 
                                                          1,
570
 
                                                          "",
571
 
                                                          OPEN_FULL_TABLE);
572
 
  if (tab_cat == NULL)
573
 
  {
574
 
    return true;
575
 
  }
576
 
 
577
 
  const drizzled::plugin::ColumnInfo *tab_sch= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_SCHEMA",
578
 
                                                          NAME_CHAR_LEN,
579
 
                                                          DRIZZLE_TYPE_VARCHAR,
580
 
                                                          0,
581
 
                                                          0,
582
 
                                                          "",
583
 
                                                          OPEN_FULL_TABLE);
584
 
  if (tab_sch == NULL)
585
 
  {
586
 
    return true;
587
 
  }
588
 
 
589
 
  const drizzled::plugin::ColumnInfo *tab_name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
590
 
                                                           NAME_CHAR_LEN,
591
 
                                                           DRIZZLE_TYPE_VARCHAR,
592
 
                                                           0,
593
 
                                                           0,
594
 
                                                           "",
595
 
                                                           OPEN_FULL_TABLE);
596
 
  if (tab_name == NULL)
597
 
  {
598
 
    return true;
599
 
  }
600
 
 
601
 
  const drizzled::plugin::ColumnInfo *col_name= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_NAME",
602
 
                                                           NAME_CHAR_LEN,
603
 
                                                           DRIZZLE_TYPE_VARCHAR,
604
 
                                                           0,
605
 
                                                           0,
606
 
                                                           "",
607
 
                                                           OPEN_FULL_TABLE);
608
 
  if (col_name == NULL)
609
 
  {
610
 
    return true;
611
 
  }
612
 
  const drizzled::plugin::ColumnInfo *ord_pos= new(std::nothrow) drizzled::plugin::ColumnInfo("ORDINAL_POSITION",
613
 
                                                          10,
614
 
                                                          DRIZZLE_TYPE_LONGLONG,
615
 
                                                          0,
616
 
                                                          0,
617
 
                                                          "",
618
 
                                                          OPEN_FULL_TABLE);
619
 
  if (ord_pos == NULL)
620
 
  {
621
 
    return true;
622
 
  }
623
 
 
624
 
  const drizzled::plugin::ColumnInfo *pos_in_uniq= new(std::nothrow) drizzled::plugin::ColumnInfo("POSITION_IN_UNIQUE_CONSTRAINT",
625
 
                                                              10,
626
 
                                                              DRIZZLE_TYPE_LONGLONG,
627
 
                                                              0,
628
 
                                                              1,
629
 
                                                              "",
630
 
                                                              OPEN_FULL_TABLE);
631
 
  if (pos_in_uniq == NULL)
632
 
  {
633
 
    return true;
634
 
  }
635
 
 
636
 
  const drizzled::plugin::ColumnInfo *ref_tab_sch= new(std::nothrow) drizzled::plugin::ColumnInfo("REFERENCED_TABLE_SCHEMA",
637
 
                                                              NAME_CHAR_LEN,
638
 
                                                              DRIZZLE_TYPE_VARCHAR,
639
 
                                                              0,
640
 
                                                              1,
641
 
                                                              "",
642
 
                                                              OPEN_FULL_TABLE);
643
 
  if (ref_tab_sch == NULL)
644
 
  {
645
 
    return true;
646
 
  }
647
 
 
648
 
  const drizzled::plugin::ColumnInfo *ref_tab_name= new(std::nothrow) drizzled::plugin::ColumnInfo("REFERENCED_TABLE_NAME",
649
 
                                                               NAME_CHAR_LEN,
650
 
                                                               DRIZZLE_TYPE_VARCHAR,
651
 
                                                               0,
652
 
                                                               1,
653
 
                                                               "",
654
 
                                                               OPEN_FULL_TABLE);
655
 
  if (ref_tab_name == NULL)
656
 
  {
657
 
    return true;
658
 
  }
659
 
 
660
 
  const drizzled::plugin::ColumnInfo *ref_col_name= new(std::nothrow) drizzled::plugin::ColumnInfo("REFERENCED_COLUMN_NAME",
661
 
                                                               NAME_CHAR_LEN,
662
 
                                                               DRIZZLE_TYPE_VARCHAR,
663
 
                                                               0,
664
 
                                                               1,
665
 
                                                               "",
666
 
                                                               OPEN_FULL_TABLE);
667
 
  if (ref_col_name == NULL)
668
 
  {
669
 
    return true;
670
 
  }
671
 
 
672
 
  cols.push_back(cat);
673
 
  cols.push_back(sch);
674
 
  cols.push_back(name);
675
 
  cols.push_back(tab_cat);
676
 
  cols.push_back(tab_sch);
677
 
  cols.push_back(tab_name);
678
 
  cols.push_back(col_name);
679
 
  cols.push_back(ord_pos);
680
 
  cols.push_back(pos_in_uniq);
681
 
  cols.push_back(ref_tab_sch);
682
 
  cols.push_back(ref_tab_name);
683
 
  cols.push_back(ref_col_name);
684
 
 
685
 
  return false;
686
 
}
687
 
 
688
 
bool createOpenTabColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
689
 
{
690
 
  const drizzled::plugin::ColumnInfo *db= new(std::nothrow) drizzled::plugin::ColumnInfo("Database",
691
 
                                                     NAME_CHAR_LEN,
692
 
                                                     DRIZZLE_TYPE_VARCHAR,
693
 
                                                     0,
694
 
                                                     0,
695
 
                                                     "Database",
696
 
                                                     SKIP_OPEN_TABLE);
697
 
  if (db == NULL)
698
 
  {
699
 
    return true;
700
 
  }
701
 
 
702
 
  const drizzled::plugin::ColumnInfo *tab= new(std::nothrow) drizzled::plugin::ColumnInfo("Table",
703
 
                                                      NAME_CHAR_LEN,
704
 
                                                      DRIZZLE_TYPE_VARCHAR,
705
 
                                                      0,
706
 
                                                      0,
707
 
                                                      "Table",
708
 
                                                      SKIP_OPEN_TABLE);
709
 
  if (tab == NULL)
710
 
  {
711
 
    return true;
712
 
  }
713
 
 
714
 
  const drizzled::plugin::ColumnInfo *in_use= new(std::nothrow) drizzled::plugin::ColumnInfo("In_use",
715
 
                                                         1,
716
 
                                                         DRIZZLE_TYPE_LONGLONG,
717
 
                                                         0,
718
 
                                                         0,
719
 
                                                         "In_use",
720
 
                                                         SKIP_OPEN_TABLE);
721
 
  if (in_use == NULL)
722
 
  {
723
 
    return true;
724
 
  }
725
 
 
726
 
  const drizzled::plugin::ColumnInfo *name_locked= new(std::nothrow) drizzled::plugin::ColumnInfo("Name_locked",
727
 
                                                              4,
728
 
                                                              DRIZZLE_TYPE_LONGLONG,
729
 
                                                              0,
730
 
                                                              0,
731
 
                                                              "Name_locked",
732
 
                                                              SKIP_OPEN_TABLE);
733
 
  if (name_locked == NULL)
734
 
  {
735
 
    return true;
736
 
  }
737
 
 
738
 
  cols.push_back(db);
739
 
  cols.push_back(tab);
740
 
  cols.push_back(in_use);
741
 
  cols.push_back(name_locked);
742
 
 
743
 
  return false;
744
 
}
745
 
 
746
 
bool createModulesColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
747
 
{
748
 
  const drizzled::plugin::ColumnInfo *name=
749
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_NAME",
750
 
                                                    NAME_CHAR_LEN,
751
 
                                                    DRIZZLE_TYPE_VARCHAR,
752
 
                                                    0,
753
 
                                                    0,
754
 
                                                    "Name",
755
 
                                                    SKIP_OPEN_TABLE);
756
 
  if (name == NULL)
757
 
  {
758
 
    return true;
759
 
  }
760
 
 
761
 
  const drizzled::plugin::ColumnInfo *ver=
762
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_VERSION",
763
 
                                                   20,
764
 
                                                   DRIZZLE_TYPE_VARCHAR,
765
 
                                                   0,
766
 
                                                   0,
767
 
                                                   "",
768
 
                                                   SKIP_OPEN_TABLE);
769
 
  if (ver == NULL)
770
 
  {
771
 
    return true;
772
 
  }
773
 
 
774
 
  const drizzled::plugin::ColumnInfo *aut=
775
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_AUTHOR",
776
 
                                                   NAME_CHAR_LEN,
777
 
                                                   DRIZZLE_TYPE_VARCHAR,
778
 
                                                   0,
779
 
                                                   1,
780
 
                                                   "",
781
 
                                                   SKIP_OPEN_TABLE);
782
 
  if (aut == NULL)
783
 
  {
784
 
    return true;
785
 
  }
786
 
 
787
 
  const drizzled::plugin::ColumnInfo *is_builtin=
788
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("IS_BUILTIN",
789
 
                                                   3,
790
 
                                                   DRIZZLE_TYPE_VARCHAR,
791
 
                                                   0,
792
 
                                                   0,
793
 
                                                   "",
794
 
                                                   SKIP_OPEN_TABLE);
795
 
  if (is_builtin == NULL)
796
 
  {
797
 
    return true;
798
 
  }
799
 
 
800
 
  const drizzled::plugin::ColumnInfo *library=
801
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_LIBRARY",
802
 
                                                   65535,
803
 
                                                   DRIZZLE_TYPE_VARCHAR,
804
 
                                                   0,
805
 
                                                   1,
806
 
                                                   "",
807
 
                                                   SKIP_OPEN_TABLE);
808
 
  if (library == NULL)
809
 
  {
810
 
    return true;
811
 
  }
812
 
 
813
 
  const drizzled::plugin::ColumnInfo *descrip=
814
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_DESCRIPTION",
815
 
                                                   65535,
816
 
                                                   DRIZZLE_TYPE_VARCHAR,
817
 
                                                   0,
818
 
                                                   1,
819
 
                                                   "",
820
 
                                                   SKIP_OPEN_TABLE);
821
 
  if (descrip == NULL)
822
 
  {
823
 
    return true;
824
 
  }
825
 
 
826
 
  const drizzled::plugin::ColumnInfo *lic=
827
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_LICENSE",
828
 
                                                   80,
829
 
                                                   DRIZZLE_TYPE_VARCHAR,
830
 
                                                   0,
831
 
                                                   1,
832
 
                                                   "License",
833
 
                                                   SKIP_OPEN_TABLE);
834
 
  if (lic == NULL)
835
 
  {
836
 
    return true;
837
 
  }
838
 
 
839
 
  cols.push_back(name);
840
 
  cols.push_back(ver);
841
 
  cols.push_back(aut);
842
 
  cols.push_back(is_builtin);
843
 
  cols.push_back(library);
844
 
  cols.push_back(descrip);
845
 
  cols.push_back(lic);
846
 
 
847
 
  return false;
848
 
}
849
 
 
850
 
bool createPluginsColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
851
 
{
852
 
  const drizzled::plugin::ColumnInfo *name=
853
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("PLUGIN_NAME",
854
 
                                                   NAME_CHAR_LEN,
855
 
                                                   DRIZZLE_TYPE_VARCHAR,
856
 
                                                   0,
857
 
                                                   0,
858
 
                                                   "Name",
859
 
                                                   SKIP_OPEN_TABLE);
860
 
  if (name == NULL)
861
 
  {
862
 
    return true;
863
 
  }
864
 
 
865
 
  const drizzled::plugin::ColumnInfo *ptype=
866
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("PLUGIN_TYPE",
867
 
                                                   NAME_CHAR_LEN,
868
 
                                                   DRIZZLE_TYPE_VARCHAR,
869
 
                                                   0,
870
 
                                                   0,
871
 
                                                   "",
872
 
                                                   SKIP_OPEN_TABLE);
873
 
  if (name == NULL)
874
 
  {
875
 
    return true;
876
 
  }
877
 
 
878
 
  const drizzled::plugin::ColumnInfo *is_active=
879
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("IS_ACTIVE",
880
 
                                                   3,
881
 
                                                   DRIZZLE_TYPE_VARCHAR,
882
 
                                                   0,
883
 
                                                   0,
884
 
                                                   "",
885
 
                                                   SKIP_OPEN_TABLE);
886
 
  if (is_active == NULL)
887
 
  {
888
 
    return true;
889
 
  }
890
 
 
891
 
  const drizzled::plugin::ColumnInfo *mod_name=
892
 
    new(std::nothrow) drizzled::plugin::ColumnInfo("MODULE_NAME",
893
 
                                                    NAME_CHAR_LEN,
894
 
                                                    DRIZZLE_TYPE_VARCHAR,
895
 
                                                    0,
896
 
                                                    0,
897
 
                                                    "Name",
898
 
                                                    SKIP_OPEN_TABLE);
899
 
  if (name == NULL)
900
 
  {
901
 
    return true;
902
 
  }
903
 
  cols.push_back(name);
904
 
  cols.push_back(ptype);
905
 
  cols.push_back(is_active);
906
 
  cols.push_back(mod_name);
907
 
 
908
 
  return false;
909
 
}
910
 
 
911
 
 
912
 
bool createProcessListColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
913
 
{
914
 
  /*
915
 
   * Create each column for the PROCESSLIST table.
916
 
   */
917
 
  const drizzled::plugin::ColumnInfo *id_col= new(std::nothrow) drizzled::plugin::ColumnInfo("ID", 
918
 
                                                         4,
919
 
                                                         DRIZZLE_TYPE_LONGLONG,
920
 
                                                         0,
921
 
                                                         0,
922
 
                                                         "Id",
923
 
                                                         SKIP_OPEN_TABLE);
924
 
  if (id_col == NULL)
925
 
  {
926
 
    return true;
927
 
  }
928
 
 
929
 
  const drizzled::plugin::ColumnInfo *user_col= new(std::nothrow) drizzled::plugin::ColumnInfo("USER",
930
 
                                                           16,
931
 
                                                           DRIZZLE_TYPE_VARCHAR,
932
 
                                                           0,
933
 
                                                           0,
934
 
                                                           "User",
935
 
                                                           SKIP_OPEN_TABLE);
936
 
  if (user_col == NULL)
937
 
  {
938
 
    return true;
939
 
  }
940
 
 
941
 
  const drizzled::plugin::ColumnInfo *host_col= new(std::nothrow) drizzled::plugin::ColumnInfo("HOST",
942
 
                                                           LIST_PROCESS_HOST_LEN,
943
 
                                                           DRIZZLE_TYPE_VARCHAR,
944
 
                                                           0,
945
 
                                                           0,
946
 
                                                           "Host",
947
 
                                                           SKIP_OPEN_TABLE);
948
 
  if (host_col == NULL)
949
 
  {
950
 
    return true;
951
 
  }
952
 
 
953
 
  const drizzled::plugin::ColumnInfo *db_col= new(std::nothrow) drizzled::plugin::ColumnInfo("DB",
954
 
                                                         NAME_CHAR_LEN,
955
 
                                                         DRIZZLE_TYPE_VARCHAR,
956
 
                                                         0,
957
 
                                                         1,
958
 
                                                         "Db",
959
 
                                                         SKIP_OPEN_TABLE);
960
 
  if (db_col == NULL)
961
 
  {
962
 
    return true;
963
 
  }
964
 
 
965
 
  const drizzled::plugin::ColumnInfo *command_col= new(std::nothrow) drizzled::plugin::ColumnInfo("COMMAND",
966
 
                                                              16,
967
 
                                                              DRIZZLE_TYPE_VARCHAR,
968
 
                                                              0,
969
 
                                                              0,
970
 
                                                              "Command",
971
 
                                                              SKIP_OPEN_TABLE);
972
 
  if (command_col == NULL)
973
 
  {
974
 
    return true;
975
 
  }
976
 
 
977
 
  const drizzled::plugin::ColumnInfo *time_col= new(std::nothrow) drizzled::plugin::ColumnInfo("TIME",
978
 
                                                           7,
979
 
                                                           DRIZZLE_TYPE_LONGLONG,
980
 
                                                           0,
981
 
                                                           0,
982
 
                                                           "Time",
983
 
                                                           SKIP_OPEN_TABLE);
984
 
  if (time_col == NULL)
985
 
  {
986
 
    return true;
987
 
  }
988
 
 
989
 
  const drizzled::plugin::ColumnInfo *state_col= new(std::nothrow) drizzled::plugin::ColumnInfo("STATE",
990
 
                                                            64,
991
 
                                                            DRIZZLE_TYPE_VARCHAR,
992
 
                                                            0,
993
 
                                                            1,
994
 
                                                            "State",
995
 
                                                            SKIP_OPEN_TABLE);
996
 
  if (state_col == NULL)
997
 
  {
998
 
    return true;
999
 
  }
1000
 
 
1001
 
  const drizzled::plugin::ColumnInfo *info_col= new(std::nothrow) drizzled::plugin::ColumnInfo("INFO",
1002
 
                                                           PROCESS_LIST_INFO_WIDTH,
1003
 
                                                           DRIZZLE_TYPE_VARCHAR,
1004
 
                                                           0,
1005
 
                                                           1,
1006
 
                                                           "Info",
1007
 
                                                           SKIP_OPEN_TABLE);
1008
 
  if (info_col == NULL)
1009
 
  {
1010
 
    return true;
1011
 
  }
1012
 
 
1013
 
  /*
1014
 
   * Add the columns to the vector.
1015
 
   */
1016
 
  cols.push_back(id_col);
1017
 
  cols.push_back(user_col);
1018
 
  cols.push_back(host_col);
1019
 
  cols.push_back(db_col);
1020
 
  cols.push_back(command_col);
1021
 
  cols.push_back(time_col);
1022
 
  cols.push_back(state_col);
1023
 
  cols.push_back(info_col);
1024
 
 
1025
 
  return false;
1026
 
}
1027
 
 
1028
 
bool createRefConstraintColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1029
 
{
1030
 
  /*
1031
 
   * Create the columns for the table.
1032
 
   */
1033
 
  const drizzled::plugin::ColumnInfo *cat= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_CATALOG",
1034
 
                                                      FN_REFLEN,
1035
 
                                                      DRIZZLE_TYPE_VARCHAR,
1036
 
                                                      0,
1037
 
                                                      1,
1038
 
                                                      "",
1039
 
                                                      OPEN_FULL_TABLE);
1040
 
 
1041
 
  if (cat == NULL)
1042
 
  {
1043
 
    return true;
1044
 
  }
1045
 
 
1046
 
  const drizzled::plugin::ColumnInfo *sch= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_SCHEMA",
1047
 
                                                      NAME_CHAR_LEN,
1048
 
                                                      DRIZZLE_TYPE_VARCHAR,
1049
 
                                                      0,
1050
 
                                                      0,
1051
 
                                                      "",
1052
 
                                                      OPEN_FULL_TABLE);
1053
 
  if (sch == NULL)
1054
 
  {
1055
 
    return true;
1056
 
  }
1057
 
 
1058
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_NAME",
1059
 
                                                       NAME_CHAR_LEN,
1060
 
                                                       DRIZZLE_TYPE_VARCHAR,
1061
 
                                                       0,
1062
 
                                                       0,
1063
 
                                                       "",
1064
 
                                                       OPEN_FULL_TABLE);
1065
 
  if (name == NULL)
1066
 
  {
1067
 
    return true;
1068
 
  }
1069
 
 
1070
 
  const drizzled::plugin::ColumnInfo *uniq_cat= new(std::nothrow) drizzled::plugin::ColumnInfo("UNIQUE_CONSTRAINT_CATALOG",
1071
 
                                                           FN_REFLEN,
1072
 
                                                           DRIZZLE_TYPE_VARCHAR,
1073
 
                                                           0,
1074
 
                                                           1,
1075
 
                                                           "",
1076
 
                                                           OPEN_FULL_TABLE);
1077
 
  if (uniq_cat == NULL)
1078
 
  {
1079
 
    return true;
1080
 
  }
1081
 
 
1082
 
  const drizzled::plugin::ColumnInfo *uniq_sch= new(std::nothrow) drizzled::plugin::ColumnInfo("UNIQUE_CONSTRAINT_SCHEMA",
1083
 
                                                           NAME_CHAR_LEN,
1084
 
                                                           DRIZZLE_TYPE_VARCHAR,
1085
 
                                                           0,
1086
 
                                                           0,
1087
 
                                                           "",
1088
 
                                                           OPEN_FULL_TABLE);
1089
 
  if (uniq_sch == NULL)
1090
 
  {
1091
 
    return true;
1092
 
  }
1093
 
 
1094
 
  const drizzled::plugin::ColumnInfo *uniq_name= new(std::nothrow) drizzled::plugin::ColumnInfo("UNIQUE_CONSTRAINT_NAME",
1095
 
                                                            NAME_CHAR_LEN,
1096
 
                                                            DRIZZLE_TYPE_VARCHAR,
1097
 
                                                            0,
1098
 
                                                            MY_I_S_MAYBE_NULL,
1099
 
                                                            "",
1100
 
                                                            OPEN_FULL_TABLE);
1101
 
  if (uniq_name == NULL)
1102
 
  {
1103
 
    return true;
1104
 
  }
1105
 
 
1106
 
  const drizzled::plugin::ColumnInfo *match= new(std::nothrow) drizzled::plugin::ColumnInfo("MATCH_OPTION",
1107
 
                                                        NAME_CHAR_LEN,
1108
 
                                                        DRIZZLE_TYPE_VARCHAR,
1109
 
                                                        0,
1110
 
                                                        0,
1111
 
                                                        "",
1112
 
                                                        OPEN_FULL_TABLE);
1113
 
  if (match == NULL)
1114
 
  {
1115
 
    return true;
1116
 
  }
1117
 
 
1118
 
  const drizzled::plugin::ColumnInfo *update= new(std::nothrow) drizzled::plugin::ColumnInfo("UPDATE_RULE",
1119
 
                                                         NAME_CHAR_LEN,
1120
 
                                                         DRIZZLE_TYPE_VARCHAR,
1121
 
                                                         0,
1122
 
                                                         0,
1123
 
                                                         "",
1124
 
                                                         OPEN_FULL_TABLE);
1125
 
  if (update == NULL)
1126
 
  {
1127
 
    return true;
1128
 
  }
1129
 
 
1130
 
  const drizzled::plugin::ColumnInfo *del_rule= new(std::nothrow) drizzled::plugin::ColumnInfo("DELETE_RULE",
1131
 
                                                           NAME_CHAR_LEN,
1132
 
                                                           DRIZZLE_TYPE_VARCHAR,
1133
 
                                                           0,
1134
 
                                                           0,
1135
 
                                                           "",
1136
 
                                                           OPEN_FULL_TABLE);
1137
 
  if (del_rule == NULL)
1138
 
  {
1139
 
    return true;
1140
 
  }
1141
 
 
1142
 
  const drizzled::plugin::ColumnInfo *tab_name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
1143
 
                                                           NAME_CHAR_LEN,
1144
 
                                                           DRIZZLE_TYPE_VARCHAR,
1145
 
                                                           0,
1146
 
                                                           0,
1147
 
                                                           "",
1148
 
                                                           OPEN_FULL_TABLE);
1149
 
  if (tab_name == NULL)
1150
 
  {
1151
 
    return true;
1152
 
  }
1153
 
 
1154
 
  const drizzled::plugin::ColumnInfo *ref_name= new(std::nothrow) drizzled::plugin::ColumnInfo("REFERENCED_TABLE_NAME",
1155
 
                                                           NAME_CHAR_LEN,
1156
 
                                                           DRIZZLE_TYPE_VARCHAR,
1157
 
                                                           0,
1158
 
                                                           0,
1159
 
                                                           "",
1160
 
                                                           OPEN_FULL_TABLE);
1161
 
  if (ref_name == NULL)
1162
 
  {
1163
 
    return true;
1164
 
  }
1165
 
 
1166
 
  /*
1167
 
   * Add the columns to the vector.
1168
 
   */
1169
 
  cols.push_back(cat);
1170
 
  cols.push_back(sch);
1171
 
  cols.push_back(name);
1172
 
  cols.push_back(uniq_cat);
1173
 
  cols.push_back(uniq_sch);
1174
 
  cols.push_back(uniq_name);
1175
 
  cols.push_back(match);
1176
 
  cols.push_back(update);
1177
 
  cols.push_back(del_rule);
1178
 
  cols.push_back(tab_name);
1179
 
  cols.push_back(ref_name);
1180
 
 
1181
 
  return false;
1182
 
}
1183
 
 
1184
 
bool createSchemataColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1185
 
{
1186
 
  const drizzled::plugin::ColumnInfo *cat_name= new(std::nothrow) drizzled::plugin::ColumnInfo("CATALOG_NAME",
1187
 
                                                           FN_REFLEN,
1188
 
                                                           DRIZZLE_TYPE_VARCHAR,
1189
 
                                                           0, 
1190
 
                                                           1, 
1191
 
                                                           "", 
1192
 
                                                           SKIP_OPEN_TABLE);
1193
 
  if (cat_name == NULL)
1194
 
  {
1195
 
    return true;
1196
 
  }
1197
 
 
1198
 
  const drizzled::plugin::ColumnInfo *sch_name= new(std::nothrow) drizzled::plugin::ColumnInfo("SCHEMA_NAME",
1199
 
                                                           NAME_CHAR_LEN,
1200
 
                                                           DRIZZLE_TYPE_VARCHAR,
1201
 
                                                           0, 
1202
 
                                                           0, 
1203
 
                                                           "Database", 
1204
 
                                                           SKIP_OPEN_TABLE);
1205
 
  if (sch_name == NULL)
1206
 
  {
1207
 
    return true;
1208
 
  }
1209
 
 
1210
 
  const drizzled::plugin::ColumnInfo *cs_name= new(std::nothrow) drizzled::plugin::ColumnInfo("DEFAULT_CHARACTER_SET_NAME",
1211
 
                                                          64, 
1212
 
                                                          DRIZZLE_TYPE_VARCHAR, 
1213
 
                                                          0, 
1214
 
                                                          0, 
1215
 
                                                          "",
1216
 
                                                          SKIP_OPEN_TABLE);
1217
 
  if (cs_name == NULL)
1218
 
  {
1219
 
    return true;
1220
 
  }
1221
 
 
1222
 
  const drizzled::plugin::ColumnInfo *coll_name= new(std::nothrow) drizzled::plugin::ColumnInfo("DEFAULT_COLLATION_NAME",
1223
 
                                                            64, 
1224
 
                                                            DRIZZLE_TYPE_VARCHAR, 
1225
 
                                                            0, 
1226
 
                                                            0, 
1227
 
                                                            "",
1228
 
                                                            SKIP_OPEN_TABLE);
1229
 
  if (coll_name == NULL)
1230
 
  {
1231
 
    return true;
1232
 
  }
1233
 
 
1234
 
  const drizzled::plugin::ColumnInfo *sql_path= new(std::nothrow) drizzled::plugin::ColumnInfo("SQL_PATH",
1235
 
                                                           FN_REFLEN,
1236
 
                                                           DRIZZLE_TYPE_VARCHAR,
1237
 
                                                           0, 
1238
 
                                                           1, 
1239
 
                                                           "", 
1240
 
                                                           SKIP_OPEN_TABLE);
1241
 
  if (sql_path == NULL)
1242
 
  {
1243
 
    return true;
1244
 
  }
1245
 
 
1246
 
  cols.push_back(cat_name);
1247
 
  cols.push_back(sch_name);
1248
 
  cols.push_back(cs_name);
1249
 
  cols.push_back(coll_name);
1250
 
  cols.push_back(sql_path);
1251
 
 
1252
 
  return false;
1253
 
}
1254
 
 
1255
 
bool createStatsColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1256
 
{
1257
 
  const drizzled::plugin::ColumnInfo *cat= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_CATALOG",
1258
 
                                                      FN_REFLEN,
1259
 
                                                      DRIZZLE_TYPE_VARCHAR,
1260
 
                                                      0,
1261
 
                                                      1,
1262
 
                                                      "",
1263
 
                                                      OPEN_FRM_ONLY);
1264
 
  if (cat == NULL)
1265
 
  {
1266
 
    return true;
1267
 
  }
1268
 
 
1269
 
  const drizzled::plugin::ColumnInfo *sch= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_SCHEMA",
1270
 
                                                      NAME_CHAR_LEN,
1271
 
                                                      DRIZZLE_TYPE_VARCHAR,
1272
 
                                                      0,
1273
 
                                                      0,
1274
 
                                                      "",
1275
 
                                                      OPEN_FRM_ONLY);
1276
 
  if (sch == NULL)
1277
 
  {
1278
 
    return true;
1279
 
  }
1280
 
  
1281
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
1282
 
                                                       NAME_CHAR_LEN,
1283
 
                                                       DRIZZLE_TYPE_VARCHAR,
1284
 
                                                       0,
1285
 
                                                       0,
1286
 
                                                       "Table",
1287
 
                                                       OPEN_FRM_ONLY);
1288
 
  if (name == NULL)
1289
 
  {
1290
 
    return true;
1291
 
  }
1292
 
 
1293
 
  const drizzled::plugin::ColumnInfo *uniq= new(std::nothrow) drizzled::plugin::ColumnInfo("NON_UNIQUE",
1294
 
                                                       1,
1295
 
                                                       DRIZZLE_TYPE_LONGLONG,
1296
 
                                                       0,
1297
 
                                                       0,
1298
 
                                                       "Non_unique",
1299
 
                                                       OPEN_FRM_ONLY);
1300
 
  if (uniq == NULL)
1301
 
  {
1302
 
    return true;
1303
 
  }
1304
 
 
1305
 
  const drizzled::plugin::ColumnInfo *idx_sch= new(std::nothrow) drizzled::plugin::ColumnInfo("INDEX_SCHEMA",
1306
 
                                                          NAME_CHAR_LEN,
1307
 
                                                          DRIZZLE_TYPE_VARCHAR,
1308
 
                                                          0,
1309
 
                                                          0,
1310
 
                                                          "",
1311
 
                                                          OPEN_FRM_ONLY);
1312
 
  if (idx_sch == NULL)
1313
 
  {
1314
 
    return true;
1315
 
  }
1316
 
 
1317
 
  const drizzled::plugin::ColumnInfo *idx_name= new(std::nothrow) drizzled::plugin::ColumnInfo("INDEX_NAME",
1318
 
                                                           NAME_CHAR_LEN,
1319
 
                                                           DRIZZLE_TYPE_VARCHAR,
1320
 
                                                           0,
1321
 
                                                           0,
1322
 
                                                           "Key_name",
1323
 
                                                           OPEN_FRM_ONLY);
1324
 
  if (idx_name == NULL)
1325
 
  {
1326
 
    return true;
1327
 
  }
1328
 
 
1329
 
  const drizzled::plugin::ColumnInfo *seq_in_idx= new(std::nothrow) drizzled::plugin::ColumnInfo("SEQ_IN_INDEX",
1330
 
                                                             2,
1331
 
                                                             DRIZZLE_TYPE_LONGLONG,
1332
 
                                                             0,
1333
 
                                                             0,
1334
 
                                                             "Seq_in_index",
1335
 
                                                             OPEN_FRM_ONLY);
1336
 
  if (seq_in_idx == NULL)
1337
 
  {
1338
 
    return true;
1339
 
  }
1340
 
 
1341
 
  const drizzled::plugin::ColumnInfo *col_name= new(std::nothrow) drizzled::plugin::ColumnInfo("COLUMN_NAME",
1342
 
                                                           NAME_CHAR_LEN,
1343
 
                                                           DRIZZLE_TYPE_VARCHAR,
1344
 
                                                           0,
1345
 
                                                           0,
1346
 
                                                           "Column_name",
1347
 
                                                           OPEN_FRM_ONLY);
1348
 
  if (col_name == NULL)
1349
 
  {
1350
 
    return true;
1351
 
  }
1352
 
 
1353
 
  const drizzled::plugin::ColumnInfo *coll= new(std::nothrow) drizzled::plugin::ColumnInfo("COLLATION",
1354
 
                                                       1,
1355
 
                                                       DRIZZLE_TYPE_VARCHAR,
1356
 
                                                       0,
1357
 
                                                       1,
1358
 
                                                       "Collation",
1359
 
                                                       OPEN_FRM_ONLY);
1360
 
  if (coll == NULL)
1361
 
  {
1362
 
    return true;
1363
 
  }
1364
 
 
1365
 
  const drizzled::plugin::ColumnInfo *card= new(std::nothrow) drizzled::plugin::ColumnInfo("CARDINALITY",
1366
 
                                                       MY_INT64_NUM_DECIMAL_DIGITS,
1367
 
                                                       DRIZZLE_TYPE_LONGLONG,
1368
 
                                                       0,
1369
 
                                                       1,
1370
 
                                                       "Cardinality",
1371
 
                                                       OPEN_FULL_TABLE);
1372
 
  if (card == NULL)
1373
 
  {
1374
 
    return true;
1375
 
  }
1376
 
 
1377
 
  const drizzled::plugin::ColumnInfo *sub_part= new(std::nothrow) drizzled::plugin::ColumnInfo("SUB_PART",
1378
 
                                                           3,
1379
 
                                                           DRIZZLE_TYPE_LONGLONG,
1380
 
                                                           0,
1381
 
                                                           1,
1382
 
                                                           "Sub_part",
1383
 
                                                           OPEN_FRM_ONLY);
1384
 
  if (sub_part == NULL)
1385
 
  {
1386
 
    return true;
1387
 
  }
1388
 
 
1389
 
  const drizzled::plugin::ColumnInfo *packed= new(std::nothrow) drizzled::plugin::ColumnInfo("PACKED",
1390
 
                                                         10,
1391
 
                                                         DRIZZLE_TYPE_VARCHAR,
1392
 
                                                         0,
1393
 
                                                         1,
1394
 
                                                         "Packed",
1395
 
                                                         OPEN_FRM_ONLY);
1396
 
  if (packed == NULL)
1397
 
  {
1398
 
    return true;
1399
 
  }
1400
 
 
1401
 
  const drizzled::plugin::ColumnInfo *nullable= new(std::nothrow) drizzled::plugin::ColumnInfo("NULLABLE",
1402
 
                                                           3,
1403
 
                                                           DRIZZLE_TYPE_VARCHAR,
1404
 
                                                           0,
1405
 
                                                           0,
1406
 
                                                           "Null",
1407
 
                                                           OPEN_FRM_ONLY);
1408
 
  if (nullable == NULL)
1409
 
  {
1410
 
    return true;
1411
 
  }
1412
 
 
1413
 
  const drizzled::plugin::ColumnInfo *idx_type= new(std::nothrow) drizzled::plugin::ColumnInfo("INDEX_TYPE",
1414
 
                                                           16,
1415
 
                                                           DRIZZLE_TYPE_VARCHAR,
1416
 
                                                           0,
1417
 
                                                           0,
1418
 
                                                           "Index_type",
1419
 
                                                           OPEN_FULL_TABLE);
1420
 
  if (idx_type == NULL)
1421
 
  {
1422
 
    return true;
1423
 
  }
1424
 
 
1425
 
  const drizzled::plugin::ColumnInfo *comment= new(std::nothrow) drizzled::plugin::ColumnInfo("COMMENT",
1426
 
                                                          16,
1427
 
                                                          DRIZZLE_TYPE_VARCHAR,
1428
 
                                                          0,
1429
 
                                                          1,
1430
 
                                                          "Comment",
1431
 
                                                          OPEN_FRM_ONLY);
1432
 
  if (comment == NULL)
1433
 
  {
1434
 
    return true;
1435
 
  }
1436
 
 
1437
 
  const drizzled::plugin::ColumnInfo *idx_comment= new(std::nothrow) drizzled::plugin::ColumnInfo("INDEX_COMMENT",
1438
 
                                                              INDEX_COMMENT_MAXLEN,
1439
 
                                                              DRIZZLE_TYPE_VARCHAR,
1440
 
                                                              0,
1441
 
                                                              0,
1442
 
                                                              "Index_Comment",
1443
 
                                                              OPEN_FRM_ONLY);
1444
 
  if (idx_comment == NULL)
1445
 
  {
1446
 
    return true;
1447
 
  }
1448
 
 
1449
 
  cols.push_back(cat);
1450
 
  cols.push_back(sch);
1451
 
  cols.push_back(name);
1452
 
  cols.push_back(uniq);
1453
 
  cols.push_back(idx_sch);
1454
 
  cols.push_back(idx_name);
1455
 
  cols.push_back(seq_in_idx);
1456
 
  cols.push_back(col_name);
1457
 
  cols.push_back(coll);
1458
 
  cols.push_back(card);
1459
 
  cols.push_back(sub_part);
1460
 
  cols.push_back(packed);
1461
 
  cols.push_back(nullable);
1462
 
  cols.push_back(idx_type);
1463
 
  cols.push_back(comment);
1464
 
  cols.push_back(idx_comment);
1465
 
 
1466
 
  return false;
1467
 
}
1468
 
 
1469
 
bool createStatusColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1470
 
{
1471
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("VARIABLE_NAME",
1472
 
                                                       64,
1473
 
                                                       DRIZZLE_TYPE_VARCHAR,
1474
 
                                                       0,
1475
 
                                                       0,
1476
 
                                                       "Variable_name",
1477
 
                                                       SKIP_OPEN_TABLE);
1478
 
  if (name == NULL)
1479
 
  {
1480
 
    return true;
1481
 
  }
1482
 
 
1483
 
  const drizzled::plugin::ColumnInfo *value= new(std::nothrow) drizzled::plugin::ColumnInfo("VARIABLE_VALUE",
1484
 
                                                        16300,
1485
 
                                                        DRIZZLE_TYPE_VARCHAR,
1486
 
                                                        0,
1487
 
                                                        1,
1488
 
                                                        "Value",
1489
 
                                                        SKIP_OPEN_TABLE);
1490
 
  if (value == NULL)
1491
 
  {
1492
 
    return true;
1493
 
  }
1494
 
 
1495
 
  cols.push_back(name);
1496
 
  cols.push_back(value);
1497
 
 
1498
 
  return false;
1499
 
}
1500
 
 
1501
 
bool createTabConstraintsColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1502
 
{
1503
 
  const drizzled::plugin::ColumnInfo *cat= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_CATALOG",
1504
 
                                                      FN_REFLEN,
1505
 
                                                      DRIZZLE_TYPE_VARCHAR,
1506
 
                                                      0,
1507
 
                                                      1,
1508
 
                                                      "",
1509
 
                                                      OPEN_FULL_TABLE);
1510
 
  if (cat == NULL)
1511
 
  {
1512
 
    return true;
1513
 
  }
1514
 
 
1515
 
  const drizzled::plugin::ColumnInfo *sch= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_SCHEMA",
1516
 
                                                      NAME_CHAR_LEN,
1517
 
                                                      DRIZZLE_TYPE_VARCHAR,
1518
 
                                                      0,
1519
 
                                                      0,
1520
 
                                                      "",
1521
 
                                                      OPEN_FULL_TABLE);
1522
 
  if (sch == NULL)
1523
 
  {
1524
 
    return true;
1525
 
  }
1526
 
 
1527
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_NAME",
1528
 
                                                       NAME_CHAR_LEN,
1529
 
                                                       DRIZZLE_TYPE_VARCHAR,
1530
 
                                                       0,
1531
 
                                                       0,
1532
 
                                                       "",
1533
 
                                                       OPEN_FULL_TABLE);
1534
 
  if (name == NULL)
1535
 
  {
1536
 
    return true;
1537
 
  }
1538
 
 
1539
 
  const drizzled::plugin::ColumnInfo *tab_sch= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_SCHEMA",
1540
 
                                                          NAME_CHAR_LEN,
1541
 
                                                          DRIZZLE_TYPE_VARCHAR,
1542
 
                                                          0,
1543
 
                                                          0,
1544
 
                                                          "",
1545
 
                                                          OPEN_FULL_TABLE);
1546
 
  if (tab_sch == NULL)
1547
 
  {
1548
 
    return true;
1549
 
  }
1550
 
 
1551
 
  const drizzled::plugin::ColumnInfo *tab_name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
1552
 
                                                           NAME_CHAR_LEN,
1553
 
                                                           DRIZZLE_TYPE_VARCHAR,
1554
 
                                                           0,
1555
 
                                                           0,
1556
 
                                                           "",
1557
 
                                                           OPEN_FULL_TABLE);
1558
 
  if (tab_name == NULL)
1559
 
  {
1560
 
    return true;
1561
 
  }
1562
 
 
1563
 
  const drizzled::plugin::ColumnInfo *type= new(std::nothrow) drizzled::plugin::ColumnInfo("CONSTRAINT_TYPE",
1564
 
                                                       NAME_CHAR_LEN,
1565
 
                                                       DRIZZLE_TYPE_VARCHAR,
1566
 
                                                       0,
1567
 
                                                       0,
1568
 
                                                       "",
1569
 
                                                       OPEN_FULL_TABLE);
1570
 
  if (type == NULL)
1571
 
  {
1572
 
    return true;
1573
 
  }
1574
 
 
1575
 
  cols.push_back(cat);
1576
 
  cols.push_back(sch);
1577
 
  cols.push_back(name);
1578
 
  cols.push_back(tab_sch);
1579
 
  cols.push_back(tab_name);
1580
 
  cols.push_back(type);
1581
 
 
1582
 
  return false;
1583
 
}
1584
 
 
1585
 
bool createTablesColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1586
 
{
1587
 
  const drizzled::plugin::ColumnInfo *cat= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_CATALOG",
1588
 
                                                      FN_REFLEN,
1589
 
                                                      DRIZZLE_TYPE_VARCHAR,
1590
 
                                                      0,
1591
 
                                                      1,
1592
 
                                                      "",
1593
 
                                                      SKIP_OPEN_TABLE);
1594
 
  if (cat == NULL)
1595
 
  {
1596
 
    return true;
1597
 
  }
1598
 
 
1599
 
  const drizzled::plugin::ColumnInfo *sch= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_SCHEMA",
1600
 
                                                      NAME_CHAR_LEN,
1601
 
                                                      DRIZZLE_TYPE_VARCHAR,
1602
 
                                                      0,
1603
 
                                                      0,
1604
 
                                                      "",
1605
 
                                                      SKIP_OPEN_TABLE);
1606
 
  if (sch == NULL)
1607
 
  {
1608
 
    return true;
1609
 
  }
1610
 
 
1611
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
1612
 
                                                       NAME_CHAR_LEN,
1613
 
                                                       DRIZZLE_TYPE_VARCHAR,
1614
 
                                                       0,
1615
 
                                                       0,
1616
 
                                                       "Name",
1617
 
                                                       SKIP_OPEN_TABLE);
1618
 
  if (name == NULL)
1619
 
  {
1620
 
    return true;
1621
 
  }
1622
 
 
1623
 
  const drizzled::plugin::ColumnInfo *type= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_TYPE",
1624
 
                                                       NAME_CHAR_LEN,
1625
 
                                                       DRIZZLE_TYPE_VARCHAR,
1626
 
                                                       0,
1627
 
                                                       0,
1628
 
                                                       "",
1629
 
                                                       OPEN_FRM_ONLY);
1630
 
  if (type == NULL)
1631
 
  {
1632
 
    return true;
1633
 
  }
1634
 
 
1635
 
  const drizzled::plugin::ColumnInfo *engine= new(std::nothrow) drizzled::plugin::ColumnInfo("ENGINE",
1636
 
                                                         NAME_CHAR_LEN,
1637
 
                                                         DRIZZLE_TYPE_VARCHAR,
1638
 
                                                         0,
1639
 
                                                         1,
1640
 
                                                         "Engine",
1641
 
                                                         OPEN_FRM_ONLY);
1642
 
  if (engine == NULL)
1643
 
  {
1644
 
    return true;
1645
 
  }
1646
 
 
1647
 
  const drizzled::plugin::ColumnInfo *version= new(std::nothrow) drizzled::plugin::ColumnInfo("VERSION",
1648
 
                                                          MY_INT64_NUM_DECIMAL_DIGITS,
1649
 
                                                          DRIZZLE_TYPE_LONGLONG,
1650
 
                                                          0,
1651
 
                                                          (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1652
 
                                                          "Version",
1653
 
                                                          OPEN_FRM_ONLY);
1654
 
  if (version == NULL)
1655
 
  {
1656
 
    return true;
1657
 
  }
1658
 
 
1659
 
  const drizzled::plugin::ColumnInfo *row_format= new(std::nothrow) drizzled::plugin::ColumnInfo("ROW_FORMAT",
1660
 
                                                             10,
1661
 
                                                             DRIZZLE_TYPE_VARCHAR,
1662
 
                                                             0,
1663
 
                                                             1,
1664
 
                                                             "Row_format",
1665
 
                                                             OPEN_FULL_TABLE);
1666
 
  if (row_format == NULL)
1667
 
  {
1668
 
    return true;
1669
 
  }
1670
 
 
1671
 
  const drizzled::plugin::ColumnInfo *tab_rows= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_ROWS",
1672
 
                                                           MY_INT64_NUM_DECIMAL_DIGITS,
1673
 
                                                           DRIZZLE_TYPE_LONGLONG,
1674
 
                                                           0,
1675
 
                                                           (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1676
 
                                                           "Rows",
1677
 
                                                           OPEN_FULL_TABLE);
1678
 
  if (tab_rows == NULL)
1679
 
  {
1680
 
    return true;
1681
 
  }
1682
 
 
1683
 
  const drizzled::plugin::ColumnInfo *avg_row_len= new(std::nothrow) drizzled::plugin::ColumnInfo("AVG_ROW_LENGTH",
1684
 
                                                              MY_INT64_NUM_DECIMAL_DIGITS,
1685
 
                                                              DRIZZLE_TYPE_LONGLONG,
1686
 
                                                              0,
1687
 
                                                              (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1688
 
                                                              "Avg_row_length",
1689
 
                                                              OPEN_FULL_TABLE);
1690
 
  if (avg_row_len == NULL)
1691
 
  {
1692
 
    return true;
1693
 
  }
1694
 
 
1695
 
  const drizzled::plugin::ColumnInfo *data_len= new(std::nothrow) drizzled::plugin::ColumnInfo("DATA_LENGTH",
1696
 
                                                           MY_INT64_NUM_DECIMAL_DIGITS,
1697
 
                                                           DRIZZLE_TYPE_LONGLONG,
1698
 
                                                           0,
1699
 
                                                           (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1700
 
                                                           "Data_length",
1701
 
                                                           OPEN_FULL_TABLE);
1702
 
  if (data_len == NULL)
1703
 
  {
1704
 
    return true;
1705
 
  }
1706
 
 
1707
 
  const drizzled::plugin::ColumnInfo *max_data_len= new(std::nothrow) drizzled::plugin::ColumnInfo("MAX_DATA_LENGTH",
1708
 
                                                               MY_INT64_NUM_DECIMAL_DIGITS,
1709
 
                                                               DRIZZLE_TYPE_LONGLONG,
1710
 
                                                               0,
1711
 
                                                               (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1712
 
                                                               "Max_data_length",
1713
 
                                                               OPEN_FULL_TABLE);
1714
 
  if (max_data_len == NULL)
1715
 
  {
1716
 
    return true;
1717
 
  }
1718
 
 
1719
 
  const drizzled::plugin::ColumnInfo *idx_len= new(std::nothrow) drizzled::plugin::ColumnInfo("INDEX_LENGTH",
1720
 
                                                          MY_INT64_NUM_DECIMAL_DIGITS,
1721
 
                                                          DRIZZLE_TYPE_LONGLONG,
1722
 
                                                          0,
1723
 
                                                          (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1724
 
                                                          "Index_length",
1725
 
                                                          OPEN_FULL_TABLE);
1726
 
  if (idx_len == NULL)
1727
 
  {
1728
 
    return true;
1729
 
  }
1730
 
 
1731
 
  const drizzled::plugin::ColumnInfo *data_free= new(std::nothrow) drizzled::plugin::ColumnInfo("DATA_FREE",
1732
 
                                                           MY_INT64_NUM_DECIMAL_DIGITS,
1733
 
                                                           DRIZZLE_TYPE_LONGLONG,
1734
 
                                                           0,
1735
 
                                                           (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1736
 
                                                           "Data_free",
1737
 
                                                           OPEN_FULL_TABLE);
1738
 
  if (data_free == NULL)
1739
 
  {
1740
 
    return true;
1741
 
  }
1742
 
 
1743
 
  const drizzled::plugin::ColumnInfo *auto_inc= new(std::nothrow) drizzled::plugin::ColumnInfo("AUTO_INCREMENT",
1744
 
                                                           MY_INT64_NUM_DECIMAL_DIGITS,
1745
 
                                                           DRIZZLE_TYPE_LONGLONG,
1746
 
                                                           0,
1747
 
                                                           (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1748
 
                                                           "Auto_increment",
1749
 
                                                           OPEN_FULL_TABLE);
1750
 
  if (auto_inc == NULL)
1751
 
  {
1752
 
    return true;
1753
 
  }
1754
 
 
1755
 
  const drizzled::plugin::ColumnInfo *create_time= new(std::nothrow) drizzled::plugin::ColumnInfo("CREATE_TIME",
1756
 
                                                              0,
1757
 
                                                              DRIZZLE_TYPE_DATETIME,
1758
 
                                                              0,
1759
 
                                                              1,
1760
 
                                                              "Create_time",
1761
 
                                                              OPEN_FULL_TABLE);
1762
 
  if (create_time == NULL)
1763
 
  {
1764
 
    return true;
1765
 
  }
1766
 
 
1767
 
  const drizzled::plugin::ColumnInfo *update_time= new(std::nothrow) drizzled::plugin::ColumnInfo("UPDATE_TIME",
1768
 
                                                              0,
1769
 
                                                              DRIZZLE_TYPE_DATETIME,
1770
 
                                                              0,
1771
 
                                                              1,
1772
 
                                                              "Update_time",
1773
 
                                                              OPEN_FULL_TABLE);
1774
 
  if (update_time == NULL)
1775
 
  {
1776
 
    return true;
1777
 
  }
1778
 
 
1779
 
  const drizzled::plugin::ColumnInfo *check_time= new(std::nothrow) drizzled::plugin::ColumnInfo("CHECK_TIME",
1780
 
                                                             0,
1781
 
                                                             DRIZZLE_TYPE_DATETIME,
1782
 
                                                             0,
1783
 
                                                             1,
1784
 
                                                             "Check_time",
1785
 
                                                             OPEN_FULL_TABLE);
1786
 
  if (check_time == NULL)
1787
 
  {
1788
 
    return true;
1789
 
  }
1790
 
 
1791
 
  const drizzled::plugin::ColumnInfo *table_coll= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_COLLATION",
1792
 
                                                             64,
1793
 
                                                             DRIZZLE_TYPE_VARCHAR,
1794
 
                                                             0,
1795
 
                                                             1,
1796
 
                                                             "Collation",
1797
 
                                                             OPEN_FRM_ONLY);
1798
 
  if (table_coll == NULL)
1799
 
  {
1800
 
    return true;
1801
 
  }
1802
 
 
1803
 
  const drizzled::plugin::ColumnInfo *checksum= new(std::nothrow) drizzled::plugin::ColumnInfo("CHECKSUM",
1804
 
                                                           MY_INT64_NUM_DECIMAL_DIGITS,
1805
 
                                                           DRIZZLE_TYPE_LONGLONG,
1806
 
                                                           0,
1807
 
                                                           (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED),
1808
 
                                                           "Checksum",
1809
 
                                                           OPEN_FULL_TABLE);
1810
 
  if (checksum == NULL)
1811
 
  {
1812
 
    return true;
1813
 
  }
1814
 
 
1815
 
  const drizzled::plugin::ColumnInfo *create_opt= new(std::nothrow) drizzled::plugin::ColumnInfo("CREATE_OPTIONS",
1816
 
                                                             255,
1817
 
                                                             DRIZZLE_TYPE_VARCHAR,
1818
 
                                                             0,
1819
 
                                                             1,
1820
 
                                                             "Create_options",
1821
 
                                                             OPEN_FRM_ONLY);
1822
 
  if (create_opt == NULL)
1823
 
  {
1824
 
    return true;
1825
 
  }
1826
 
 
1827
 
  const drizzled::plugin::ColumnInfo *tab_comment= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_COMMENT",
1828
 
                                                              TABLE_COMMENT_MAXLEN,
1829
 
                                                              DRIZZLE_TYPE_VARCHAR,
1830
 
                                                              0,
1831
 
                                                              0,
1832
 
                                                              "Comment",
1833
 
                                                              OPEN_FRM_ONLY);
1834
 
  if (tab_comment == NULL)
1835
 
  {
1836
 
    return true;
1837
 
  }
1838
 
 
1839
 
  cols.push_back(cat);
1840
 
  cols.push_back(sch);
1841
 
  cols.push_back(name);
1842
 
  cols.push_back(type);
1843
 
  cols.push_back(engine);
1844
 
  cols.push_back(version);
1845
 
  cols.push_back(row_format);
1846
 
  cols.push_back(tab_rows);
1847
 
  cols.push_back(avg_row_len);
1848
 
  cols.push_back(data_len);
1849
 
  cols.push_back(max_data_len);
1850
 
  cols.push_back(idx_len);
1851
 
  cols.push_back(data_free);
1852
 
  cols.push_back(auto_inc);
1853
 
  cols.push_back(create_time);
1854
 
  cols.push_back(update_time);
1855
 
  cols.push_back(check_time);
1856
 
  cols.push_back(table_coll);
1857
 
  cols.push_back(checksum);
1858
 
  cols.push_back(create_opt);
1859
 
  cols.push_back(tab_comment);
1860
 
 
1861
 
  return false;
1862
 
}
1863
 
 
1864
 
 
1865
 
bool createTabNamesColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1866
 
{
1867
 
  const drizzled::plugin::ColumnInfo *cat= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_CATALOG",
1868
 
                                                      FN_REFLEN,
1869
 
                                                      DRIZZLE_TYPE_VARCHAR,
1870
 
                                                      0,
1871
 
                                                      1,
1872
 
                                                      "",
1873
 
                                                      SKIP_OPEN_TABLE);
1874
 
  if (cat == NULL)
1875
 
  {
1876
 
    return true;
1877
 
  }
1878
 
 
1879
 
  const drizzled::plugin::ColumnInfo *sch= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_SCHEMA",
1880
 
                                                      NAME_CHAR_LEN,
1881
 
                                                      DRIZZLE_TYPE_VARCHAR,
1882
 
                                                      0,
1883
 
                                                      0,
1884
 
                                                      "",
1885
 
                                                      SKIP_OPEN_TABLE);
1886
 
  if (sch == NULL)
1887
 
  {
1888
 
    return true;
1889
 
  }
1890
 
 
1891
 
  const drizzled::plugin::ColumnInfo *name= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_NAME",
1892
 
                                                       NAME_CHAR_LEN,
1893
 
                                                       DRIZZLE_TYPE_VARCHAR,
1894
 
                                                       0,
1895
 
                                                       0,
1896
 
                                                       "Tables_in_",
1897
 
                                                       SKIP_OPEN_TABLE);
1898
 
  if (name == NULL)
1899
 
  {
1900
 
    return true;
1901
 
  }
1902
 
 
1903
 
  const drizzled::plugin::ColumnInfo *type= new(std::nothrow) drizzled::plugin::ColumnInfo("TABLE_TYPE",
1904
 
                                                       NAME_CHAR_LEN,
1905
 
                                                       DRIZZLE_TYPE_VARCHAR,
1906
 
                                                       0,
1907
 
                                                       0,
1908
 
                                                       "Table_type",
1909
 
                                                       OPEN_FRM_ONLY);
1910
 
  if (type == NULL)
1911
 
  {
1912
 
    return true;
1913
 
  }
1914
 
 
1915
 
  cols.push_back(cat);
1916
 
  cols.push_back(sch);
1917
 
  cols.push_back(name);
1918
 
  cols.push_back(type);
1919
 
 
1920
 
  return false;
1921
 
}
1922
 
 
1923
 
/*
1924
 
 * Function object used for deleting the memory allocated
1925
 
 * for the columns contained with the vector of columns.
1926
 
 */
1927
 
class DeleteColumns
1928
 
{
1929
 
public:
1930
 
  template<typename T>
1931
 
  inline void operator()(const T *ptr) const
1932
 
  {
1933
 
    delete ptr;
1934
 
  }
1935
 
};
1936
 
 
1937
 
void clearColumns(vector<const drizzled::plugin::ColumnInfo *>& cols)
1938
 
{
1939
 
  for_each(cols.begin(), cols.end(), DeleteColumns());
1940
 
  cols.clear();
1941
 
}