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