~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.cc

  • Committer: Brian Aker
  • Date: 2010-04-01 16:08:35 UTC
  • mfrom: (1429.1.3 build)
  • Revision ID: brian@gaz-20100401160835-6ow2j5z4f2bhpjl4
Rework to move show commands merge/etc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
535
535
  return create(share, alloc);
536
536
}
537
537
 
538
 
/**
539
 
  TODO -> Remove this to force all engines to implement their own file. Solves the "we only looked at dfe" problem.
540
 
*/
541
 
void StorageEngine::doGetTableNames(CachedDirectory&, SchemaIdentifier&, set<string>&)
542
 
{ }
543
 
 
544
538
class AddTableName : 
545
539
  public unary_function<StorageEngine *, void>
546
540
{
563
557
  }
564
558
};
565
559
 
 
560
class AddTableIdentifier : 
 
561
  public unary_function<StorageEngine *, void>
 
562
{
 
563
  CachedDirectory &directory;
 
564
  SchemaIdentifier &identifier;
 
565
  TableIdentifiers &set_of_identifiers;
 
566
 
 
567
public:
 
568
 
 
569
  AddTableIdentifier(CachedDirectory &directory_arg, SchemaIdentifier &identifier_arg, TableIdentifiers &of_names) :
 
570
    directory(directory_arg),
 
571
    identifier(identifier_arg),
 
572
    set_of_identifiers(of_names)
 
573
  {
 
574
  }
 
575
 
 
576
  result_type operator() (argument_type engine)
 
577
  {
 
578
    engine->doGetTableIdentifiers(directory, identifier, set_of_identifiers);
 
579
  }
 
580
};
 
581
 
566
582
 
567
583
static SchemaIdentifier INFORMATION_SCHEMA_IDENTIFIER("information_schema");
568
584
static SchemaIdentifier DATA_DICTIONARY_IDENTIFIER("data_dictionary");
594
610
  session.doGetTableNames(directory, schema_identifier, set_of_names);
595
611
}
596
612
 
 
613
void StorageEngine::getTableIdentifiers(Session &session, SchemaIdentifier &schema_identifier, TableIdentifiers &set_of_identifiers)
 
614
{
 
615
  CachedDirectory directory(schema_identifier.getPath(), set_of_table_definition_ext);
 
616
 
 
617
  if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
 
618
  { }
 
619
  else if (schema_identifier == DATA_DICTIONARY_IDENTIFIER)
 
620
  { }
 
621
  else
 
622
  {
 
623
    if (directory.fail())
 
624
    {
 
625
      errno= directory.getError();
 
626
      if (errno == ENOENT)
 
627
        my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), schema_identifier.getSQLPath().c_str());
 
628
      else
 
629
        my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), directory.getPath(), errno);
 
630
      return;
 
631
    }
 
632
  }
 
633
 
 
634
  for_each(vector_of_engines.begin(), vector_of_engines.end(),
 
635
           AddTableIdentifier(directory, schema_identifier, set_of_identifiers));
 
636
 
 
637
  session.doGetTableIdentifiers(directory, schema_identifier, set_of_identifiers);
 
638
}
 
639
 
597
640
/* This will later be converted to TableIdentifiers */
598
641
class DropTables: public unary_function<StorageEngine *, void>
599
642
{