~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/gearman_udf/gman_do.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2009 Sun Microsystems
 
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
#ifndef PLUGIN_GEARMAN_UDF_GMAN_DO_H
 
17
#define PLUGIN_GEARMAN_UDF_GMAN_DO_H
 
18
 
 
19
#include <drizzled/item/func.h>
 
20
#include <drizzled/function/str/strfunc.h>
 
21
 
 
22
#include <libgearman/gearman.h>
 
23
 
 
24
class Item_func_gman_do :public drizzled::Item_str_func
 
25
{
 
26
protected:
 
27
  typedef enum
 
28
  {
 
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)
 
34
  } gman_do_options_t;
 
35
 
 
36
private:
 
37
  gman_do_options_t options;
 
38
  gearman_client_st client;
 
39
  drizzled::String buffer;
 
40
 
 
41
public:
 
42
  Item_func_gman_do():
 
43
    Item_str_func(),
 
44
    options(GMAN_DO_OPTIONS_NONE) {}
 
45
  Item_func_gman_do(gman_do_options_t options_arg):
 
46
    Item_str_func(),
 
47
    options(options_arg) {}
 
48
  ~Item_func_gman_do();
 
49
  void fix_length_and_dec() { max_length=10; }
 
50
  virtual const char *func_name() const{ return "gman_do"; }
 
51
  drizzled::String *val_str(drizzled::String *);
 
52
  void *realloc(size_t size);
 
53
};
 
54
 
 
55
class Item_func_gman_do_high :public Item_func_gman_do
 
56
{
 
57
public:
 
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"; }
 
61
};
 
62
 
 
63
class Item_func_gman_do_low :public Item_func_gman_do
 
64
{
 
65
public:
 
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"; }
 
69
};
 
70
 
 
71
class Item_func_gman_do_background :public Item_func_gman_do
 
72
{
 
73
public:
 
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"; }
 
77
};
 
78
 
 
79
class Item_func_gman_do_high_background :public Item_func_gman_do
 
80
{
 
81
public:
 
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"; }
 
86
};
 
87
 
 
88
class Item_func_gman_do_low_background :public Item_func_gman_do
 
89
{
 
90
public:
 
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"; }
 
95
};
 
96
 
 
97
#endif /* PLUGIN_GEARMAN_UDF_GMAN_DO_H */