~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/function_engine/function.cc

  • Committer: Lee Bieber
  • Date: 2010-12-23 23:11:00 UTC
  • mfrom: (2024.1.1 clean)
  • Revision ID: kalebral@gmail.com-20101223231100-0rqirgz7ugkl10yp
Merge Brian - session list cleanup

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 |
38
41
  data_dictionary_message(new(message::Schema))
39
42
 
40
43
{
41
 
  information_message->set_name(INFORMATION_SCHEMA_IDENTIFIER.getSchemaName());
 
44
  information_message->set_name("information_schema");
42
45
  data_dictionary_message->set_collation("utf8_general_ci");
43
46
 
44
 
  data_dictionary_message->set_name(DATA_DICTIONARY_IDENTIFIER.getSchemaName());
 
47
  data_dictionary_message->set_name("data_dictionary");
45
48
  data_dictionary_message->set_collation("utf8_general_ci");
46
49
}
47
50
 
52
55
}
53
56
 
54
57
int Function::doGetTableDefinition(Session &,
55
 
                                   const identifier::Table &identifier,
 
58
                                   const TableIdentifier &identifier,
56
59
                                   message::Table &table_proto)
57
60
{
58
61
  drizzled::plugin::TableFunction *function= getFunction(identifier.getPath());
67
70
  return EEXIST;
68
71
}
69
72
 
70
 
void Function::doGetSchemaIdentifiers(identifier::Schema::vector& schemas)
 
73
void Function::doGetSchemaIdentifiers(SchemaIdentifier::vector& schemas)
71
74
{
72
75
  schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER);
73
76
  schemas.push_back(DATA_DICTIONARY_IDENTIFIER);
74
77
}
75
78
 
76
 
bool Function::doGetSchemaDefinition(const identifier::Schema &schema_identifier, message::schema::shared_ptr &schema_message)
 
79
bool Function::doGetSchemaDefinition(const SchemaIdentifier &schema_identifier, message::schema::shared_ptr &schema_message)
77
80
{
78
81
  schema_message.reset(new message::Schema); // This should be fixed, we could just be using ones we built on startup.
79
82
 
93
96
  return true;
94
97
}
95
98
 
96
 
bool Function::doCanCreateTable(const drizzled::identifier::Table &table_identifier)
 
99
bool Function::doCanCreateTable(const drizzled::TableIdentifier &table_identifier)
97
100
{
98
 
  if (static_cast<const identifier::Schema&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
 
101
  if (static_cast<const SchemaIdentifier&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
99
102
  {
100
103
    return false;
101
104
  }
102
105
 
103
 
  else if (static_cast<const identifier::Schema&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
 
106
  else if (static_cast<const SchemaIdentifier&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
104
107
  {
105
108
    return false;
106
109
  }
108
111
  return true;
109
112
}
110
113
 
111
 
bool Function::doDoesTableExist(Session&, const identifier::Table &identifier)
 
114
bool Function::doDoesTableExist(Session&, const TableIdentifier &identifier)
112
115
{
113
116
  drizzled::plugin::TableFunction *function= getFunction(identifier.getPath());
114
117
 
120
123
 
121
124
 
122
125
void Function::doGetTableIdentifiers(drizzled::CachedDirectory&,
123
 
                                     const drizzled::identifier::Schema &schema_identifier,
124
 
                                     drizzled::identifier::Table::vector &set_of_identifiers)
 
126
                                     const drizzled::SchemaIdentifier &schema_identifier,
 
127
                                     drizzled::TableIdentifier::vector &set_of_identifiers)
125
128
{
126
129
  set<std::string> set_of_names;
127
130
  drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
128
131
 
129
132
  for (set<std::string>::iterator iter= set_of_names.begin(); iter != set_of_names.end(); iter++)
130
133
  {
131
 
    set_of_identifiers.push_back(identifier::Table(schema_identifier, *iter, drizzled::message::Table::FUNCTION));
 
134
    set_of_identifiers.push_back(TableIdentifier(schema_identifier, *iter, drizzled::message::Table::FUNCTION));
132
135
  }
133
136
}
134
137
 
148
151
  "Function Engine provides the infrastructure for Table Functions,etc.",
149
152
  PLUGIN_LICENSE_GPL,
150
153
  init,     /* Plugin Init */
151
 
  NULL,               /* depends */
 
154
  NULL,               /* system variables */
152
155
  NULL                /* config options   */
153
156
}
154
157
DRIZZLE_DECLARE_PLUGIN_END;