~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/function.cc

  • Committer: Brian Aker
  • Date: 2011-01-06 05:17:09 UTC
  • Revision ID: brian@tangent.org-20110106051709-oa0se8ur02uc6i9o
Added native functions into the function table.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
#include <drizzled/gettext.h>
27
27
#include "drizzled/plugin/function.h"
 
28
#include <drizzled/function_container.h>
28
29
 
29
30
#include "drizzled/util/string.h"
30
31
 
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(ERRMSG_LVL_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
54
    errmsg_printf(ERRMSG_LVL_ERROR,
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)
55
65
                  _("Could not add Function!\n"));
56
66
    return true;
57
67
  }
 
68
 
58
69
  return false;
59
70
}
60
71