Drizzled Public API Documentation

type_holder.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 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 typedef struct st_typelib TYPELIB;
00026 class String;
00027 namespace type {
00028 class Decimal;
00029 }
00030 class Session;
00031 class Item;
00032 
00033 /*
00034   Item_type_holder used to store type. name, length of Item for UNIONS &
00035   derived tables.
00036 
00037   Item_type_holder do not need cleanup() because its time of live limited by
00038   single SP/PS execution.
00039 */
00040 class Item_type_holder: public Item
00041 {
00042 protected:
00043   TYPELIB *enum_set_typelib;
00044   enum_field_types fld_type;
00045 
00052   void get_full_info(Item *item);
00053 
00054   /* It is used to count decimal precision in join_types */
00055   int prev_decimal_int_part;
00056 public:
00057   Item_type_holder(Session *session, Item *item);
00058 
00065   Item_result result_type() const;
00066 
00067   enum_field_types field_type() const { return fld_type; };
00068   enum Type type() const { return TYPE_HOLDER; }
00069   double val_real();
00070   int64_t val_int();
00071   type::Decimal *val_decimal(type::Decimal *val);
00072   String *val_str(String* val);
00073 
00086   bool join_types(Session *session, Item *item);
00087 
00097   Field *make_field_by_type(Table *table);
00098 
00107   static uint32_t display_length(Item *item);
00108 
00115   static enum_field_types get_real_type(Item *item);
00116 };
00117 
00118 } /* namespace drizzled */
00119