~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.cc

Updating test cases + added Drizzle specific schema_names and schema_info.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#include "drizzled/sql_table.h"
49
49
#include "drizzled/global_charset_info.h"
50
50
#include "drizzled/internal/my_sys.h"
 
51
#include "drizzled/db.h"
51
52
 
52
53
 
53
54
#include <drizzled/table_proto.h>
914
915
  }
915
916
};
916
917
 
 
918
void plugin::StorageEngine::getSchemaNames(set<string>& set_of_names)
 
919
{
 
920
  CachedDirectory directory(drizzle_data_home, CachedDirectory::DIRECTORY);
 
921
 
 
922
  CachedDirectory::Entries files= directory.getEntries();
 
923
 
 
924
  for (CachedDirectory::Entries::iterator fileIter= files.begin();
 
925
       fileIter != files.end(); fileIter++)
 
926
  {
 
927
    CachedDirectory::Entry *entry= *fileIter;
 
928
    set_of_names.insert(entry->filename);
 
929
  }
 
930
 
 
931
  set_of_names.insert("information_schema"); // special cases suck
 
932
 
 
933
  // Add hook here for engines to register schema.
 
934
#if 0
 
935
  for_each(vector_of_engines.begin(), vector_of_engines.end(),
 
936
           AddTableName(directory, db, set_of_names));
 
937
#endif
 
938
}
 
939
 
 
940
/*
 
941
  Return value is "if parsed"
 
942
*/
 
943
bool plugin::StorageEngine::getSchemaDefinition(std::string &schema_name, message::Schema &proto)
 
944
{
 
945
  int ret;
 
946
 
 
947
  if (schema_name.compare("information_schema") == 0)
 
948
  {
 
949
    proto.set_name("information_schema");
 
950
    proto.set_collation("utf8_general_ci");
 
951
    ret= 0;
 
952
  }
 
953
  else
 
954
  {
 
955
    ret= get_database_metadata(schema_name.c_str(), &proto);
 
956
  }
 
957
 
 
958
  return ret == 0 ? false : true;
 
959
}
 
960
 
917
961
void plugin::StorageEngine::getTableNames(string& db, set<string>& set_of_names)
918
962
{
919
963
  char tmp_path[FN_REFLEN];