~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.cc

  • Committer: Brian Aker
  • Date: 2010-02-26 19:08:27 UTC
  • mto: (1309.2.7 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1313.
  • Revision ID: brian@gaz-20100226190827-ztb9qoxc9tt43jwc
Cleanup of rm schema;

Show diffs side-by-side

added added

removed removed

Lines of Context:
630
630
{
631
631
  string db;
632
632
  CachedDirectory& directory;
633
 
  set<string>& set_of_names;
 
633
  TableNameList &set_of_names;
634
634
 
635
635
public:
636
636
 
650
650
class AddSchemaNames : 
651
651
  public unary_function<StorageEngine *, void>
652
652
{
653
 
  set<string>& set_of_names;
 
653
  SchemaNameList &set_of_names;
654
654
 
655
655
public:
656
656
 
665
665
  }
666
666
};
667
667
 
668
 
void StorageEngine::getSchemaNames(set<string>& set_of_names)
 
668
void StorageEngine::getSchemaNames(SchemaNameList &set_of_names)
669
669
{
670
670
  // Add hook here for engines to register schema.
671
671
  for_each(vector_of_schema_engines.begin(), vector_of_schema_engines.end(),
841
841
}
842
842
 
843
843
 
844
 
void StorageEngine::getTableNames(const string& db, set<string>& set_of_names)
 
844
void StorageEngine::getTableNames(const string &schema_name, TableNameList &set_of_names)
845
845
{
846
846
  char tmp_path[FN_REFLEN];
847
847
 
848
 
  build_table_filename(tmp_path, sizeof(tmp_path), db.c_str(), "", false);
 
848
  build_table_filename(tmp_path, sizeof(tmp_path), schema_name.c_str(), "", false);
849
849
 
850
850
  CachedDirectory directory(tmp_path, set_of_table_definition_ext);
851
851
 
852
 
  if (not db.compare("information_schema"))
 
852
  if (not schema_name.compare("information_schema"))
853
853
  { }
854
 
  else if (not db.compare("data_dictionary"))
 
854
  else if (not schema_name.compare("data_dictionary"))
855
855
  { }
856
856
  else
857
857
  {
859
859
    {
860
860
      errno= directory.getError();
861
861
      if (errno == ENOENT)
862
 
        my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db.c_str());
 
862
        my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), schema_name.c_str());
863
863
      else
864
864
        my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), directory.getPath(), errno);
865
865
      return;
867
867
  }
868
868
 
869
869
  for_each(vector_of_engines.begin(), vector_of_engines.end(),
870
 
           AddTableName(directory, db, set_of_names));
 
870
           AddTableName(directory, schema_name, set_of_names));
871
871
 
872
872
  Session *session= current_session;
873
873
 
874
 
  session->doGetTableNames(directory, db, set_of_names);
 
874
  session->doGetTableNames(directory, schema_name, set_of_names);
875
875
 
876
876
}
877
877
 
879
879
class DropTables: public unary_function<StorageEngine *, void>
880
880
{
881
881
  Session &session;
882
 
  set<string>& set_of_names;
 
882
  TableNameList &set_of_names;
883
883
 
884
884
public:
885
885
 
891
891
  result_type operator() (argument_type engine)
892
892
  {
893
893
 
894
 
    for (set<string>::iterator iter= set_of_names.begin();
 
894
    for (TableNameList::iterator iter= set_of_names.begin();
895
895
         iter != set_of_names.end();
896
896
         iter++)
897
897
    {