~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/null.h

  • Committer: Olaf van der Spek
  • Date: 2011-06-16 21:54:21 UTC
  • mfrom: (2338 drizzle)
  • mto: (2318.6.3 refactor7)
  • mto: This revision was merged to the branch mainline in revision 2340.
  • Revision ID: olafvdspek@gmail.com-20110616215421-8jjy2xlyqck6hjtc
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include <drizzled/field/str.h>
24
24
 
25
 
namespace drizzled {
 
25
namespace drizzled
 
26
{
26
27
 
27
28
/*
28
29
 * Everything saved in this will disappear. It will always return NULL
29
30
 */
30
31
 
31
 
class Field_null : public Field_str
 
32
class Field_null :public Field_str
32
33
{
33
 
  static unsigned char null;
 
34
  static unsigned char null[1];
34
35
public:
35
36
 
36
37
  using Field::store;
38
39
  using Field::cmp;
39
40
  using Field::val_int;
40
41
 
41
 
  Field_null(unsigned char *ptr_arg, uint32_t len_arg, const char *field_name_arg) :
42
 
    Field_str(ptr_arg, len_arg, &null, 1, field_name_arg, &my_charset_bin)
 
42
  Field_null(unsigned char *ptr_arg,
 
43
             uint32_t len_arg,
 
44
             const char *field_name_arg) :
 
45
    Field_str(ptr_arg,
 
46
              len_arg,
 
47
              null,
 
48
              1,
 
49
              field_name_arg,
 
50
              &my_charset_bin)
43
51
  {}
44
52
 
45
53
  enum_field_types type() const
46
54
  {
47
55
    return DRIZZLE_TYPE_NULL;
48
56
  }
49
 
  int store(const char *, uint32_t, const charset_info_st * const)
 
57
  int  store(const char *, uint32_t, const charset_info_st * const)
50
58
  {
 
59
    null[0]= 1;
51
60
    return 0;
52
61
  }
53
62
  int store(double)
54
63
  {
 
64
    null[0]= 1;
55
65
    return 0;
56
66
  }
57
67
  int store(int64_t, bool)
58
68
  {
 
69
    null[0]= 1;
59
70
    return 0;
60
71
  }
61
72
  int store_decimal(const type::Decimal *)
62
73
  {
 
74
    null[0]= 1;
63
75
    return 0;
64
76
  }
65
 
  int reset()
 
77
  int reset(void)
66
78
  {
67
79
    return 0;
68
80
  }
69
 
  double val_real() const
 
81
  double val_real(void) const
70
82
  {
71
83
    return 0.0;
72
84
  }
73
 
  int64_t val_int() const
 
85
  int64_t val_int(void) const
74
86
  {
75
87
    return 0;
76
88
  }
105
117
};
106
118
 
107
119
} /* namespace drizzled */
 
120