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 #pragma once 00021 00022 #include <drizzled/memory/sql_alloc.h> 00023 #include <drizzled/sql_string.h> 00024 #include <drizzled/type/decimal.h> 00025 00026 namespace drizzled 00027 { 00028 00029 class Item; 00030 class Session; 00031 class Field; 00032 00033 class Cached_item :public memory::SqlAlloc 00034 { 00035 public: 00036 bool null_value; 00037 Cached_item() :null_value(0) {} 00038 virtual bool cmp(void)=0; 00039 virtual ~Cached_item(); /*line -e1509 */ 00040 }; 00041 00042 class Cached_item_str :public Cached_item 00043 { 00044 Item *item; 00045 String value,tmp_value; 00046 public: 00047 Cached_item_str(Session *session, Item *arg); 00048 bool cmp(void); 00049 ~Cached_item_str(); // Deallocate String:s 00050 }; 00051 00052 00053 class Cached_item_real :public Cached_item 00054 { 00055 Item *item; 00056 double value; 00057 public: 00058 Cached_item_real(Item *item_par) :item(item_par),value(0.0) {} 00059 bool cmp(void); 00060 }; 00061 00062 class Cached_item_int :public Cached_item 00063 { 00064 Item *item; 00065 int64_t value; 00066 public: 00067 Cached_item_int(Item *item_par) :item(item_par),value(0) {} 00068 bool cmp(void); 00069 }; 00070 00071 00072 class Cached_item_decimal :public Cached_item 00073 { 00074 Item *item; 00075 type::Decimal value; 00076 public: 00077 Cached_item_decimal(Item *item_par); 00078 bool cmp(void); 00079 }; 00080 00081 class Cached_item_field :public Cached_item 00082 { 00083 unsigned char *buff; 00084 Field *field; 00085 uint32_t length; 00086 00087 public: 00088 Cached_item_field(Field *arg_field); 00089 bool cmp(void); 00090 }; 00091 00092 Cached_item *new_Cached_item(Session *session, Item *item); 00093 00094 } /* namespace drizzled */ 00095