Drizzled Public API Documentation

null.h
00001 /* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 MySQL
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #pragma once
00022 
00023 #include <drizzled/field/str.h>
00024 
00025 namespace drizzled {
00026 
00027 /*
00028  * Everything saved in this will disappear. It will always return NULL
00029  */
00030 
00031 class Field_null : public Field_str
00032 {
00033   static unsigned char null;
00034 public:
00035 
00036   using Field::store;
00037   using Field::val_str;
00038   using Field::cmp;
00039   using Field::val_int;
00040 
00041   Field_null(unsigned char *ptr_arg, uint32_t len_arg, const char *field_name_arg) :
00042     Field_str(ptr_arg, len_arg, &null, 1, field_name_arg, &my_charset_bin)
00043   {}
00044 
00045   enum_field_types type() const
00046   {
00047     return DRIZZLE_TYPE_NULL;
00048   }
00049   int store(const char *, uint32_t, const charset_info_st * const)
00050   {
00051     return 0;
00052   }
00053   int store(double)
00054   {
00055     return 0;
00056   }
00057   int store(int64_t, bool)
00058   {
00059     return 0;
00060   }
00061   int store_decimal(const type::Decimal *)
00062   {
00063     return 0;
00064   }
00065   int reset()
00066   {
00067     return 0;
00068   }
00069   double val_real() const
00070   {
00071     return 0.0;
00072   }
00073   int64_t val_int() const
00074   {
00075     return 0;
00076   }
00077   type::Decimal *val_decimal(type::Decimal *) const
00078   {
00079     return 0;
00080   }
00081   String *val_str(String *, String *value2) const
00082   {
00083     value2->length(0);
00084     return value2;
00085   }
00086   int cmp(const unsigned char *, const unsigned char *)
00087   {
00088     return 0;
00089   }
00090   void sort_string(unsigned char *, uint32_t)
00091   {}
00092   uint32_t pack_length() const
00093   {
00094     return 0;
00095   }
00096   uint32_t size_of() const
00097   {
00098     return sizeof(*this);
00099   }
00100   uint32_t max_display_length()
00101   {
00102     return 4;
00103   }
00104 };
00105 
00106 } /* namespace drizzled */