17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_PLUGIN_FUNCTION_H
21
#define DRIZZLED_PLUGIN_FUNCTION_H
24
#include "drizzled/plugin/plugin.h"
25
#include "drizzled/item/func.h"
20
#ifndef DRIZZLED_FUNCTION_CREATE_H
21
#define DRIZZLED_FUNCTION_CREATE_H
24
#include <drizzled/item.h>
25
#include <drizzled/sql_list.h>
26
#include <drizzled/item/bin_string.h>
29
29
#include <functional>
45
* Functions in the server: AKA UDF
49
public std::unary_function<memory::Root*, Item_func *>
52
Function(const Function &);
53
Function& operator=(const Function &);
31
class Function_builder
32
: public std::unary_function<MEM_ROOT*, Item_func *>
55
Function(std::string in_name)
56
: Plugin(in_name, "Function"),
57
std::unary_function<memory::Root*, Item_func *>()
59
virtual result_type operator()(argument_type root) const= 0;
60
virtual ~Function() {}
63
* Add a new Function factory to the list of factories we manage.
65
static bool addPlugin(const plugin::Function *function_obj);
68
* Remove a Function factory from the list of factory we manage.
70
static void removePlugin(const plugin::Function *function_obj);
73
* Accept a new connection (Protocol object) on one of the configured
74
* listener interfaces.
76
static const plugin::Function *get(const char *name, size_t len=0);
36
Function_builder(std::string in_name) : name(in_name) {}
37
virtual result_type operator()(argument_type session) const= 0;
38
virtual ~Function_builder() {}
40
std::string get_name() const
47
class Create_function : public Function_builder
85
typedef T FunctionClass;
86
Create_function(std::string in_name)
50
typedef T Function_class;
51
Create_function(std::string in_name): Function_builder(in_name) {}
89
52
virtual result_type operator()(argument_type root) const
91
return new (root) FunctionClass();
54
return new (root) Function_class();
95
} /* namespace plugin */
96
} /* namespace drizzled */
99
#endif /* DRIZZLED_PLUGIN_FUNCTION_H */
60
#endif /* DRIZZLED_FUNCTION_CREATE_H */