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. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
19 |
|
670.2.2
by Monty Taylor
Got rid of the rest of common_includes. Now on to server_includes. |
20 |
#include <drizzled/server_includes.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. |
21 |
#include <drizzled/sql_udf.h> |
584.4.6
by Monty Taylor
Moved stuff into item/ |
22 |
#include <drizzled/item/func.h> |
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
23 |
#include <drizzled/function/str/strfunc.h> |
134.1.2
by Mark Atwood
Add hello_world() UDF |
24 |
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
25 |
class Item_func_hello_world : public Item_str_func |
134.1.2
by Mark Atwood
Add hello_world() UDF |
26 |
{
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
27 |
public: |
28 |
const char *func_name() const { return "hello_world"; } |
|
29 |
String *val_str(String* s) { |
|
30 |
s->set(STRING_WITH_LEN("Hello World!"),system_charset_info); |
|
31 |
return s; |
|
32 |
};
|
|
33 |
void fix_length_and_dec() { |
|
34 |
max_length=strlen("Hello World!"); |
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
35 |
}
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
36 |
};
|
37 |
||
38 |
Item_func* create_hello_world_udf_item(MEM_ROOT* m) |
|
39 |
{
|
|
40 |
return new (m) Item_func_hello_world(); |
|
41 |
}
|
|
42 |
||
43 |
static struct udf_func hello_world_udf = { |
|
44 |
{ C_STRING_WITH_LEN("hello_world") }, |
|
45 |
create_hello_world_udf_item
|
|
46 |
};
|
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
47 |
|
48 |
static int hello_world_plugin_init(void *p) |
|
49 |
{
|
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
50 |
udf_func **f = (udf_func**) p; |
134.1.2
by Mark Atwood
Add hello_world() UDF |
51 |
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
52 |
*f= &hello_world_udf; |
134.1.2
by Mark Atwood
Add hello_world() UDF |
53 |
|
54 |
return 0; |
|
55 |
}
|
|
56 |
||
57 |
static int hello_world_plugin_deinit(void *p) |
|
58 |
{
|
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
59 |
udf_func *udff = (udf_func *) p; |
60 |
(void)udff; |
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
61 |
return 0; |
62 |
}
|
|
63 |
||
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
64 |
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
65 |
mysql_declare_plugin(hello_world) |
66 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
67 |
DRIZZLE_UDF_PLUGIN, |
134.1.2
by Mark Atwood
Add hello_world() UDF |
68 |
"hello_world", |
177.4.3
by mark
ripped out more plugin ABI and API version checking, and plugin versions are now strings |
69 |
"1.0", |
134.1.2
by Mark Atwood
Add hello_world() UDF |
70 |
"Mark Atwood", |
71 |
"Hello, world!", |
|
72 |
PLUGIN_LICENSE_GPL, |
|
73 |
hello_world_plugin_init, /* Plugin Init */ |
|
74 |
hello_world_plugin_deinit, /* Plugin Deinit */ |
|
75 |
NULL, /* status variables */ |
|
76 |
NULL, /* system variables */ |
|
77 |
NULL /* config options */ |
|
78 |
}
|
|
79 |
mysql_declare_plugin_end; |