~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-14 02:02:48 UTC
  • mfrom: (1273.13.64 fix_is)
  • Revision ID: brian@gaz-20100214020248-bhovaejhz9fmer3q
MergeĀ inĀ data_dictionary.

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>
911
912
 
912
913
public:
913
914
 
914
 
  AddTableName(CachedDirectory& directory_arg, string& database_name, set<string>& of_names) :
 
915
  AddTableName(CachedDirectory& directory_arg, const string& database_name, set<string>& of_names) :
915
916
    directory(directory_arg),
916
917
    set_of_names(of_names)
917
918
  {
924
925
  }
925
926
};
926
927
 
927
 
void plugin::StorageEngine::getTableNames(string& db, set<string>& set_of_names)
 
928
void plugin::StorageEngine::getSchemaNames(set<string>& set_of_names)
 
929
{
 
930
  CachedDirectory directory(drizzle_data_home, CachedDirectory::DIRECTORY);
 
931
 
 
932
  CachedDirectory::Entries files= directory.getEntries();
 
933
 
 
934
  for (CachedDirectory::Entries::iterator fileIter= files.begin();
 
935
       fileIter != files.end(); fileIter++)
 
936
  {
 
937
    CachedDirectory::Entry *entry= *fileIter;
 
938
    set_of_names.insert(entry->filename);
 
939
  }
 
940
 
 
941
  set_of_names.insert("information_schema"); // special cases suck
 
942
 
 
943
  // Add hook here for engines to register schema.
 
944
#if 0
 
945
  for_each(vector_of_engines.begin(), vector_of_engines.end(),
 
946
           AddTableName(directory, db, set_of_names));
 
947
#endif
 
948
}
 
949
 
 
950
/*
 
951
  Return value is "if parsed"
 
952
*/
 
953
bool plugin::StorageEngine::getSchemaDefinition(const std::string &schema_name, message::Schema &proto)
 
954
{
 
955
  int ret;
 
956
 
 
957
  if (schema_name.compare("information_schema") == 0)
 
958
  {
 
959
    proto.set_name("information_schema");
 
960
    proto.set_collation("utf8_general_ci");
 
961
    ret= 0;
 
962
  }
 
963
  else
 
964
  {
 
965
    ret= get_database_metadata(schema_name.c_str(), proto);
 
966
  }
 
967
 
 
968
  return ret == 0 ? true : false;
 
969
}
 
970
 
 
971
void plugin::StorageEngine::getTableNames(const string& db, set<string>& set_of_names)
928
972
{
929
973
  char tmp_path[FN_REFLEN];
930
974