-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.cc
More file actions
146 lines (129 loc) · 4.28 KB
/
Copy pathplugin.cc
File metadata and controls
146 lines (129 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* Copyright (c) 2026 lefred (Frederic Descamps)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#define MYSQL_SERVER
#include "item_extramisc.h"
#include <mariadb.h>
#include <mysql/plugin_function.h>
#include <sql_class.h>
template <class Item_func_impl>
class Create_func_extra_misc_arg1 : public Create_func_arg1 {
public:
Item *create_1_arg(THD *thd, Item *arg1) override {
return new (thd->mem_root) Item_func_impl(thd, arg1);
}
protected:
Create_func_extra_misc_arg1() {}
~Create_func_extra_misc_arg1() override {}
};
class Create_func_unaccent
: public Create_func_extra_misc_arg1<Item_func_unaccent> {
public:
static Create_func_unaccent s_singleton;
};
class Create_func_slugify
: public Create_func_extra_misc_arg1<Item_func_slugify> {
public:
static Create_func_slugify s_singleton;
};
class Create_func_age : public Create_func_extra_misc_arg1<Item_func_age> {
public:
static Create_func_age s_singleton;
};
class Create_func_human_number
: public Create_func_extra_misc_arg1<Item_func_human_number> {
public:
static Create_func_human_number s_singleton;
};
class Create_func_parse_duration
: public Create_func_extra_misc_arg1<Item_func_parse_duration> {
public:
static Create_func_parse_duration s_singleton;
};
Create_func_unaccent Create_func_unaccent::s_singleton;
Create_func_slugify Create_func_slugify::s_singleton;
Create_func_age Create_func_age::s_singleton;
Create_func_human_number Create_func_human_number::s_singleton;
Create_func_parse_duration Create_func_parse_duration::s_singleton;
#define BUILDER(F) &F::s_singleton
static Plugin_function
plugin_descriptor_function_unaccent(BUILDER(Create_func_unaccent)),
plugin_descriptor_function_slugify(BUILDER(Create_func_slugify)),
plugin_descriptor_function_age(BUILDER(Create_func_age)),
plugin_descriptor_function_human_number(BUILDER(Create_func_human_number)),
plugin_descriptor_function_parse_duration(
BUILDER(Create_func_parse_duration));
/*************************************************************************/
maria_declare_plugin(extra_misc){MariaDB_FUNCTION_PLUGIN,
&plugin_descriptor_function_unaccent,
"unaccent",
"lefred",
"Function UNACCENT()",
PLUGIN_LICENSE_GPL,
0,
0,
0x0100,
NULL,
NULL,
"1.0",
MariaDB_PLUGIN_MATURITY_BETA},
{MariaDB_FUNCTION_PLUGIN,
&plugin_descriptor_function_slugify,
"slugify",
"lefred",
"Function SLUGIFY()",
PLUGIN_LICENSE_GPL,
0,
0,
0x0100,
NULL,
NULL,
"1.0",
MariaDB_PLUGIN_MATURITY_BETA},
{MariaDB_FUNCTION_PLUGIN,
&plugin_descriptor_function_age,
"age",
"lefred",
"Function AGE()",
PLUGIN_LICENSE_GPL,
0,
0,
0x0100,
NULL,
NULL,
"1.0",
MariaDB_PLUGIN_MATURITY_BETA},
{MariaDB_FUNCTION_PLUGIN,
&plugin_descriptor_function_human_number,
"human_number",
"lefred",
"Function HUMAN_NUMBER()",
PLUGIN_LICENSE_GPL,
0,
0,
0x0100,
NULL,
NULL,
"1.0",
MariaDB_PLUGIN_MATURITY_BETA},
{MariaDB_FUNCTION_PLUGIN,
&plugin_descriptor_function_parse_duration,
"parse_duration",
"lefred",
"Function PARSE_DURATION()",
PLUGIN_LICENSE_GPL,
0,
0,
0x0100,
NULL,
NULL,
"0.2.0",
MariaDB_PLUGIN_MATURITY_BETA} maria_declare_plugin_end;