~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/function_engine/function.cc

  • Committer: Brian Aker
  • Date: 2010-03-31 05:53:34 UTC
  • Revision ID: brian@gaz-20100331055334-yqqmzlgqb2xq1p5b
Mass overhaul to use schema_identifier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
using namespace std;
29
29
using namespace drizzled;
30
30
 
 
31
static SchemaIdentifier INFORMATION_SCHEMA_IDENTIFIER("INFORMATION_SCHEMA");
 
32
static SchemaIdentifier DATA_DICTIONARY_IDENTIFIER("DATA_DICTIONARY");
 
33
 
31
34
Function::Function(const std::string &name_arg) :
32
35
  drizzled::plugin::StorageEngine(name_arg,
33
36
                                  HTON_ALTER_NOT_SUPPORTED |
65
68
 
66
69
 
67
70
void Function::doGetTableNames(drizzled::CachedDirectory&, 
68
 
                               string &db, 
 
71
                               drizzled::SchemaIdentifier &schema_identifier,
69
72
                               set<string> &set_of_names)
70
73
{
71
 
  drizzled::plugin::TableFunction::getNames(db, set_of_names);
72
 
}
73
 
 
74
 
void Function::doGetSchemaNames(std::set<std::string>& set_of_names)
75
 
{
76
 
  set_of_names.insert("information_schema"); // special cases suck
77
 
  set_of_names.insert("data_dictionary"); // special cases suck
78
 
}
79
 
 
80
 
bool Function::doGetSchemaDefinition(const std::string &schema_name, message::Schema &schema_message)
81
 
{
82
 
  if (not schema_name.compare("information_schema"))
 
74
  drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
 
75
}
 
76
 
 
77
void Function::doGetSchemaIdentifiers(SchemaIdentifierList& schemas)
 
78
{
 
79
  schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER);
 
80
  schemas.push_back(DATA_DICTIONARY_IDENTIFIER);
 
81
}
 
82
 
 
83
bool Function::doGetSchemaDefinition(SchemaIdentifier &schema_identifier, message::Schema &schema_message)
 
84
{
 
85
  if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
83
86
  {
84
87
    schema_message.set_name("information_schema");
85
88
    schema_message.set_collation("utf8_general_ci");
86
89
  }
87
 
  else if (not schema_name.compare("data_dictionary"))
 
90
  else if (schema_identifier == DATA_DICTIONARY_IDENTIFIER)
88
91
  {
89
92
    schema_message.set_name("data_dictionary");
90
93
    schema_message.set_collation("utf8_general_ci");
97
100
  return true;
98
101
}
99
102
 
100
 
bool Function::doCanCreateTable(const drizzled::TableIdentifier &identifier)
 
103
bool Function::doCanCreateTable(drizzled::TableIdentifier &table_identifier)
101
104
{
102
 
  if (not strcasecmp(identifier.getSchemaName().c_str(), "information_schema"))
 
105
  if (static_cast<SchemaIdentifier&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
103
106
  {
104
107
    return false;
105
108
  }
106
109
 
107
 
  if (not strcasecmp(identifier.getSchemaName().c_str(), "data_dictionary"))
 
110
  else if (static_cast<SchemaIdentifier&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
108
111
  {
109
112
    return false;
110
113
  }