22 #include <boost/foreach.hpp>
23 #include <plugin/function_engine/function.h>
24 #include <plugin/function_engine/cursor.h>
30 Function::Function(
const std::string &name_arg) :
32 HTON_ALTER_NOT_SUPPORTED |
33 HTON_HAS_SCHEMA_DICTIONARY |
34 HTON_SKIP_STORE_LOCK |
35 HTON_TEMPORARY_NOT_SUPPORTED),
36 information_message(new message::
Schema),
37 data_dictionary_message(new message::
Schema)
40 information_message->set_name(INFORMATION_SCHEMA_IDENTIFIER.getSchemaName());
41 information_message->set_collation(
"utf8_general_ci");
42 message::set_is_replicated(*information_message,
false);
44 data_dictionary_message->set_name(DATA_DICTIONARY_IDENTIFIER.getSchemaName());
45 data_dictionary_message->set_collation(
"utf8_general_ci");
46 message::set_is_replicated(*data_dictionary_message,
false);
55 int Function::doGetTableDefinition(
Session &,
66 function->define(table_proto);
71 void Function::doGetSchemaIdentifiers(identifier::schema::vector& schemas)
73 schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER);
74 schemas.push_back(DATA_DICTIONARY_IDENTIFIER);
77 drizzled::message::schema::shared_ptr Function::doGetSchemaDefinition(
const identifier::Schema &schema_identifier)
79 drizzled::message::schema::shared_ptr schema_message;
81 if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
83 schema_message= information_message;
85 else if (schema_identifier == DATA_DICTIONARY_IDENTIFIER)
87 schema_message= data_dictionary_message;
91 return drizzled::message::schema::shared_ptr();
94 return schema_message;
99 if (static_cast<const identifier::Schema&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
104 else if (static_cast<const identifier::Schema&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
114 return getFunction(identifier.getPath());
120 drizzled::identifier::table::vector &set_of_identifiers)
122 set<std::string> set_of_names;
123 drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
125 BOOST_FOREACH(
const std::string& iter, set_of_names)
127 set_of_identifiers.push_back(
identifier::Table(schema_identifier, iter, drizzled::message::Table::FUNCTION));
133 context.add(
new Function(
"FunctionEngine"));
138 DRIZZLE_DECLARE_PLUGIN
144 N_(
"Function engine"),
150 DRIZZLE_DECLARE_PLUGIN_END;
TODO: Rename this file - func.h is stupid.