~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
1122.2.10 by Monty Taylor
Fixed all of the include guards.
21
#ifndef DRIZZLED_FIELD_NULL_H
22
#define DRIZZLED_FIELD_NULL_H
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
23
584.5.1 by Monty Taylor
Removed field includes from field.h.
24
#include <drizzled/field/str.h>
25
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
26
namespace drizzled
27
{
28
584.5.1 by Monty Taylor
Removed field includes from field.h.
29
/*
30
 * 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/
31
 */
32
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
33
class Field_null :public Field_str
34
{
481 by Brian Aker
Remove all of uchar.
35
  static unsigned char null[1];
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
36
public:
779.3.18 by Monty Taylor
Cleaned up warnings up through innodb.
37
38
  using Field::store;
39
  using Field::val_str;
40
  using Field::cmp;
892.1.2 by Monty Taylor
Fixed solaris warnings.
41
  using Field::val_int;
779.3.18 by Monty Taylor
Cleaned up warnings up through innodb.
42
1119.9.12 by Jay Pipes
First phase removal of MTYP_TYPENR() macro. This removes the unireg_check argument for all Field types where it is irrelevant (everything but numeric types and timestamp.
43
  Field_null(unsigned char *ptr_arg,
44
             uint32_t len_arg,
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
45
             const char *field_name_arg,
1119.9.12 by Jay Pipes
First phase removal of MTYP_TYPENR() macro. This removes the unireg_check argument for all Field types where it is irrelevant (everything but numeric types and timestamp.
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
  {}
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
54
  enum_field_types type() const
55
  {
56
    return DRIZZLE_TYPE_NULL;
57
  }
646 by Brian Aker
Next pass through attribute.
58
  int  store(const char *, uint32_t, const CHARSET_INFO * const)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
59
  {
60
    null[0]= 1;
61
    return 0;
62
  }
646 by Brian Aker
Next pass through attribute.
63
  int store(double)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
64
  {
65
    null[0]= 1;
66
    return 0;
67
  }
646 by Brian Aker
Next pass through attribute.
68
  int store(int64_t, bool)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
69
  {
70
    null[0]= 1;
71
    return 0;
72
  }
2030.1.4 by Brian Aker
Change my_decimal to Decimal
73
  int store_decimal(const type::Decimal *)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
74
  {
75
    null[0]= 1;
76
    return 0;
77
  }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
78
  int reset(void)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
79
  {
80
    return 0;
81
  }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
82
  double val_real(void)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
83
  {
84
    return 0.0;
85
  }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
86
  int64_t val_int(void)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
87
  {
88
    return 0;
89
  }
2030.1.4 by Brian Aker
Change my_decimal to Decimal
90
  type::Decimal *val_decimal(type::Decimal *)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
91
  {
92
    return 0;
93
  }
646 by Brian Aker
Next pass through attribute.
94
  String *val_str(String *, String *value2)
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
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
  }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
109
  void sql_type(String &str) const;
1119.9.14 by Jay Pipes
Style cleanups after review. Thanks Monty :)
110
  uint32_t size_of() const
111
  {
112
    return sizeof(*this);
113
  }
114
  uint32_t max_display_length()
115
  {
116
    return 4;
117
  }
173.1.4 by Toru Maesaka
ripped out NULL and YEAR and moved to field/
118
};
119
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
120
} /* namespace drizzled */
121
1122.2.10 by Monty Taylor
Fixed all of the include guards.
122
#endif /* DRIZZLED_FIELD_NULL_H */