~drizzle-trunk/drizzle/development

466 by Monty Taylor
Fixed modelines... these files are c++.
1
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
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
584.5.1 by Monty Taylor
Removed field includes from field.h.
24
#include <drizzled/field/str.h>
25
26
/*
27
 * Everything saved in this will disappear. It will always return NULL
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
28
 */
29
30
class Field_null :public Field_str {
481 by Brian Aker
Remove all of uchar.
31
  static unsigned char null[1];
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
32
public:
481 by Brian Aker
Remove all of uchar.
33
  Field_null(unsigned char *ptr_arg, uint32_t len_arg,
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
34
	     enum utype unireg_check_arg, const char *field_name_arg,
264.2.6 by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code.
35
	     const CHARSET_INFO * const cs)
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
36
    :Field_str(ptr_arg, len_arg, null, 1,
37
	       unireg_check_arg, field_name_arg, cs)
38
    {}
212.2.2 by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE
39
  enum_field_types type() const { return DRIZZLE_TYPE_NULL;}
646 by Brian Aker
Next pass through attribute.
40
  int  store(const char *, uint32_t, const CHARSET_INFO * const)
41
  { null[0]=1; return 0; }
42
  int store(double)
43
  { null[0]=1; return 0; }
44
  int store(int64_t, bool)
45
  { null[0]=1; return 0; }
46
  int store_decimal(const my_decimal *)
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
47
  { null[0]=1; return 0; }
48
  int reset(void)
49
  { return 0; }
50
  double val_real(void)
51
  { return 0.0;}
52
  int64_t val_int(void)
53
  { return 0;}
54
  my_decimal *val_decimal(my_decimal *) { return 0; }
646 by Brian Aker
Next pass through attribute.
55
  String *val_str(String *, String *value2)
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
56
  { value2->length(0); return value2;}
646 by Brian Aker
Next pass through attribute.
57
  int cmp(const unsigned char *, const unsigned char *) { return 0;}
58
  void sort_string(unsigned char *, uint32_t)  {}
205 by Brian Aker
uint32 -> uin32_t
59
  uint32_t pack_length() const { return 0; }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
60
  void sql_type(String &str) const;
482 by Brian Aker
Remove uint.
61
  uint32_t size_of() const { return sizeof(*this); }
205 by Brian Aker
uint32 -> uin32_t
62
  uint32_t max_display_length() { return 4; }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
63
};
64
65
#endif
66