~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to drizzled/plugin/function.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <drizzled/util/find_ptr.h>
30
30
#include <drizzled/util/string.h>
31
31
 
32
 
namespace drizzled
33
 
{
 
32
namespace drizzled {
34
33
 
35
34
static plugin::Function::UdfMap udf_registry;
36
35
 
43
42
{
44
43
  if (FunctionContainer::getMap().count(udf->getName()))
45
44
  {
46
 
    errmsg_printf(error::ERROR,
47
 
                  _("A function named %s already exists!\n"),
48
 
                  udf->getName().c_str());
 
45
    errmsg_printf(error::ERROR, _("A function named %s already exists!\n"), udf->getName().c_str());
49
46
    return true;
50
47
  }
51
48
 
52
49
  if (udf_registry.count(udf->getName()))
53
50
  {
54
 
    errmsg_printf(error::ERROR,
55
 
                  _("A function named %s already exists!\n"),
56
 
                  udf->getName().c_str());
 
51
    errmsg_printf(error::ERROR, _("A function named %s already exists!\n"), udf->getName().c_str());
57
52
    return true;
58
53
  }
59
54
 
60
 
  std::pair<UdfMap::iterator, bool> ret=
61
 
    udf_registry.insert(make_pair(udf->getName(), udf));
62
 
 
63
 
  if (ret.second == false)
 
55
  if (not udf_registry.insert(make_pair(udf->getName(), udf)).second)
64
56
  {
65
 
    errmsg_printf(error::ERROR,
66
 
                  _("Could not add Function!\n"));
 
57
    errmsg_printf(error::ERROR, _("Could not add Function!\n"));
67
58
    return true;
68
59
  }
69
60
 
78
69
 
79
70
const plugin::Function *plugin::Function::get(const std::string &name)
80
71
{
81
 
  UdfMap::mapped_type* ptr= find_ptr(udf_registry, name);
82
 
  return ptr ? *ptr : NULL;
 
72
  return find_ptr2(udf_registry, name);
83
73
}
84
74
 
85
75
} /* namespace drizzled */