drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
field/null.h
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#pragma once
22
23#include <drizzled/field/str.h>
24
25namespace drizzled {
26
27/*
28 * Everything saved in this will disappear. It will always return NULL
29 */
30
31class Field_null : public Field_str
32{
33 static unsigned char null;
34public:
35
36 using Field::store;
37 using Field::val_str;
38 using Field::cmp;
39 using Field::val_int;
40
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)
43 {}
44
45 enum_field_types type() const
46 {
47 return DRIZZLE_TYPE_NULL;
48 }
49 int store(const char *, uint32_t, const charset_info_st * const)
50 {
51 return 0;
52 }
53 int store(double)
54 {
55 return 0;
56 }
57 int store(int64_t, bool)
58 {
59 return 0;
60 }
61 int store_decimal(const type::Decimal *)
62 {
63 return 0;
64 }
65 int reset()
66 {
67 return 0;
68 }
69 double val_real() const
70 {
71 return 0.0;
72 }
73 int64_t val_int() const
74 {
75 return 0;
76 }
77 type::Decimal *val_decimal(type::Decimal *) const
78 {
79 return 0;
80 }
81 String *val_str(String *, String *value2) const
82 {
83 value2->length(0);
84 return value2;
85 }
86 int cmp(const unsigned char *, const unsigned char *)
87 {
88 return 0;
89 }
90 void sort_string(unsigned char *, uint32_t)
91 {}
92 uint32_t pack_length() const
93 {
94 return 0;
95 }
96 uint32_t size_of() const
97 {
98 return sizeof(*this);
99 }
100 uint32_t max_display_length()
101 {
102 return 4;
103 }
104};
105
106} /* namespace drizzled */
uint32_t pack_length() const
Definition field/null.h:92
TODO: Rename this file - func.h is stupid.