1
/* Copyright (C) 2000-2006 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
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
24
27
#include <drizzled/server_includes.h>
28
#include <drizzled/cached_item.h>
27
31
Create right type of Cached_item for an item.
30
Cached_item *new_Cached_item(Session *session, Item *item, bool use_result_field)
34
Cached_item *new_Cached_item(Session *session, Item *item,
35
bool use_result_field)
32
37
if (item->real_item()->type() == Item::FIELD_ITEM &&
33
38
!(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG))
65
70
Cached_item_str::Cached_item_str(Session *session, Item *arg)
66
:item(arg), value(cmin(arg->max_length, (uint32_t)session->variables.max_sort_length))
71
:item(arg), value(cmin(arg->max_length,
72
(uint32_t)session->variables.max_sort_length))
69
75
bool Cached_item_str::cmp(void)
77
83
if (null_value != item->null_value)
79
85
if ((null_value= item->null_value))
80
return(true); // New value was null
83
90
else if (null_value)
84
return(0); // new and old value was null
91
// new and old value was null
86
94
tmp= sortcmp(&value,res,item->collation.collation) != 0;
88
value.copy(*res); // Remember for next cmp
96
// Remember for next cmp
92
101
Cached_item_str::~Cached_item_str()
97
107
bool Cached_item_real::cmp(void)
122
132
bool Cached_item_field::cmp(void)
124
bool tmp= field->cmp(buff) != 0; // This is not a blob!
134
// This is not a blob!
135
bool tmp= field->cmp(buff) != 0;
126
138
field->get_image(buff,length,field->charset());
127
139
if (null_value != field->is_null())
163
/*****************************************************************************
164
** Instansiate templates
165
*****************************************************************************/
167
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
168
template class List<Cached_item>;
169
template class List_iterator<Cached_item>;