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
22
#include <drizzled/error.h>
23
#include <drizzled/table.h>
24
#include <drizzled/session.h>
26
#include <drizzled/item/cache_row.h>
31
void Item_cache_row::make_field(SendField *)
33
illegal_method_call((const char*)"make_field");
37
double Item_cache_row::val_real()
39
illegal_method_call((const char*)"val");
44
int64_t Item_cache_row::val_int()
46
illegal_method_call((const char*)"val_int");
51
String *Item_cache_row::val_str(String *)
53
illegal_method_call((const char*)"val_str");
58
my_decimal *Item_cache_row::val_decimal(my_decimal *)
60
illegal_method_call((const char*)"val_decimal");
65
enum Item_result Item_cache_row::result_type() const
71
uint32_t Item_cache_row::cols()
77
Item *Item_cache_row::element_index(uint32_t i)
83
Item **Item_cache_row::addr(uint32_t i)
85
return (Item **) (values + i);
89
bool Item_cache_row::allocate(uint32_t num)
92
Session *session= current_session;
94
(Item_cache **) session->calloc(sizeof(Item_cache *)*item_count)));
98
bool Item_cache_row::setup(Item * item)
101
if (!values && allocate(item->cols()))
103
for (uint32_t i= 0; i < item_count; i++)
105
Item *el= item->element_index(i);
107
if (!(tmp= values[i]= Item_cache::get_cache(el)))
115
void Item_cache_row::store(Item * item)
119
for (uint32_t i= 0; i < item_count; i++)
121
values[i]->store(item->element_index(i));
122
null_value|= values[i]->null_value;
127
void Item_cache_row::illegal_method_call(const char *)
130
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
135
bool Item_cache_row::check_cols(uint32_t c)
139
my_error(ER_OPERAND_COLUMNS, MYF(0), c);
146
bool Item_cache_row::null_inside()
148
for (uint32_t i= 0; i < item_count; i++)
150
if (values[i]->cols() > 1)
152
if (values[i]->null_inside())
157
values[i]->update_null_value();
158
if (values[i]->null_value)
166
void Item_cache_row::bring_value()
168
for (uint32_t i= 0; i < item_count; i++)
169
values[i]->bring_value();
174
void Item_cache_row::keep_array()
180
void Item_cache_row::cleanup()
182
Item_cache::cleanup();
184
memset(values, 0, item_count*sizeof(Item**));
191
} /* namespace drizzled */