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
#include <drizzled/server_includes.h>
21
#include <drizzled/error.h>
23
#include <drizzled/item/cache_row.h>
26
void Item_cache_row::make_field(Send_field *)
28
illegal_method_call((const char*)"make_field");
32
double Item_cache_row::val_real()
34
illegal_method_call((const char*)"val");
39
int64_t Item_cache_row::val_int()
41
illegal_method_call((const char*)"val_int");
46
String *Item_cache_row::val_str(String *)
48
illegal_method_call((const char*)"val_str");
53
my_decimal *Item_cache_row::val_decimal(my_decimal *)
55
illegal_method_call((const char*)"val_decimal");
60
enum Item_result Item_cache_row::result_type() const
66
uint32_t Item_cache_row::cols()
72
Item *Item_cache_row::element_index(uint32_t i)
78
Item **Item_cache_row::addr(uint32_t i)
80
return (Item **) (values + i);
84
bool Item_cache_row::allocate(uint32_t num)
87
Session *session= current_session;
89
(Item_cache **) session->calloc(sizeof(Item_cache *)*item_count)));
93
bool Item_cache_row::setup(Item * item)
96
if (!values && allocate(item->cols()))
98
for (uint32_t i= 0; i < item_count; i++)
100
Item *el= item->element_index(i);
102
if (!(tmp= values[i]= Item_cache::get_cache(el)))
110
void Item_cache_row::store(Item * item)
114
for (uint32_t i= 0; i < item_count; i++)
116
values[i]->store(item->element_index(i));
117
null_value|= values[i]->null_value;
122
void Item_cache_row::illegal_method_call(const char *)
125
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
130
bool Item_cache_row::check_cols(uint32_t c)
134
my_error(ER_OPERAND_COLUMNS, MYF(0), c);
141
bool Item_cache_row::null_inside()
143
for (uint32_t i= 0; i < item_count; i++)
145
if (values[i]->cols() > 1)
147
if (values[i]->null_inside())
152
values[i]->update_null_value();
153
if (values[i]->null_value)
161
void Item_cache_row::bring_value()
163
for (uint32_t i= 0; i < item_count; i++)
164
values[i]->bring_value();
169
void Item_cache_row::keep_array()
175
void Item_cache_row::cleanup()
177
Item_cache::cleanup();
179
memset(values, 0, item_count*sizeof(Item**));