1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include <plugin/function_engine/function.h>
24
#include <plugin/function_engine/cursor.h>
29
using namespace drizzled;
31
Function::Function(const std::string &name_arg) :
32
drizzled::plugin::StorageEngine(name_arg,
33
HTON_ALTER_NOT_SUPPORTED |
34
HTON_HAS_DATA_DICTIONARY |
35
HTON_SKIP_STORE_LOCK |
36
HTON_TEMPORARY_NOT_SUPPORTED)
41
Cursor *Function::create(TableShare &table, memory::Root *mem_root)
43
return new (mem_root) FunctionCursor(*this, table);
46
int Function::doGetTableDefinition(Session &,
51
message::Table *table_proto)
53
string tab_name(path);
54
transform(tab_name.begin(), tab_name.end(),
55
tab_name.begin(), ::tolower);
57
drizzled::plugin::TableFunction *function= getFunction(tab_name);
66
function->define(*table_proto);
73
void Function::doGetTableNames(drizzled::CachedDirectory&,
75
set<string> &set_of_names)
77
drizzled::plugin::TableFunction::getNames(db, set_of_names);
81
static drizzled::plugin::StorageEngine *function_plugin= NULL;
83
static int init(drizzled::plugin::Registry ®istry)
85
function_plugin= new(std::nothrow) Function("FunctionEngine");
87
if (not function_plugin)
92
registry.add(function_plugin);
97
static int finalize(drizzled::plugin::Registry ®istry)
99
registry.remove(function_plugin);
100
delete function_plugin;
105
DRIZZLE_DECLARE_PLUGIN
111
"Function Engine provides the infrastructure for Table Functions,etc.",
113
init, /* Plugin Init */
114
finalize, /* Plugin Deinit */
115
NULL, /* status variables */
116
NULL, /* system variables */
117
NULL /* config options */
119
DRIZZLE_DECLARE_PLUGIN_END;