1
/* Copyright (C) 2009 Sun Microsystems
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
#ifndef PLUGIN_GEARMAN_UDF_GMAN_DO_H
17
#define PLUGIN_GEARMAN_UDF_GMAN_DO_H
19
#include <drizzled/item/func.h>
20
#include <drizzled/function/str/strfunc.h>
22
#include <libgearman/gearman.h>
24
class Item_func_gman_do :public Item_str_func
29
GMAN_DO_OPTIONS_NONE= 0,
30
GMAN_DO_OPTIONS_HIGH= (1 << 0),
31
GMAN_DO_OPTIONS_LOW= (1 << 1),
32
GMAN_DO_OPTIONS_BACKGROUND= (1 << 2),
33
GMAN_DO_OPTIONS_CLIENT= (1 << 3)
37
gman_do_options_t options;
38
gearman_client_st client;
44
options(GMAN_DO_OPTIONS_NONE) {}
45
Item_func_gman_do(gman_do_options_t options_arg):
47
options(options_arg) {}
49
void fix_length_and_dec() { max_length=10; }
50
virtual const char *func_name() const{ return "gman_do"; }
51
String *val_str(String *);
52
void *realloc(size_t size);
55
class Item_func_gman_do_high :public Item_func_gman_do
58
Item_func_gman_do_high():
59
Item_func_gman_do(GMAN_DO_OPTIONS_HIGH) {}
60
const char *func_name() const{ return "gman_do_high"; }
63
class Item_func_gman_do_low :public Item_func_gman_do
66
Item_func_gman_do_low():
67
Item_func_gman_do(GMAN_DO_OPTIONS_LOW) {}
68
const char *func_name() const{ return "gman_do_low"; }
71
class Item_func_gman_do_background :public Item_func_gman_do
74
Item_func_gman_do_background():
75
Item_func_gman_do(GMAN_DO_OPTIONS_BACKGROUND) {}
76
const char *func_name() const{ return "gman_do_background"; }
79
class Item_func_gman_do_high_background :public Item_func_gman_do
82
Item_func_gman_do_high_background():
83
Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_HIGH |
84
GMAN_DO_OPTIONS_BACKGROUND)) {}
85
const char *func_name() const{ return "gman_do_high_background"; }
88
class Item_func_gman_do_low_background :public Item_func_gman_do
91
Item_func_gman_do_low_background():
92
Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_LOW |
93
GMAN_DO_OPTIONS_BACKGROUND)) {}
94
const char *func_name() const{ return "gman_do_low_background"; }
97
#endif /* PLUGIN_GEARMAN_UDF_GMAN_DO_H */