22#include <plugin/function_engine/function.h>
23#include <plugin/function_engine/cursor.h>
29Function::Function(
const std::string &name_arg) :
30 drizzled::plugin::StorageEngine(name_arg,
31 HTON_ALTER_NOT_SUPPORTED |
32 HTON_HAS_SCHEMA_DICTIONARY |
33 HTON_SKIP_STORE_LOCK |
34 HTON_TEMPORARY_NOT_SUPPORTED),
35 information_message(new message::
Schema),
36 data_dictionary_message(new message::
Schema)
39 information_message->set_name(INFORMATION_SCHEMA_IDENTIFIER.getSchemaName());
40 information_message->set_collation(
"utf8_general_ci");
41 message::set_is_replicated(*information_message,
false);
43 data_dictionary_message->set_name(DATA_DICTIONARY_IDENTIFIER.getSchemaName());
44 data_dictionary_message->set_collation(
"utf8_general_ci");
45 message::set_is_replicated(*data_dictionary_message,
false);
51 return new FunctionCursor(*
this, table);
54int Function::doGetTableDefinition(
Session &,
56 message::Table &table_proto)
58 drizzled::plugin::TableFunction *function= getFunction(identifier.getPath());
65 function->define(table_proto);
70void Function::doGetSchemaIdentifiers(identifier::schema::vector& schemas)
72 schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER);
73 schemas.push_back(DATA_DICTIONARY_IDENTIFIER);
76drizzled::message::schema::shared_ptr Function::doGetSchemaDefinition(
const identifier::Schema &schema_identifier)
78 drizzled::message::schema::shared_ptr schema_message;
80 if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
82 schema_message= information_message;
84 else if (schema_identifier == DATA_DICTIONARY_IDENTIFIER)
86 schema_message= data_dictionary_message;
90 return drizzled::message::schema::shared_ptr();
93 return schema_message;
98 if (
static_cast<const identifier::Schema&
>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
103 else if (
static_cast<const identifier::Schema&
>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
113 return getFunction(identifier.getPath());
119 drizzled::identifier::table::vector &set_of_identifiers)
121 set<std::string> set_of_names;
122 drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
124 for (
const std::string& iter : set_of_names)
126 set_of_identifiers.push_back(identifier::Table(schema_identifier, iter, drizzled::message::Table::FUNCTION));
132 context.add(
new Function(
"FunctionEngine"));
137DRIZZLE_DECLARE_PLUGIN
143 N_(
"Function engine"),
149DRIZZLE_DECLARE_PLUGIN_END;
TODO: Rename this file - func.h is stupid.