~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/function.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
 
31
 
using namespace std;
32
 
 
33
32
namespace drizzled
34
33
{
35
34
 
42
41
 
43
42
bool plugin::Function::addPlugin(const plugin::Function *udf)
44
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
 
45
52
  if (udf_registry.find(udf->getName()) != udf_registry.end())
46
53
  {
47
 
    errmsg_printf(ERRMSG_LVL_ERROR,
 
54
    errmsg_printf(error::ERROR,
48
55
                  _("A function named %s already exists!\n"),
49
56
                  udf->getName().c_str());
50
57
    return true;
51
58
  }
52
 
  pair<UdfMap::iterator, bool> ret=
 
59
 
 
60
  std::pair<UdfMap::iterator, bool> ret=
53
61
    udf_registry.insert(make_pair(udf->getName(), udf));
54
62
  if (ret.second == false)
55
63
  {
56
 
    errmsg_printf(ERRMSG_LVL_ERROR,
 
64
    errmsg_printf(error::ERROR,
57
65
                  _("Could not add Function!\n"));
58
66
    return true;
59
67
  }
 
68
 
60
69
  return false;
61
70
}
62
71