Drizzled Public API Documentation

null.cc
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
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; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #include <config.h>
00021 
00022 #include <drizzled/field.h>
00023 #include <drizzled/item/null.h>
00024 #include <drizzled/lex_string.h>
00025 #include <drizzled/plugin/client.h>
00026 
00027 namespace drizzled {
00028 
00029 bool Item_null::eq(const Item *item, bool) const
00030 { return item->type() == type(); }
00031 
00032 double Item_null::val_real()
00033 {
00034   // following assert is redundant, because fixed=1 assigned in constructor
00035   assert(fixed == 1);
00036   null_value=1;
00037   return 0.0;
00038 }
00039 int64_t Item_null::val_int()
00040 {
00041   // following assert is redundant, because fixed=1 assigned in constructor
00042   assert(fixed == 1);
00043   null_value=1;
00044   return 0;
00045 }
00046 /* ARGSUSED */
00047 String *Item_null::val_str(String *)
00048 {
00049   // following assert is redundant, because fixed=1 assigned in constructor
00050   assert(fixed == 1);
00051   null_value=1;
00052   return 0;
00053 }
00054 
00055 type::Decimal *Item_null::val_decimal(type::Decimal *)
00056 {
00057   return 0;
00058 }
00059 
00060 
00061 void Item_null::print(String *str)
00062 {
00063   str->append(STRING_WITH_LEN("NULL"));
00064 }
00065 
00066 
00067 Item *Item_null::safe_charset_converter(const charset_info_st * const tocs)
00068 {
00069   collation.set(tocs);
00070   return this;
00071 }
00072 
00087 int Item_null::save_in_field(Field *field, bool no_conversions)
00088 {
00089   return set_field_to_null_with_conversions(field, no_conversions);
00090 }
00091 
00103 int Item_null::save_safe_in_field(Field *field)
00104 {
00105   return set_field_to_null(field);
00106 }
00107 
00112 void Item_null::send(plugin::Client *client, String *)
00113 {
00114   client->store();
00115 }
00116 
00117 } /* namespace drizzled */