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 |
|
942.1.12
by Monty Taylor
Converted udf_func into a factory. |
25 |
#include <string> |
26 |
||
27 |
using namespace std; |
|
28 |
||
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
29 |
class Item_func_hello_world : public Item_str_func |
134.1.2
by Mark Atwood
Add hello_world() UDF |
30 |
{
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
31 |
public: |
896.1.4
by Monty Taylor
Fixed compiler warnings. |
32 |
Item_func_hello_world() : Item_str_func() {} |
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
33 |
const char *func_name() const { return "hello_world"; } |
34 |
String *val_str(String* s) { |
|
35 |
s->set(STRING_WITH_LEN("Hello World!"),system_charset_info); |
|
36 |
return s; |
|
37 |
};
|
|
38 |
void fix_length_and_dec() { |
|
39 |
max_length=strlen("Hello World!"); |
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
40 |
}
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
41 |
};
|
42 |
||
942.1.12
by Monty Taylor
Converted udf_func into a factory. |
43 |
Create_function<Item_func_hello_world> |
44 |
hello_world_udf(string("hello_world")); |
|
134.1.2
by Mark Atwood
Add hello_world() UDF |
45 |
|
971.1.52
by Monty Taylor
Did the finalizers. Renamed plugin_registry. |
46 |
static int hello_world_plugin_init(PluginRegistry ®istry) |
134.1.2
by Mark Atwood
Add hello_world() UDF |
47 |
{
|
971.1.52
by Monty Taylor
Did the finalizers. Renamed plugin_registry. |
48 |
registry.add(&hello_world_udf); |
134.1.2
by Mark Atwood
Add hello_world() UDF |
49 |
|
50 |
return 0; |
|
51 |
}
|
|
52 |
||
971.1.52
by Monty Taylor
Did the finalizers. Renamed plugin_registry. |
53 |
static int hello_world_plugin_deinit(PluginRegistry &) |
134.1.2
by Mark Atwood
Add hello_world() UDF |
54 |
{
|
55 |
return 0; |
|
56 |
}
|
|
57 |
||
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
58 |
|
813.2.1
by Toru Maesaka
Renamed mysql_declare_plugin to drizzle_declare_plugin |
59 |
drizzle_declare_plugin(hello_world) |
134.1.2
by Mark Atwood
Add hello_world() UDF |
60 |
{
|
61 |
"hello_world", |
|
177.4.3
by mark
ripped out more plugin ABI and API version checking, and plugin versions are now strings |
62 |
"1.0", |
134.1.2
by Mark Atwood
Add hello_world() UDF |
63 |
"Mark Atwood", |
64 |
"Hello, world!", |
|
65 |
PLUGIN_LICENSE_GPL, |
|
66 |
hello_world_plugin_init, /* Plugin Init */ |
|
67 |
hello_world_plugin_deinit, /* Plugin Deinit */ |
|
68 |
NULL, /* status variables */ |
|
69 |
NULL, /* system variables */ |
|
70 |
NULL /* config options */ |
|
71 |
}
|
|
813.2.2
by Toru Maesaka
Renamed mysql_declare_plugin_end to drizzle_declare_plugin_end |
72 |
drizzle_declare_plugin_end; |