18 #include <mysql/plugin.h>
20 #if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
21 #define __attribute__(A)
24 static long number_of_calls= 0;
65 static int simple_parser_plugin_init(
void *arg __attribute__((unused)))
84 static int simple_parser_plugin_deinit(
void *arg __attribute__((unused)))
105 __attribute__((unused)))
126 __attribute__((unused)))
151 { FT_TOKEN_WORD, 0, 0, 0, 0,
' ', 0 };
153 param->mysql_add_word(param, word, len, &bool_info);
172 char *end, *start, *docend= param->doc + param->length;
176 for (end= start= param->doc;; end++)
181 add_word(param, start, end - start);
184 else if (isspace(*end))
187 add_word(param, start, end - start);
201 MYSQL_FTPARSER_INTERFACE_VERSION,
213 {
"static", (
char *)
"just a static text", SHOW_CHAR},
214 {
"called", (
char *)&number_of_calls, SHOW_LONG},
222 static long sysvar_one_value;
223 static char *sysvar_two_value;
225 static MYSQL_SYSVAR_LONG(simple_sysvar_one, sysvar_one_value,
227 "Simple fulltext parser example system variable number one. Give a number.",
228 NULL, NULL, 77L, 7L, 777L, 0);
230 static MYSQL_SYSVAR_STR(simple_sysvar_two, sysvar_two_value,
231 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
232 "Simple fulltext parser example system variable number two. Give a string.",
233 NULL, NULL,
"simple sysvar two default");
235 static MYSQL_THDVAR_LONG(simple_thdvar_one,
237 "Simple fulltext parser example thread variable number one. Give a number.",
238 NULL, NULL, 88L, 8L, 888L, 0);
240 static MYSQL_THDVAR_STR(simple_thdvar_two,
241 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
242 "Simple fulltext parser example thread variable number two. Give a string.",
243 NULL, NULL,
"simple thdvar two default");
246 MYSQL_SYSVAR(simple_sysvar_one),
247 MYSQL_SYSVAR(simple_sysvar_two),
248 MYSQL_SYSVAR(simple_thdvar_one),
249 MYSQL_SYSVAR(simple_thdvar_two),
257 mysql_declare_plugin(ftexample)
259 MYSQL_FTPARSER_PLUGIN,
260 &simple_parser_descriptor,
263 "Simple Full-Text Parser",
265 simple_parser_plugin_init,
266 simple_parser_plugin_deinit,
269 simple_system_variables,
273 mysql_declare_plugin_end;