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_CACHE_H
21
#define DRIZZLED_ITEM_CACHE_H
23
#include <drizzled/item/ident.h>
24
#include <drizzled/item/field.h>
26
class Item_cache: public Item_basic_constant
30
table_map used_table_map;
32
Field that this object will get value from. This is set/used by
33
index-based subquery engines to detect and remove the equality injected
34
by IN->EXISTS transformation.
35
For all other uses of Item_cache, cached_field doesn't matter.
38
enum enum_field_types cached_field_type;
41
example(0), used_table_map(0), cached_field(0), cached_field_type(DRIZZLE_TYPE_VARCHAR)
46
Item_cache(enum_field_types field_type_arg):
47
example(0), used_table_map(0), cached_field(0), cached_field_type(field_type_arg)
53
void set_used_tables(table_map map) { used_table_map= map; }
55
virtual bool allocate(uint32_t)
57
virtual bool setup(Item *item)
60
max_length= item->max_length;
61
decimals= item->decimals;
62
collation.set(item->collation);
63
unsigned_flag= item->unsigned_flag;
64
if (item->type() == FIELD_ITEM)
65
cached_field= ((Item_field *)item)->field;
68
virtual void store(Item *)= 0;
69
enum Type type() const { return CACHE_ITEM; }
70
enum_field_types field_type() const { return cached_field_type; }
71
static Item_cache* get_cache(const Item *item);
72
table_map used_tables() const { return used_table_map; }
73
virtual void keep_array() {}
74
virtual void print(String *str, enum_query_type query_type);
75
bool eq_def(Field *field);
76
bool eq(const Item *item, bool) const
82
#endif /* DRIZZLED_ITEM_CACHE_H */