36
36
HTON_ALTER_NOT_SUPPORTED |
37
37
HTON_HAS_SCHEMA_DICTIONARY |
38
38
HTON_SKIP_STORE_LOCK |
39
HTON_TEMPORARY_NOT_SUPPORTED),
40
information_message(new(message::Schema)),
41
data_dictionary_message(new(message::Schema))
39
HTON_TEMPORARY_NOT_SUPPORTED)
44
information_message->set_name("information_schema");
45
data_dictionary_message->set_collation("utf8_general_ci");
47
data_dictionary_message->set_name("data_dictionary");
48
data_dictionary_message->set_collation("utf8_general_ci");
52
Cursor *Function::create(Table &table)
44
Cursor *Function::create(TableShare &table, memory::Root *mem_root)
54
return new FunctionCursor(*this, table);
46
return new (mem_root) FunctionCursor(*this, table);
57
49
int Function::doGetTableDefinition(Session &,
58
const TableIdentifier &identifier,
50
TableIdentifier &identifier,
59
51
message::Table &table_proto)
61
drizzled::plugin::TableFunction *function= getFunction(identifier.getPath());
53
string tab_name(identifier.getPath());
54
transform(tab_name.begin(), tab_name.end(),
55
tab_name.begin(), ::tolower);
57
drizzled::plugin::TableFunction *function= getFunction(tab_name);
73
void Function::doGetSchemaIdentifiers(SchemaIdentifier::vector& schemas)
70
void Function::doGetTableNames(drizzled::CachedDirectory&,
71
drizzled::SchemaIdentifier &schema_identifier,
72
set<string> &set_of_names)
74
drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
77
void Function::doGetSchemaIdentifiers(SchemaIdentifierList& schemas)
75
79
schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER);
76
80
schemas.push_back(DATA_DICTIONARY_IDENTIFIER);
79
bool Function::doGetSchemaDefinition(const SchemaIdentifier &schema_identifier, message::schema::shared_ptr &schema_message)
83
bool Function::doGetSchemaDefinition(SchemaIdentifier &schema_identifier, message::Schema &schema_message)
81
schema_message.reset(new message::Schema); // This should be fixed, we could just be using ones we built on startup.
83
85
if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
85
schema_message= information_message;
87
schema_message.set_name("information_schema");
88
schema_message.set_collation("utf8_general_ci");
87
90
else if (schema_identifier == DATA_DICTIONARY_IDENTIFIER)
89
schema_message= data_dictionary_message;
92
schema_message.set_name("data_dictionary");
93
schema_message.set_collation("utf8_general_ci");
99
bool Function::doCanCreateTable(const drizzled::TableIdentifier &table_identifier)
103
bool Function::doCanCreateTable(drizzled::TableIdentifier &table_identifier)
101
if (static_cast<const SchemaIdentifier&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
105
if (static_cast<SchemaIdentifier&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER)
106
else if (static_cast<const SchemaIdentifier&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
110
else if (static_cast<SchemaIdentifier&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER)
114
bool Function::doDoesTableExist(Session&, const TableIdentifier &identifier)
118
bool Function::doDoesTableExist(Session&, TableIdentifier &identifier)
116
120
drizzled::plugin::TableFunction *function= getFunction(identifier.getPath());
125
129
void Function::doGetTableIdentifiers(drizzled::CachedDirectory&,
126
const drizzled::SchemaIdentifier &schema_identifier,
127
drizzled::TableIdentifier::vector &set_of_identifiers)
130
drizzled::SchemaIdentifier &schema_identifier,
131
drizzled::TableIdentifiers &set_of_identifiers)
129
set<std::string> set_of_names;
133
set<string> set_of_names;
130
134
drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
132
for (set<std::string>::iterator iter= set_of_names.begin(); iter != set_of_names.end(); iter++)
136
for (set<string>::iterator iter= set_of_names.begin(); iter != set_of_names.end(); iter++)
134
set_of_identifiers.push_back(TableIdentifier(schema_identifier, *iter, drizzled::message::Table::FUNCTION));
138
set_of_identifiers.push_back(TableIdentifier(schema_identifier, *iter));
138
static int init(drizzled::module::Context &context)
142
static int init(drizzled::plugin::Context &context)
140
144
context.add(new Function("FunctionEngine"));