~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/function.cc

  • Committer: Brian Aker
  • Date: 2011-02-17 10:09:00 UTC
  • mfrom: (2173.2.1 clean-include-usuage)
  • Revision ID: brian@tangent.org-20110217100900-4tpuxxzdl1sj00sh
Merge Monty for headers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
/* This implements 'user defined functions' */
22
 
#include "config.h"
 
22
#include <config.h>
23
23
 
24
24
#include <boost/unordered_map.hpp>
25
25
 
26
26
#include <drizzled/gettext.h>
27
 
#include "drizzled/plugin/function.h"
 
27
#include <drizzled/plugin/function.h>
 
28
#include <drizzled/function_container.h>
28
29
 
29
 
#include "drizzled/util/string.h"
 
30
#include <drizzled/util/string.h>
30
31
 
31
32
namespace drizzled
32
33
{
40
41
 
41
42
bool plugin::Function::addPlugin(const plugin::Function *udf)
42
43
{
 
44
  if (FunctionContainer::getMap().find(udf->getName()) != FunctionContainer::getMap().end())
 
45
  {
 
46
    errmsg_printf(error::ERROR,
 
47
                  _("A function named %s already exists!\n"),
 
48
                  udf->getName().c_str());
 
49
    return true;
 
50
  }
 
51
 
43
52
  if (udf_registry.find(udf->getName()) != udf_registry.end())
44
53
  {
45
 
    errmsg_printf(ERRMSG_LVL_ERROR,
 
54
    errmsg_printf(error::ERROR,
46
55
                  _("A function named %s already exists!\n"),
47
56
                  udf->getName().c_str());
48
57
    return true;
49
58
  }
 
59
 
50
60
  std::pair<UdfMap::iterator, bool> ret=
51
61
    udf_registry.insert(make_pair(udf->getName(), udf));
52
62
  if (ret.second == false)
53
63
  {
54
 
    errmsg_printf(ERRMSG_LVL_ERROR,
 
64
    errmsg_printf(error::ERROR,
55
65
                  _("Could not add Function!\n"));
56
66
    return true;
57
67
  }
 
68
 
58
69
  return false;
59
70
}
60
71