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 namespace drizzled { 00023 00024 /* 00025 Item_type_holder used to store type. name, length of Item for UNIONS & 00026 derived tables. 00027 00028 Item_type_holder do not need cleanup() because its time of live limited by 00029 single SP/PS execution. 00030 */ 00031 class Item_type_holder: public Item 00032 { 00033 protected: 00034 TYPELIB *enum_set_typelib; 00035 enum_field_types fld_type; 00036 00043 void get_full_info(Item *item); 00044 00045 /* It is used to count decimal precision in join_types */ 00046 int prev_decimal_int_part; 00047 public: 00048 Item_type_holder(Session *session, Item *item); 00049 00056 Item_result result_type() const; 00057 00058 enum_field_types field_type() const { return fld_type; }; 00059 enum Type type() const { return TYPE_HOLDER; } 00060 double val_real(); 00061 int64_t val_int(); 00062 type::Decimal *val_decimal(type::Decimal *val); 00063 String *val_str(String* val); 00064 00077 bool join_types(Session *session, Item *item); 00078 00088 Field *make_field_by_type(Table *table); 00089 00098 static uint32_t display_length(Item *item); 00099 00106 static enum_field_types get_real_type(Item *item); 00107 }; 00108 00109 } /* namespace drizzled */ 00110