~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/info_schema/info_schema.cc

  • Committer: Brian Aker
  • Date: 2009-07-23 00:02:03 UTC
  • mfrom: (1093.1.25 captain)
  • Revision ID: brian@gaz-20090723000203-kkrx4udjiiwy869o
Mege Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
static vector<const ColumnInfo *> ref_constraint_columns;
49
49
static vector<const ColumnInfo *> schemata_columns;
50
50
static vector<const ColumnInfo *> stats_columns;
 
51
static vector<const ColumnInfo *> status_columns;
51
52
static vector<const ColumnInfo *> tab_constraints_columns;
52
53
static vector<const ColumnInfo *> tables_columns;
53
54
static vector<const ColumnInfo *> tab_names_columns;
66
67
static InfoSchemaMethods *ref_constraint_methods= NULL;
67
68
static InfoSchemaMethods *schemata_methods= NULL;
68
69
static InfoSchemaMethods *stats_methods= NULL;
 
70
static InfoSchemaMethods *status_methods= NULL;
69
71
static InfoSchemaMethods *tab_constraints_methods= NULL;
70
72
static InfoSchemaMethods *tables_methods= NULL;
71
73
static InfoSchemaMethods *tab_names_methods= NULL;
 
74
static InfoSchemaMethods *variables_methods= NULL;
72
75
 
73
76
/*
74
77
 * I_S tables.
78
81
static InfoSchemaTable *coll_char_set_table= NULL;
79
82
static InfoSchemaTable *columns_table= NULL;
80
83
static InfoSchemaTable *key_col_usage_table= NULL;
 
84
static InfoSchemaTable *global_stat_table= NULL;
 
85
static InfoSchemaTable *global_var_table= NULL;
81
86
static InfoSchemaTable *open_tab_table= NULL;
82
87
static InfoSchemaTable *plugins_table= NULL;
83
88
static InfoSchemaTable *processlist_table= NULL;
84
89
static InfoSchemaTable *ref_constraint_table= NULL;
85
90
static InfoSchemaTable *schemata_table= NULL;
 
91
static InfoSchemaTable *sess_stat_table= NULL;
 
92
static InfoSchemaTable *sess_var_table= NULL;
86
93
static InfoSchemaTable *stats_table= NULL;
 
94
static InfoSchemaTable *status_table= NULL;
87
95
static InfoSchemaTable *tab_constraints_table= NULL;
88
96
static InfoSchemaTable *tables_table= NULL;
89
97
static InfoSchemaTable *tab_names_table= NULL;
 
98
static InfoSchemaTable *var_table= NULL;
90
99
 
91
100
/**
92
101
 * Populate the vectors of columns for each I_S table.
152
161
    return true;
153
162
  }
154
163
 
 
164
  if ((retval= createStatusColumns(status_columns)) == true)
 
165
  {
 
166
    return true;
 
167
  }
 
168
 
155
169
  if ((retval= createTabConstraintsColumns(tab_constraints_columns)) == true)
156
170
  {
157
171
    return true;
186
200
  clearColumns(ref_constraint_columns);
187
201
  clearColumns(schemata_columns);
188
202
  clearColumns(stats_columns);
 
203
  clearColumns(status_columns);
189
204
  clearColumns(tab_constraints_columns);
190
205
  clearColumns(tables_columns);
191
206
  clearColumns(tab_names_columns);
253
268
    return true;
254
269
  }
255
270
 
 
271
  if ((status_methods= new(std::nothrow) StatusISMethods()) == NULL)
 
272
  {
 
273
    return true;
 
274
  }
 
275
 
256
276
  if ((tab_constraints_methods= new(std::nothrow) TabConstraintsISMethods()) == NULL)
257
277
  {
258
278
    return true;
268
288
    return true;
269
289
  }
270
290
 
 
291
  if ((variables_methods= new(std::nothrow) VariablesISMethods()) == NULL)
 
292
  {
 
293
    return true;
 
294
  }
 
295
 
271
296
  return false;
272
297
}
273
298
 
287
312
  delete ref_constraint_methods;
288
313
  delete schemata_methods;
289
314
  delete stats_methods;
 
315
  delete status_methods;
290
316
  delete tab_constraints_methods;
291
317
  delete tables_methods;
292
318
  delete tab_names_methods;
 
319
  delete variables_methods;
293
320
}
294
321
 
295
322
/**
347
374
    return true;
348
375
  }
349
376
 
 
377
  global_stat_table= new(std::nothrow) InfoSchemaTable("GLOBAL_STATUS",
 
378
                                                       status_columns,
 
379
                                                       -1, -1, false, false,
 
380
                                                       0, status_methods);
 
381
  if (global_stat_table == NULL)
 
382
  {
 
383
    return true;
 
384
  }
 
385
 
 
386
  global_var_table= new(std::nothrow) InfoSchemaTable("GLOBAL_VARIABLES",
 
387
                                                      status_columns,
 
388
                                                      -1, -1, false, false,
 
389
                                                      0, variables_methods);
 
390
  if (global_var_table == NULL)
 
391
  {
 
392
    return true;
 
393
  }
 
394
  
350
395
  open_tab_table= new(std::nothrow) InfoSchemaTable("OPEN_TABLES",
351
396
                                                    open_tab_columns,
352
397
                                                    -1, -1, true, false, 0,
393
438
    return true;
394
439
  }
395
440
 
 
441
  sess_stat_table= new(std::nothrow) InfoSchemaTable("SESSION_STATUS",
 
442
                                                     status_columns,
 
443
                                                     -1, -1, false, false,
 
444
                                                     0, status_methods);
 
445
  if (sess_stat_table == NULL)
 
446
  {
 
447
    return true;
 
448
  }
 
449
 
 
450
  sess_var_table= new(std::nothrow) InfoSchemaTable("SESSION_VARIABLES",
 
451
                                                    status_columns,
 
452
                                                    -1, -1, false, false, 0,
 
453
                                                    variables_methods);
 
454
  if (sess_var_table == NULL)
 
455
  {
 
456
    return true;
 
457
  }
 
458
 
396
459
  stats_table= new(std::nothrow) InfoSchemaTable("STATISTICS",
397
460
                                                 stats_columns,
398
461
                                                 1, 2, false, true,
403
466
    return true;
404
467
  }
405
468
 
 
469
  status_table= new(std::nothrow) InfoSchemaTable("STATUS",
 
470
                                                  status_columns,
 
471
                                                  -1, -1, true, false, 0,
 
472
                                                  status_methods);
 
473
  if (status_table == NULL)
 
474
  {
 
475
    return true;
 
476
  }
 
477
 
406
478
  tab_constraints_table= new(std::nothrow) InfoSchemaTable("TABLE_CONSTRAINTS",
407
479
                                                           tab_constraints_columns,
408
480
                                                           3, 4, false, true,
432
504
    return true;
433
505
  }
434
506
 
 
507
  var_table= new(std::nothrow) InfoSchemaTable("VARIABLES",
 
508
                                               status_columns,
 
509
                                               -1, -1, true, false, 0,
 
510
                                               variables_methods);
 
511
  if (var_table == NULL)
 
512
  {
 
513
    return true;
 
514
  }
 
515
 
435
516
  return false;
436
517
}
437
518
 
445
526
  delete coll_char_set_table;
446
527
  delete columns_table;
447
528
  delete key_col_usage_table;
 
529
  delete global_stat_table;
 
530
  delete global_var_table;
448
531
  delete open_tab_table;
449
532
  delete plugins_table;
450
533
  delete processlist_table;
451
534
  delete ref_constraint_table;
452
535
  delete schemata_table;
 
536
  delete sess_stat_table;
 
537
  delete sess_var_table;
453
538
  delete stats_table;
 
539
  delete status_table;
454
540
  delete tab_constraints_table;
455
541
  delete tables_table;
456
542
  delete tab_names_table;
 
543
  delete var_table;
457
544
}
458
545
 
459
546
/**
486
573
  registry.add(coll_char_set_table);
487
574
  registry.add(columns_table);
488
575
  registry.add(key_col_usage_table);
 
576
  registry.add(global_stat_table);
 
577
  registry.add(global_var_table);
489
578
  registry.add(open_tab_table);
490
579
  registry.add(plugins_table);
491
580
  registry.add(processlist_table);
492
581
  registry.add(ref_constraint_table);
493
582
  registry.add(schemata_table);
 
583
  registry.add(sess_stat_table);
 
584
  registry.add(sess_var_table);
494
585
  registry.add(stats_table);
 
586
  registry.add(status_table);
495
587
  registry.add(tab_constraints_table);
496
588
  registry.add(tables_table);
497
589
  registry.add(tab_names_table);
 
590
  registry.add(var_table);
498
591
 
499
592
  return 0;
500
593
}
512
605
  registry.remove(coll_char_set_table);
513
606
  registry.remove(columns_table);
514
607
  registry.remove(key_col_usage_table);
 
608
  registry.remove(global_stat_table);
 
609
  registry.remove(global_var_table);
515
610
  registry.remove(open_tab_table);
516
611
  registry.remove(plugins_table);
517
612
  registry.remove(processlist_table);
518
613
  registry.remove(ref_constraint_table);
519
614
  registry.remove(schemata_table);
 
615
  registry.remove(sess_stat_table);
 
616
  registry.remove(sess_var_table);
520
617
  registry.remove(stats_table);
 
618
  registry.remove(status_table);
521
619
  registry.remove(tab_constraints_table);
522
620
  registry.remove(tables_table);
523
621
  registry.remove(tab_names_table);
 
622
  registry.remove(var_table);
524
623
 
525
624
  cleanupTableMethods();
526
625
  cleanupTableColumns();