21
21
/* This implements 'user defined functions' */
24
24
#include <boost/unordered_map.hpp>
26
26
#include <drizzled/gettext.h>
27
#include <drizzled/plugin/function.h>
28
#include <drizzled/function_container.h>
30
#include <drizzled/util/string.h>
27
#include "drizzled/plugin/function.h"
29
#include "drizzled/util/string.h"
35
static plugin::Function::UdfMap udf_registry;
37
const plugin::Function::UdfMap &plugin::Function::getMap()
36
typedef boost::unordered_map<string, const plugin::Function *, util::insensitive_hash, util::insensitive_equal_to> UdfMap;
37
static UdfMap udf_registry;
42
39
bool plugin::Function::addPlugin(const plugin::Function *udf)
44
if (FunctionContainer::getMap().find(udf->getName()) != FunctionContainer::getMap().end())
46
errmsg_printf(error::ERROR,
47
_("A function named %s already exists!\n"),
48
udf->getName().c_str());
52
41
if (udf_registry.find(udf->getName()) != udf_registry.end())
54
errmsg_printf(error::ERROR,
43
errmsg_printf(ERRMSG_LVL_ERROR,
55
44
_("A function named %s already exists!\n"),
56
45
udf->getName().c_str());
60
std::pair<UdfMap::iterator, bool> ret=
48
pair<UdfMap::iterator, bool> ret=
61
49
udf_registry.insert(make_pair(udf->getName(), udf));
62
50
if (ret.second == false)
64
errmsg_printf(error::ERROR,
52
errmsg_printf(ERRMSG_LVL_ERROR,
65
53
_("Could not add Function!\n"));