~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/null.h

Removed DBUG symbols and fixed TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 MySQL
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
#ifndef DRIZZLE_SERVER_FIELD_NULL
22
 
#define DRIZZLE_SERVER_FIELD_NULL
23
 
 
24
 
/* 
25
 
  Everything saved in this will disappear. It will always return NULL 
26
 
 */
27
 
 
28
 
class Field_null :public Field_str {
29
 
  static unsigned char null[1];
30
 
public:
31
 
  Field_null(unsigned char *ptr_arg, uint32_t len_arg,
32
 
             enum utype unireg_check_arg, const char *field_name_arg,
33
 
             const CHARSET_INFO * const cs)
34
 
    :Field_str(ptr_arg, len_arg, null, 1,
35
 
               unireg_check_arg, field_name_arg, cs)
36
 
    {}
37
 
  enum_field_types type() const { return DRIZZLE_TYPE_NULL;}
38
 
  int  store(const char *to __attribute__((unused)),
39
 
             uint32_t length __attribute__((unused)),
40
 
             const CHARSET_INFO * const cs __attribute__((unused)))
41
 
  { null[0]=1; return 0; }
42
 
  int store(double nr __attribute__((unused)))
43
 
  { null[0]=1; return 0; }
44
 
  int store(int64_t nr __attribute__((unused)),
45
 
            bool unsigned_val __attribute__((unused)))
46
 
  { null[0]=1; return 0; }
47
 
  int store_decimal(const my_decimal *d __attribute__((unused)))
48
 
  { null[0]=1; return 0; }
49
 
  int reset(void)
50
 
  { return 0; }
51
 
  double val_real(void)
52
 
  { return 0.0;}
53
 
  int64_t val_int(void)
54
 
  { return 0;}
55
 
  my_decimal *val_decimal(my_decimal *) { return 0; }
56
 
  String *val_str(String *value __attribute__((unused)),
57
 
                  String *value2)
58
 
  { value2->length(0); return value2;}
59
 
  int cmp(const unsigned char *a __attribute__((unused)),
60
 
          const unsigned char *b __attribute__((unused))) { return 0;}
61
 
  void sort_string(unsigned char *buff __attribute__((unused)),
62
 
                   uint32_t length __attribute__((unused)))  {}
63
 
  uint32_t pack_length() const { return 0; }
64
 
  void sql_type(String &str) const;
65
 
  uint32_t size_of() const { return sizeof(*this); }
66
 
  uint32_t max_display_length() { return 4; }
67
 
};
68
 
 
69
 
#endif
70