~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/* Copyright (C) 2000 MySQL AB
2
3
   This program is free software; you can redistribute it and/or modify
4
   it under the terms of the GNU General Public License as published by
5
   the Free Software Foundation; version 2 of the License.
6
7
   This program is distributed in the hope that it will be useful,
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
   GNU General Public License for more details.
11
12
   You should have received a copy of the GNU General Public License
13
   along with this program; if not, write to the Free Software
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
16
/* This implements 'user defined functions' */
243.1.17 by Jay Pipes
FINAL PHASE removal of mysql_priv.h (Bye, bye my friend.)
17
#include <drizzled/server_includes.h>
538 by Monty Taylor
Moved gettext.h into drizzled in anticipation of the new client lib.
18
#include <drizzled/gettext.h>
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
19
#include <drizzled/sql_udf.h>
971.1.23 by Monty Taylor
Add generalized registry to be used for case-insensitive mappings.
20
#include <drizzled/registry.h>
971.1.46 by Monty Taylor
Made plugin registration go through Plugin_registry.
21
#include "drizzled/plugin_registry.h"
1 by brian
clean slate
22
873.2.22 by Monty Taylor
Got rid of my_hash_sort_utf8mb4 for udfs.
23
#include <string>
24
25
using namespace std;
26
971.1.23 by Monty Taylor
Add generalized registry to be used for case-insensitive mappings.
27
static drizzled::Registry<Function_builder *> udf_registry;
1 by brian
clean slate
28
942.1.12 by Monty Taylor
Converted udf_func into a factory.
29
Function_builder *find_udf(const char *name, uint32_t length)
134.1.1 by Mark Atwood
more hackery to get plugin UDFs working
30
{
971.1.23 by Monty Taylor
Add generalized registry to be used for case-insensitive mappings.
31
  return udf_registry.find(name, length);
134.1.1 by Mark Atwood
more hackery to get plugin UDFs working
32
}
33
971.1.46 by Monty Taylor
Made plugin registration go through Plugin_registry.
34
void add_udf(Function_builder *udf)
134.1.1 by Mark Atwood
more hackery to get plugin UDFs working
35
{
971.1.46 by Monty Taylor
Made plugin registration go through Plugin_registry.
36
  udf_registry.add(udf);
134.1.1 by Mark Atwood
more hackery to get plugin UDFs working
37
}
38
971.1.52 by Monty Taylor
Did the finalizers. Renamed plugin_registry.
39
void remove_udf(Function_builder *udf)
968.2.31 by Monty Taylor
Fixed UDF de-initialization.
40
{
971.1.23 by Monty Taylor
Add generalized registry to be used for case-insensitive mappings.
41
  udf_registry.remove(udf);
968.2.31 by Monty Taylor
Fixed UDF de-initialization.
42
}
43
134.1.1 by Mark Atwood
more hackery to get plugin UDFs working
44