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

« back to all changes in this revision

Viewing changes to drizzled/item/boolean.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
#include <drizzled/item/basic_constant.h>
23
23
 
24
 
namespace drizzled
25
 
{
26
 
 
27
 
namespace item
28
 
{
29
 
 
30
 
class Boolean: public Item_basic_constant
 
24
namespace drizzled {
 
25
namespace item {
 
26
 
 
27
class Boolean : public Item_basic_constant
31
28
{
32
29
  bool value;
33
30
 
34
31
public:
35
32
  Boolean(const char *str_arg, bool arg) :
36
 
    Item_basic_constant(),
37
33
    value(arg)
38
34
  {
39
35
    max_length= value ? 4 : 5;
40
36
    fixed= true;
41
 
    name= (const_cast<char *>(str_arg));
 
37
    name= str_arg;
42
38
  }
43
39
 
44
40
  Boolean(bool arg) :
46
42
  {
47
43
    max_length= value ? 4 : 5;
48
44
    fixed= true;
49
 
 
50
 
    if (value)
51
 
    {
52
 
      name= const_cast<char *>("TRUE");
53
 
    }
54
 
    else
55
 
    {
56
 
      name= const_cast<char *>("FALSE");
57
 
    }
 
45
    name= value ? "TRUE" : "FALSE";
58
46
  }
59
47
 
60
48
  enum Type type() const { return BOOLEAN_ITEM; }
61
49
 
 
50
  Item_result result_type() const
 
51
  {
 
52
    return INT_RESULT;
 
53
  }
 
54
 
62
55
  virtual bool val_bool()
63
56
  {
64
57
    return value;
80
73
 
81
74
    if (value)
82
75
    {
83
 
      value_buffer->append("TRUE");
 
76
      value_buffer->copy("TRUE", 4, default_charset());
84
77
    }
85
78
    else
86
79
    {
87
 
      value_buffer->append("FALSE");
 
80
      value_buffer->copy("FALSE", 5, default_charset());
88
81
    }
89
82
 
90
83
    return value_buffer;
91
84
  }
92
85
 
93
 
  type::Decimal* val_decimal(type::Decimal *dec)
 
86
  type::Decimal* val_decimal(type::Decimal*)
94
87
  {
95
 
    (void)dec;
96
88
    return 0;
97
89
  }
98
90