~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/null.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_FIELD_NULL_H
22
 
#define DRIZZLED_FIELD_NULL_H
 
21
#ifndef DRIZZLE_SERVER_FIELD_NULL
 
22
#define DRIZZLE_SERVER_FIELD_NULL
23
23
 
24
24
#include <drizzled/field/str.h>
25
25
 
26
 
namespace drizzled
27
 
{
28
 
 
29
26
/*
30
27
 * Everything saved in this will disappear. It will always return NULL
31
28
 */
32
29
 
33
 
class Field_null :public Field_str
34
 
{
 
30
class Field_null :public Field_str {
35
31
  static unsigned char null[1];
36
32
public:
37
33
 
40
36
  using Field::cmp;
41
37
  using Field::val_int;
42
38
 
43
 
  Field_null(unsigned char *ptr_arg,
44
 
             uint32_t len_arg,
45
 
             const char *field_name_arg,
46
 
             const CHARSET_INFO * const cs)
47
 
    :Field_str(ptr_arg,
48
 
               len_arg,
49
 
               null,
50
 
               1,
51
 
                     field_name_arg,
52
 
               cs)
53
 
  {}
54
 
  enum_field_types type() const
55
 
  {
56
 
    return DRIZZLE_TYPE_NULL;
57
 
  }
 
39
  Field_null(unsigned char *ptr_arg, uint32_t len_arg,
 
40
             enum utype unireg_check_arg, const char *field_name_arg,
 
41
             const CHARSET_INFO * const cs)
 
42
    :Field_str(ptr_arg, len_arg, null, 1,
 
43
               unireg_check_arg, field_name_arg, cs)
 
44
    {}
 
45
  enum_field_types type() const { return DRIZZLE_TYPE_NULL;}
58
46
  int  store(const char *, uint32_t, const CHARSET_INFO * const)
59
 
  {
60
 
    null[0]= 1;
61
 
    return 0;
62
 
  }
 
47
  { null[0]=1; return 0; }
63
48
  int store(double)
64
 
  {
65
 
    null[0]= 1;
66
 
    return 0;
67
 
  }
 
49
  { null[0]=1; return 0; }
68
50
  int store(int64_t, bool)
69
 
  {
70
 
    null[0]= 1;
71
 
    return 0;
72
 
  }
 
51
  { null[0]=1; return 0; }
73
52
  int store_decimal(const my_decimal *)
74
 
  {
75
 
    null[0]= 1;
76
 
    return 0;
77
 
  }
 
53
  { null[0]=1; return 0; }
78
54
  int reset(void)
79
 
  {
80
 
    return 0;
81
 
  }
 
55
  { return 0; }
82
56
  double val_real(void)
83
 
  {
84
 
    return 0.0;
85
 
  }
 
57
  { return 0.0;}
86
58
  int64_t val_int(void)
87
 
  {
88
 
    return 0;
89
 
  }
90
 
  my_decimal *val_decimal(my_decimal *)
91
 
  {
92
 
    return 0;
93
 
  }
 
59
  { return 0;}
 
60
  my_decimal *val_decimal(my_decimal *) { return 0; }
94
61
  String *val_str(String *, String *value2)
95
 
  {
96
 
    value2->length(0);
97
 
    return value2;
98
 
  }
99
 
  int cmp(const unsigned char *, const unsigned char *)
100
 
  {
101
 
    return 0;
102
 
  }
103
 
  void sort_string(unsigned char *, uint32_t)
104
 
  {}
105
 
  uint32_t pack_length() const
106
 
  {
107
 
    return 0;
108
 
  }
 
62
  { value2->length(0); return value2;}
 
63
  int cmp(const unsigned char *, const unsigned char *) { return 0;}
 
64
  void sort_string(unsigned char *, uint32_t)  {}
 
65
  uint32_t pack_length() const { return 0; }
109
66
  void sql_type(String &str) const;
110
 
  uint32_t size_of() const
111
 
  {
112
 
    return sizeof(*this);
113
 
  }
114
 
  uint32_t max_display_length()
115
 
  {
116
 
    return 4;
117
 
  }
 
67
  uint32_t size_of() const { return sizeof(*this); }
 
68
  uint32_t max_display_length() { return 4; }
118
69
};
119
70
 
120
 
} /* namespace drizzled */
 
71
#endif
121
72
 
122
 
#endif /* DRIZZLED_FIELD_NULL_H */