1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_ITEM_TYPE_HOLDER_H
21
#define DRIZZLED_ITEM_TYPE_HOLDER_H
26
typedef struct st_typelib TYPELIB;
33
Item_type_holder used to store type. name, length of Item for UNIONS &
36
Item_type_holder do not need cleanup() because its time of live limited by
37
single SP/PS execution.
39
class Item_type_holder: public Item
42
TYPELIB *enum_set_typelib;
43
enum_field_types fld_type;
46
Get full information from Item about enum/set fields to be able to create
49
@param item Item for information collection
51
void get_full_info(Item *item);
53
/* It is used to count decimal precision in join_types */
54
int prev_decimal_int_part;
56
Item_type_holder(Session *session, Item *item);
59
Return expression type of Item_type_holder.
62
Item_result (type of internal Drizzle expression result)
64
Item_result result_type() const;
66
enum_field_types field_type() const { return fld_type; };
67
enum Type type() const { return TYPE_HOLDER; }
70
my_decimal *val_decimal(my_decimal *val);
71
String *val_str(String* val);
74
Find field type which can carry current Item_type_holder type and
77
@param session thread handler
78
@param item given item to join its parameters with this item ones
81
true error - types are incompatible
85
bool join_types(Session *session, Item *item);
88
Make temporary table field according collected information about type
91
@param table temporary table for which we create fields
96
Field *make_field_by_type(Table *table);
99
Calculate lenth for merging result for given Item type.
101
@param item Item for length detection
106
static uint32_t display_length(Item *item);
109
Find real field type of item.
112
type of field which should be created to store item value
114
static enum_field_types get_real_type(Item *item);
117
} /* namespace drizzled */
119
#endif /* DRIZZLED_ITEM_TYPE_HOLDER_H */