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
#include <drizzled/server_includes.h>
17
#include <drizzled/item/func.h>
18
#include <drizzled/function/str/strfunc.h>
20
#include <libgearman/gearman.h>
22
class Item_func_gman_do :public Item_str_func
27
GMAN_DO_OPTIONS_NONE= 0,
28
GMAN_DO_OPTIONS_HIGH= (1 << 0),
29
GMAN_DO_OPTIONS_LOW= (1 << 1),
30
GMAN_DO_OPTIONS_BACKGROUND= (1 << 2),
31
GMAN_DO_OPTIONS_CLIENT= (1 << 3)
35
gman_do_options_t options;
36
gearman_client_st client;
42
options(GMAN_DO_OPTIONS_NONE) {}
43
Item_func_gman_do(gman_do_options_t options_arg):
45
options(options_arg) {}
47
void fix_length_and_dec() { max_length=10; }
48
virtual const char *func_name() const{ return "gman_do"; }
49
String *val_str(String *);
50
void *realloc(size_t size);
53
class Item_func_gman_do_high :public Item_func_gman_do
56
Item_func_gman_do_high():
57
Item_func_gman_do(GMAN_DO_OPTIONS_HIGH) {}
58
const char *func_name() const{ return "gman_do_high"; }
61
class Item_func_gman_do_low :public Item_func_gman_do
64
Item_func_gman_do_low():
65
Item_func_gman_do(GMAN_DO_OPTIONS_LOW) {}
66
const char *func_name() const{ return "gman_do_low"; }
69
class Item_func_gman_do_background :public Item_func_gman_do
72
Item_func_gman_do_background():
73
Item_func_gman_do(GMAN_DO_OPTIONS_BACKGROUND) {}
74
const char *func_name() const{ return "gman_do_background"; }
77
class Item_func_gman_do_high_background :public Item_func_gman_do
80
Item_func_gman_do_high_background():
81
Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_HIGH |
82
GMAN_DO_OPTIONS_BACKGROUND)) {}
83
const char *func_name() const{ return "gman_do_high_background"; }
86
class Item_func_gman_do_low_background :public Item_func_gman_do
89
Item_func_gman_do_low_background():
90
Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_LOW |
91
GMAN_DO_OPTIONS_BACKGROUND)) {}
92
const char *func_name() const{ return "gman_do_low_background"; }