Drizzled Public API Documentation

gman_do.h
1 /* Copyright (C) 2009 Sun Microsystems, Inc.
2 
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.
6 
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.
11 
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 */
15 
16 #pragma once
17 
18 #include <drizzled/item/func.h>
19 #include <drizzled/function/str/strfunc.h>
20 
21 #include <libgearman/gearman.h>
22 
24 {
25 protected:
26  typedef enum
27  {
28  GMAN_DO_OPTIONS_NONE= 0,
29  GMAN_DO_OPTIONS_HIGH= (1 << 0),
30  GMAN_DO_OPTIONS_LOW= (1 << 1),
31  GMAN_DO_OPTIONS_BACKGROUND= (1 << 2),
32  GMAN_DO_OPTIONS_CLIENT= (1 << 3)
33  } gman_do_options_t;
34 
35 private:
36  gman_do_options_t options;
37  gearman_client_st client;
38  drizzled::String buffer;
39 
40 public:
42  Item_str_func(),
43  options(GMAN_DO_OPTIONS_NONE) {}
44  Item_func_gman_do(gman_do_options_t options_arg):
45  Item_str_func(),
46  options(options_arg) {}
48  void fix_length_and_dec() { max_length=10; }
49  virtual const char *func_name() const{ return "gman_do"; }
51  void *realloc(size_t size);
52 };
53 
55 {
56 public:
58  Item_func_gman_do(GMAN_DO_OPTIONS_HIGH) {}
59  const char *func_name() const{ return "gman_do_high"; }
60 };
61 
63 {
64 public:
66  Item_func_gman_do(GMAN_DO_OPTIONS_LOW) {}
67  const char *func_name() const{ return "gman_do_low"; }
68 };
69 
71 {
72 public:
74  Item_func_gman_do(GMAN_DO_OPTIONS_BACKGROUND) {}
75  const char *func_name() const{ return "gman_do_background"; }
76 };
77 
79 {
80 public:
82  Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_HIGH |
83  GMAN_DO_OPTIONS_BACKGROUND)) {}
84  const char *func_name() const{ return "gman_do_high_background"; }
85 };
86 
88 {
89 public:
91  Item_func_gman_do((gman_do_options_t)(GMAN_DO_OPTIONS_LOW |
92  GMAN_DO_OPTIONS_BACKGROUND)) {}
93  const char *func_name() const{ return "gman_do_low_background"; }
94 };
95