~drizzle-trunk/drizzle/development

1751.3.5 by Brian Aker
Add two plugins to handle the string and math functions.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2010 Brian Aker
1759.3.27 by Stewart Smith
update copyright and author for math_functions
5
 *  Copyright (C) 2010 Stewart Smith
1751.3.5 by Brian Aker
Add two plugins to handle the string and math functions.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 */
21
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
22
#include <config.h>
1759.3.1 by Stewart Smith
move ABS() function into math_functions plugin. We now have '3 AS three' allowed as a parameter, just like all the UDFs did
23
#include <drizzled/plugin/function.h>
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
24
#include <plugin/math_functions/functions.h>
25
#include <plugin/math_functions/abs.h>
26
#include <plugin/math_functions/acos.h>
27
#include <plugin/math_functions/asin.h>
28
#include <plugin/math_functions/atan.h>
29
#include <plugin/math_functions/cos.h>
30
#include <plugin/math_functions/log.h>
31
#include <plugin/math_functions/sin.h>
32
#include <plugin/math_functions/pow.h>
33
#include <plugin/math_functions/ln.h>
34
#include <plugin/math_functions/sqrt.h>
35
#include <plugin/math_functions/ceiling.h>
36
#include <plugin/math_functions/exp.h>
37
#include <plugin/math_functions/floor.h>
38
#include <plugin/math_functions/ord.h>
1751.3.5 by Brian Aker
Add two plugins to handle the string and math functions.
39
40
using namespace drizzled;
41
42
static int init(drizzled::module::Context &context)
43
{
1759.3.13 by Stewart Smith
clean up math_functions plugin: we don't need to keep pointer to each function plugin around, the plugins system cleans up for us.
44
  context.add(new plugin::Create_function<Item_func_abs>("abs"));
45
  context.add(new plugin::Create_function<Item_func_acos>("acos"));
46
  context.add(new plugin::Create_function<Item_func_asin>("asin"));
47
  context.add(new plugin::Create_function<Item_func_atan>("atan"));
48
  context.add(new plugin::Create_function<Item_func_atan>("atan2"));
49
  context.add(new plugin::Create_function<Item_func_cos>("cos"));
50
  context.add(new plugin::Create_function<Item_func_log>("log"));
51
  context.add(new plugin::Create_function<Item_func_log2>("log2"));
52
  context.add(new plugin::Create_function<Item_func_log10>("log10"));
53
  context.add(new plugin::Create_function<Item_func_sin>("sin"));
54
  context.add(new plugin::Create_function<Item_func_pow>("pow"));
55
  context.add(new plugin::Create_function<Item_func_pow>("power"));
1759.3.14 by Stewart Smith
move LN() function into math_functions plugin
56
  context.add(new plugin::Create_function<Item_func_ln>("ln"));
1759.3.15 by Stewart Smith
move SQRT() function into math_functions plugin
57
  context.add(new plugin::Create_function<Item_func_sqrt>("sqrt"));
1759.3.16 by Stewart Smith
move CEIL() and CEILING() function into math_functions plugin
58
  context.add(new plugin::Create_function<Item_func_ceiling>("ceil"));
59
  context.add(new plugin::Create_function<Item_func_ceiling>("ceiling"));
1759.3.17 by Stewart Smith
move EXP() function into math_functions plugin
60
  context.add(new plugin::Create_function<Item_func_exp>("exp"));
1759.3.19 by Stewart Smith
move FLOOR() function into math_functions plugin
61
  context.add(new plugin::Create_function<Item_func_floor>("floor"));
1759.3.20 by Stewart Smith
move ORD() function into math_functions plugin
62
  context.add(new plugin::Create_function<Item_func_ord>("ord"));
1759.3.1 by Stewart Smith
move ABS() function into math_functions plugin. We now have '3 AS three' allowed as a parameter, just like all the UDFs did
63
1751.3.5 by Brian Aker
Add two plugins to handle the string and math functions.
64
  return 0;
65
}
66
67
DRIZZLE_DECLARE_PLUGIN
68
{
69
  DRIZZLE_VERSION_ID,
70
  "Math Functions",
71
  "1.0",
1759.3.27 by Stewart Smith
update copyright and author for math_functions
72
  "Brian Aker, Stewart Smith",
1751.3.5 by Brian Aker
Add two plugins to handle the string and math functions.
73
  "Math Functions.",
74
  PLUGIN_LICENSE_GPL,
75
  init,
76
  NULL,
77
  NULL
78
}
79
DRIZZLE_DECLARE_PLUGIN_END;