584.4.5
by Monty Taylor
Split out cache_row and type_holder. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
|
584.4.5
by Monty Taylor
Split out cache_row and type_holder. |
5 |
*
|
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.
|
|
9 |
*
|
|
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.
|
|
14 |
*
|
|
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
|
|
18 |
*/
|
|
1
by brian
clean slate |
19 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
20 |
#include <config.h> |
21 |
#include <drizzled/sql_select.h> |
|
22 |
#include <drizzled/error.h> |
|
23 |
#include <drizzled/show.h> |
|
24 |
#include <drizzled/item/cmpfunc.h> |
|
25 |
#include <drizzled/item/cache_row.h> |
|
26 |
#include <drizzled/item/type_holder.h> |
|
27 |
#include <drizzled/item/sum.h> |
|
28 |
#include <drizzled/item/copy_string.h> |
|
29 |
#include <drizzled/function/str/conv_charset.h> |
|
30 |
#include <drizzled/sql_base.h> |
|
31 |
#include <drizzled/util/convert.h> |
|
32 |
#include <drizzled/plugin/client.h> |
|
33 |
#include <drizzled/time_functions.h> |
|
34 |
||
35 |
#include <drizzled/field/str.h> |
|
36 |
#include <drizzled/field/num.h> |
|
37 |
||
38 |
#include <drizzled/field/blob.h> |
|
39 |
#include <drizzled/field/date.h> |
|
40 |
#include <drizzled/field/datetime.h> |
|
41 |
#include <drizzled/field/decimal.h> |
|
42 |
#include <drizzled/field/double.h> |
|
43 |
#include <drizzled/field/enum.h> |
|
44 |
#include <drizzled/field/epoch.h> |
|
45 |
#include <drizzled/field/int32.h> |
|
46 |
#include <drizzled/field/int64.h> |
|
47 |
#include <drizzled/field/microtime.h> |
|
48 |
#include <drizzled/field/null.h> |
|
49 |
#include <drizzled/field/real.h> |
|
50 |
#include <drizzled/field/size.h> |
|
51 |
#include <drizzled/field/time.h> |
|
52 |
#include <drizzled/field/varstring.h> |
|
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
53 |
|
2154.2.24
by Brian Aker
Merge in all changes for current_session, etc. |
54 |
#include <drizzled/current_session.h> |
2154.2.18
by Brian Aker
Merge in all changes for include files. |
55 |
#include <drizzled/session.h> |
56 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
57 |
#include <drizzled/internal/m_string.h> |
584.5.1
by Monty Taylor
Removed field includes from field.h. |
58 |
|
1502.3.1
by iwamatsu at nigauri
Add cstdio include to files needing it. Fixes the build on some debian |
59 |
#include <cstdio> |
919.2.11
by Monty Taylor
Removed C99 isnan() usage, which allows us to remove the util/math.{cc,h} workarounds. Yay for standards! |
60 |
#include <math.h> |
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
61 |
#include <algorithm> |
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
62 |
#include <float.h> |
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
63 |
|
64 |
using namespace std; |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
65 |
|
66 |
namespace drizzled |
|
67 |
{
|
|
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
68 |
|
1
by brian
clean slate |
69 |
const String my_null_string("NULL", 4, default_charset_info); |
70 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
71 |
bool Item::is_expensive_processor(unsigned char *) |
72 |
{
|
|
681
by Brian Aker
Style cleanup |
73 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
74 |
}
|
75 |
||
846
by Brian Aker
Removing on typedeffed class. |
76 |
void Item::fix_after_pullout(Select_Lex *, Item **) |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
77 |
{}
|
78 |
||
79 |
Field *Item::tmp_table_field(Table *) |
|
80 |
{
|
|
681
by Brian Aker
Style cleanup |
81 |
return NULL; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
82 |
}
|
83 |
||
84 |
const char *Item::full_name(void) const |
|
85 |
{
|
|
86 |
return name ? name : "???"; |
|
87 |
}
|
|
88 |
||
89 |
int64_t Item::val_int_endpoint(bool, bool *) |
|
90 |
{
|
|
91 |
assert(0); |
|
92 |
return 0; |
|
93 |
}
|
|
94 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
95 |
/** @todo Make this functions class dependent */
|
1
by brian
clean slate |
96 |
bool Item::val_bool() |
97 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
98 |
switch(result_type()) |
1
by brian
clean slate |
99 |
{
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
100 |
case INT_RESULT: |
101 |
return val_int() != 0; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
102 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
103 |
case DECIMAL_RESULT: |
104 |
{
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
105 |
type::Decimal decimal_value; |
106 |
type::Decimal *val= val_decimal(&decimal_value); |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
107 |
if (val) |
2137.1.5
by Brian Aker
Additional decimal. |
108 |
return not val->isZero(); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
109 |
return false; |
110 |
}
|
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
111 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
112 |
case REAL_RESULT: |
113 |
case STRING_RESULT: |
|
114 |
return val_real() != 0.0; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
115 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
116 |
case ROW_RESULT: |
117 |
assert(0); |
|
1996.2.1
by Brian Aker
uuid type code. |
118 |
abort(); |
1
by brian
clean slate |
119 |
}
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
120 |
|
121 |
assert(0); |
|
122 |
abort(); |
|
1
by brian
clean slate |
123 |
}
|
124 |
||
125 |
String *Item::val_string_from_real(String *str) |
|
126 |
{
|
|
127 |
double nr= val_real(); |
|
128 |
if (null_value) |
|
971.6.11
by Eric Day
Removed purecov messages. |
129 |
return NULL; |
681
by Brian Aker
Style cleanup |
130 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
131 |
str->set_real(nr, decimals, &my_charset_bin); |
1
by brian
clean slate |
132 |
return str; |
133 |
}
|
|
134 |
||
135 |
String *Item::val_string_from_int(String *str) |
|
136 |
{
|
|
152
by Brian Aker
longlong replacement |
137 |
int64_t nr= val_int(); |
1
by brian
clean slate |
138 |
if (null_value) |
681
by Brian Aker
Style cleanup |
139 |
return NULL; |
140 |
||
1
by brian
clean slate |
141 |
str->set_int(nr, unsigned_flag, &my_charset_bin); |
142 |
return str; |
|
143 |
}
|
|
144 |
||
145 |
String *Item::val_string_from_decimal(String *str) |
|
146 |
{
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
147 |
type::Decimal dec_buf, *dec= val_decimal(&dec_buf); |
1
by brian
clean slate |
148 |
if (null_value) |
681
by Brian Aker
Style cleanup |
149 |
return NULL; |
150 |
||
2030.1.2
by Brian Aker
First pass in refactoring of the name of my_decimal. |
151 |
class_decimal_round(E_DEC_FATAL_ERROR, dec, decimals, false, &dec_buf); |
2137.1.8
by Brian Aker
Remove error type from str convert since we always want an error. |
152 |
class_decimal2string(&dec_buf, 0, str); |
1
by brian
clean slate |
153 |
return str; |
154 |
}
|
|
155 |
||
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
156 |
type::Decimal *Item::val_decimal_from_real(type::Decimal *decimal_value) |
1
by brian
clean slate |
157 |
{
|
158 |
double nr= val_real(); |
|
159 |
if (null_value) |
|
681
by Brian Aker
Style cleanup |
160 |
return NULL; |
161 |
||
2030.1.3
by Brian Aker
Second pass through function names. |
162 |
double2_class_decimal(E_DEC_FATAL_ERROR, nr, decimal_value); |
1
by brian
clean slate |
163 |
return (decimal_value); |
164 |
}
|
|
165 |
||
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
166 |
type::Decimal *Item::val_decimal_from_int(type::Decimal *decimal_value) |
1
by brian
clean slate |
167 |
{
|
152
by Brian Aker
longlong replacement |
168 |
int64_t nr= val_int(); |
1
by brian
clean slate |
169 |
if (null_value) |
681
by Brian Aker
Style cleanup |
170 |
return NULL; |
171 |
||
2030.1.3
by Brian Aker
Second pass through function names. |
172 |
int2_class_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value); |
1
by brian
clean slate |
173 |
return decimal_value; |
174 |
}
|
|
175 |
||
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
176 |
type::Decimal *Item::val_decimal_from_string(type::Decimal *decimal_value) |
1
by brian
clean slate |
177 |
{
|
178 |
String *res; |
|
179 |
char *end_ptr; |
|
180 |
if (!(res= val_str(&str_value))) |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
181 |
return NULL; |
1
by brian
clean slate |
182 |
|
183 |
end_ptr= (char*) res->ptr()+ res->length(); |
|
2034.2.5
by Brian Aker
Improvement for decimal in encapsulation. |
184 |
if (decimal_value->store(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM, |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
185 |
res->ptr(), |
186 |
res->length(), |
|
2034.2.5
by Brian Aker
Improvement for decimal in encapsulation. |
187 |
res->charset()) & E_DEC_BAD_NUM) |
1
by brian
clean slate |
188 |
{
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
189 |
push_warning_printf(&getSession(), |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
190 |
DRIZZLE_ERROR::WARN_LEVEL_WARN, |
1
by brian
clean slate |
191 |
ER_TRUNCATED_WRONG_VALUE, |
192 |
ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL", |
|
193 |
str_value.c_ptr()); |
|
194 |
}
|
|
195 |
return decimal_value; |
|
196 |
}
|
|
197 |
||
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
198 |
type::Decimal *Item::val_decimal_from_date(type::Decimal *decimal_value) |
1
by brian
clean slate |
199 |
{
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
200 |
assert(fixed); |
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
201 |
type::Time ltime; |
2104.2.8
by Brian Aker
Merge in reference from pointer. |
202 |
if (get_date(ltime, TIME_FUZZY_DATE)) |
1
by brian
clean slate |
203 |
{
|
2034.2.4
by Brian Aker
Further encapsulation for DECIMAL. |
204 |
decimal_value->set_zero(); |
1
by brian
clean slate |
205 |
null_value= 1; // set NULL, stop processing |
681
by Brian Aker
Style cleanup |
206 |
return NULL; |
1
by brian
clean slate |
207 |
}
|
2030.1.3
by Brian Aker
Second pass through function names. |
208 |
return date2_class_decimal(<ime, decimal_value); |
1
by brian
clean slate |
209 |
}
|
210 |
||
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
211 |
type::Decimal *Item::val_decimal_from_time(type::Decimal *decimal_value) |
1
by brian
clean slate |
212 |
{
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
213 |
assert(fixed); |
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
214 |
type::Time ltime; |
2104.2.8
by Brian Aker
Merge in reference from pointer. |
215 |
if (get_time(ltime)) |
1
by brian
clean slate |
216 |
{
|
2034.2.4
by Brian Aker
Further encapsulation for DECIMAL. |
217 |
decimal_value->set_zero(); |
681
by Brian Aker
Style cleanup |
218 |
return NULL; |
1
by brian
clean slate |
219 |
}
|
2030.1.3
by Brian Aker
Second pass through function names. |
220 |
return date2_class_decimal(<ime, decimal_value); |
1
by brian
clean slate |
221 |
}
|
222 |
||
223 |
double Item::val_real_from_decimal() |
|
224 |
{
|
|
225 |
/* Note that fix_fields may not be called for Item_avg_field items */
|
|
226 |
double result; |
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
227 |
type::Decimal value_buff, *dec_val= val_decimal(&value_buff); |
1
by brian
clean slate |
228 |
if (null_value) |
229 |
return 0.0; |
|
2030.1.3
by Brian Aker
Second pass through function names. |
230 |
class_decimal2double(E_DEC_FATAL_ERROR, dec_val, &result); |
1
by brian
clean slate |
231 |
return result; |
232 |
}
|
|
233 |
||
152
by Brian Aker
longlong replacement |
234 |
int64_t Item::val_int_from_decimal() |
1
by brian
clean slate |
235 |
{
|
236 |
/* Note that fix_fields may not be called for Item_avg_field items */
|
|
152
by Brian Aker
longlong replacement |
237 |
int64_t result; |
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
238 |
type::Decimal value, *dec_val= val_decimal(&value); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
239 |
|
1
by brian
clean slate |
240 |
if (null_value) |
241 |
return 0; |
|
2034.2.1
by Brian Aker
Move class_decimal2int to a method on Decimal. |
242 |
dec_val->val_int32(E_DEC_FATAL_ERROR, unsigned_flag, &result); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
243 |
|
1
by brian
clean slate |
244 |
return result; |
245 |
}
|
|
246 |
||
2126.3.1
by Brian Aker
Add bool int patch |
247 |
bool Item::save_time_in_field(Field *field) |
1
by brian
clean slate |
248 |
{
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
249 |
type::Time ltime; |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
250 |
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
251 |
if (get_time(ltime)) |
1
by brian
clean slate |
252 |
return set_field_to_null(field); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
253 |
|
1
by brian
clean slate |
254 |
field->set_notnull(); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
255 |
|
256 |
return field->store_time(ltime, type::DRIZZLE_TIMESTAMP_TIME); |
|
1
by brian
clean slate |
257 |
}
|
258 |
||
2126.3.1
by Brian Aker
Add bool int patch |
259 |
bool Item::save_date_in_field(Field *field) |
1
by brian
clean slate |
260 |
{
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
261 |
type::Time ltime; |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
262 |
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
263 |
if (get_date(ltime, TIME_FUZZY_DATE)) |
1
by brian
clean slate |
264 |
return set_field_to_null(field); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
265 |
|
1
by brian
clean slate |
266 |
field->set_notnull(); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
267 |
|
268 |
return field->store_time(ltime, type::DRIZZLE_TIMESTAMP_DATETIME); |
|
1
by brian
clean slate |
269 |
}
|
270 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
271 |
/**
|
272 |
* Check if the Item is null and stores the NULL or the
|
|
273 |
* result value in the field accordingly.
|
|
274 |
*/
|
|
1
by brian
clean slate |
275 |
int Item::save_str_value_in_field(Field *field, String *result) |
276 |
{
|
|
277 |
if (null_value) |
|
278 |
return set_field_to_null(field); |
|
2104.2.7
by Brian Aker
Fix store_time to take reference. |
279 |
|
1
by brian
clean slate |
280 |
field->set_notnull(); |
2104.2.7
by Brian Aker
Fix store_time to take reference. |
281 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
282 |
return field->store(result->ptr(), result->length(), collation.collation); |
1
by brian
clean slate |
283 |
}
|
284 |
||
285 |
Item::Item(): |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
286 |
is_expensive_cache(-1), |
287 |
name(0), |
|
288 |
name_length(0), |
|
289 |
orig_name(0), |
|
290 |
max_length(0), |
|
291 |
marker(0), |
|
292 |
decimals(0), |
|
293 |
fixed(false), |
|
294 |
maybe_null(false), |
|
295 |
null_value(false), |
|
296 |
unsigned_flag(false), |
|
297 |
with_sum_func(false), |
|
298 |
is_autogenerated_name(true), |
|
299 |
with_subselect(false), |
|
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
300 |
collation(&my_charset_bin, DERIVATION_COERCIBLE), |
301 |
_session(*current_session) |
|
1
by brian
clean slate |
302 |
{
|
303 |
cmp_context= (Item_result)-1; |
|
304 |
||
305 |
/* Put item in free list so that we can free all items at end */
|
|
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
306 |
next= getSession().free_list; |
307 |
getSession().free_list= this; |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
308 |
|
1
by brian
clean slate |
309 |
/*
|
310 |
Item constructor can be called during execution other then SQL_COM
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
311 |
command => we should check session->lex->current_select on zero (session->lex
|
1
by brian
clean slate |
312 |
can be uninitialised)
|
313 |
*/
|
|
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
314 |
if (getSession().lex->current_select) |
1
by brian
clean slate |
315 |
{
|
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
316 |
enum_parsing_place place= getSession().getLex()->current_select->parsing_place; |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
317 |
if (place == SELECT_LIST || place == IN_HAVING) |
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
318 |
getSession().getLex()->current_select->select_n_having_items++; |
1
by brian
clean slate |
319 |
}
|
320 |
}
|
|
321 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
322 |
Item::Item(Session *session, Item *item): |
1
by brian
clean slate |
323 |
is_expensive_cache(-1), |
324 |
str_value(item->str_value), |
|
325 |
name(item->name), |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
326 |
name_length(item->name_length), |
1
by brian
clean slate |
327 |
orig_name(item->orig_name), |
328 |
max_length(item->max_length), |
|
329 |
marker(item->marker), |
|
330 |
decimals(item->decimals), |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
331 |
fixed(item->fixed), |
1
by brian
clean slate |
332 |
maybe_null(item->maybe_null), |
333 |
null_value(item->null_value), |
|
334 |
unsigned_flag(item->unsigned_flag), |
|
335 |
with_sum_func(item->with_sum_func), |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
336 |
is_autogenerated_name(item->is_autogenerated_name), |
337 |
with_subselect(item->with_subselect), |
|
1
by brian
clean slate |
338 |
collation(item->collation), |
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
339 |
cmp_context(item->cmp_context), |
340 |
_session(*session) |
|
1
by brian
clean slate |
341 |
{
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
342 |
/* Put this item in the session's free list */
|
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
343 |
next= getSession().free_list; |
344 |
getSession().free_list= this; |
|
1
by brian
clean slate |
345 |
}
|
346 |
||
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
347 |
uint32_t Item::float_length(uint32_t decimals_par) const |
348 |
{
|
|
349 |
return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8; |
|
350 |
}
|
|
351 |
||
482
by Brian Aker
Remove uint. |
352 |
uint32_t Item::decimal_precision() const |
1
by brian
clean slate |
353 |
{
|
354 |
Item_result restype= result_type(); |
|
355 |
||
356 |
if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT)) |
|
2030.1.2
by Brian Aker
First pass in refactoring of the name of my_decimal. |
357 |
return min(class_decimal_length_to_precision(max_length, decimals, unsigned_flag), |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
358 |
(uint32_t) DECIMAL_MAX_PRECISION); |
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
359 |
return min(max_length, (uint32_t) DECIMAL_MAX_PRECISION); |
1
by brian
clean slate |
360 |
}
|
361 |
||
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
362 |
int Item::decimal_int_part() const |
363 |
{
|
|
2030.1.2
by Brian Aker
First pass in refactoring of the name of my_decimal. |
364 |
return class_decimal_int_part(decimal_precision(), decimals); |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
365 |
}
|
366 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
367 |
void Item::print(String *str, enum_query_type) |
368 |
{
|
|
369 |
str->append(full_name()); |
|
370 |
}
|
|
371 |
||
1
by brian
clean slate |
372 |
void Item::print_item_w_name(String *str, enum_query_type query_type) |
373 |
{
|
|
374 |
print(str, query_type); |
|
375 |
||
376 |
if (name) |
|
377 |
{
|
|
378 |
str->append(STRING_WITH_LEN(" AS ")); |
|
895
by Brian Aker
Completion (?) of uint conversion. |
379 |
str->append_identifier(name, (uint32_t) strlen(name)); |
1
by brian
clean slate |
380 |
}
|
381 |
}
|
|
382 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
383 |
void Item::split_sum_func(Session *, Item **, List<Item> &) |
384 |
{}
|
|
385 |
||
1
by brian
clean slate |
386 |
void Item::cleanup() |
387 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
388 |
fixed= false; |
1
by brian
clean slate |
389 |
marker= 0; |
390 |
if (orig_name) |
|
391 |
name= orig_name; |
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
392 |
return; |
1
by brian
clean slate |
393 |
}
|
394 |
||
395 |
void Item::rename(char *new_name) |
|
396 |
{
|
|
397 |
/*
|
|
398 |
we can compare pointers to names here, because if name was not changed,
|
|
399 |
pointer will be same
|
|
400 |
*/
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
401 |
if (! orig_name && new_name != name) |
1
by brian
clean slate |
402 |
orig_name= name; |
403 |
name= new_name; |
|
404 |
}
|
|
405 |
||
481
by Brian Aker
Remove all of uchar. |
406 |
Item* Item::transform(Item_transformer transformer, unsigned char *arg) |
1
by brian
clean slate |
407 |
{
|
408 |
return (this->*transformer)(arg); |
|
409 |
}
|
|
410 |
||
482
by Brian Aker
Remove uint. |
411 |
bool Item::check_cols(uint32_t c) |
1
by brian
clean slate |
412 |
{
|
413 |
if (c != 1) |
|
414 |
{
|
|
415 |
my_error(ER_OPERAND_COLUMNS, MYF(0), c); |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
416 |
return true; |
1
by brian
clean slate |
417 |
}
|
681
by Brian Aker
Style cleanup |
418 |
return false; |
1
by brian
clean slate |
419 |
}
|
420 |
||
482
by Brian Aker
Remove uint. |
421 |
void Item::set_name(const char *str, uint32_t length, const CHARSET_INFO * const cs) |
1
by brian
clean slate |
422 |
{
|
423 |
if (!length) |
|
424 |
{
|
|
425 |
/* Empty string, used by AS or internal function like last_insert_id() */
|
|
426 |
name= (char*) str; |
|
427 |
name_length= 0; |
|
428 |
return; |
|
429 |
}
|
|
430 |
if (cs->ctype) |
|
431 |
{
|
|
482
by Brian Aker
Remove uint. |
432 |
uint32_t orig_len= length; |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
433 |
while (length && ! my_isgraph(cs, *str)) |
434 |
{
|
|
435 |
/* Fix problem with yacc */
|
|
1
by brian
clean slate |
436 |
length--; |
437 |
str++; |
|
438 |
}
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
439 |
if (orig_len != length && ! is_autogenerated_name) |
1
by brian
clean slate |
440 |
{
|
441 |
if (length == 0) |
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
442 |
push_warning_printf(&getSession(), |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
443 |
DRIZZLE_ERROR::WARN_LEVEL_WARN, |
444 |
ER_NAME_BECOMES_EMPTY, |
|
445 |
ER(ER_NAME_BECOMES_EMPTY), |
|
1
by brian
clean slate |
446 |
str + length - orig_len); |
447 |
else
|
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
448 |
push_warning_printf(&getSession(), |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
449 |
DRIZZLE_ERROR::WARN_LEVEL_WARN, |
450 |
ER_REMOVED_SPACES, |
|
451 |
ER(ER_REMOVED_SPACES), |
|
1
by brian
clean slate |
452 |
str + length - orig_len); |
453 |
}
|
|
454 |
}
|
|
1253.1.6
by Monty Taylor
Moved mem_root functions into drizzled::memory:: namespace. |
455 |
name= memory::sql_strmake(str, length); |
1
by brian
clean slate |
456 |
}
|
457 |
||
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
458 |
bool Item::eq(const Item *item, bool) const |
1
by brian
clean slate |
459 |
{
|
460 |
/*
|
|
56
by brian
Next pass of true/false update. |
461 |
Note, that this is never true if item is a Item_param:
|
1
by brian
clean slate |
462 |
for all basic constants we have special checks, and Item_param's
|
463 |
type() can be only among basic constant types.
|
|
464 |
*/
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
465 |
return type() == item->type() && |
466 |
name && |
|
467 |
item->name && |
|
468 |
! my_strcasecmp(system_charset_info, name, item->name); |
|
1
by brian
clean slate |
469 |
}
|
470 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
471 |
Item *Item::safe_charset_converter(const CHARSET_INFO * const tocs) |
1
by brian
clean slate |
472 |
{
|
473 |
Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1); |
|
474 |
return conv->safe ? conv : NULL; |
|
475 |
}
|
|
476 |
||
2104.2.8
by Brian Aker
Merge in reference from pointer. |
477 |
bool Item::get_date(type::Time <ime,uint32_t fuzzydate) |
1
by brian
clean slate |
478 |
{
|
2088.8.7
by Brian Aker
Merge in goto removal. |
479 |
do
|
480 |
{
|
|
2114.5.1
by Brian Aker
Additional abstract around time (this also makes the abort_on_warnings in |
481 |
if (is_null()) |
482 |
{
|
|
483 |
break; |
|
484 |
}
|
|
485 |
else if (result_type() == STRING_RESULT) |
|
2088.8.7
by Brian Aker
Merge in goto removal. |
486 |
{
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
487 |
char buff[type::Time::MAX_STRING_LENGTH]; |
2088.8.7
by Brian Aker
Merge in goto removal. |
488 |
String tmp(buff,sizeof(buff), &my_charset_bin),*res; |
489 |
if (!(res=val_str(&tmp)) || |
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
490 |
str_to_datetime_with_warn(&getSession(), res->ptr(), res->length(), |
2104.2.8
by Brian Aker
Merge in reference from pointer. |
491 |
<ime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR) |
2088.8.7
by Brian Aker
Merge in goto removal. |
492 |
{
|
493 |
break; |
|
494 |
}
|
|
495 |
}
|
|
496 |
else
|
|
497 |
{
|
|
498 |
int64_t value= val_int(); |
|
2098.3.3
by Brian Aker
Isolate out the time code/conversion. |
499 |
type::datetime_t date_value; |
2104.2.6
by Brian Aker
Enum was_cut |
500 |
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
501 |
ltime.convert(date_value, value, fuzzydate); |
2104.2.6
by Brian Aker
Enum was_cut |
502 |
|
2098.3.3
by Brian Aker
Isolate out the time code/conversion. |
503 |
if (not type::is_valid(date_value)) |
2088.8.7
by Brian Aker
Merge in goto removal. |
504 |
{
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
505 |
char buff[DECIMAL_LONGLONG_DIGITS], *end; |
2088.8.7
by Brian Aker
Merge in goto removal. |
506 |
end= internal::int64_t10_to_str(value, buff, -10); |
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
507 |
make_truncated_value_warning(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN, |
2088.8.9
by Brian Aker
Merge in namespace of enum. |
508 |
buff, (int) (end-buff), type::DRIZZLE_TIMESTAMP_NONE, NULL); |
2088.8.7
by Brian Aker
Merge in goto removal. |
509 |
break; |
510 |
}
|
|
511 |
}
|
|
512 |
||
513 |
return false; |
|
514 |
} while (0); |
|
515 |
||
2104.2.8
by Brian Aker
Merge in reference from pointer. |
516 |
ltime.reset(); |
2088.8.7
by Brian Aker
Merge in goto removal. |
517 |
|
681
by Brian Aker
Style cleanup |
518 |
return true; |
1
by brian
clean slate |
519 |
}
|
520 |
||
2104.2.8
by Brian Aker
Merge in reference from pointer. |
521 |
bool Item::get_time(type::Time <ime) |
1
by brian
clean slate |
522 |
{
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
523 |
char buff[type::Time::MAX_STRING_LENGTH]; |
1
by brian
clean slate |
524 |
String tmp(buff,sizeof(buff),&my_charset_bin),*res; |
2137.1.9
by Brian Aker
Remove current_session usage in one location (we have the table's session to |
525 |
if (!(res=val_str(&tmp)) or |
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
526 |
str_to_time_with_warn(&getSession(), res->ptr(), res->length(), <ime)) |
1
by brian
clean slate |
527 |
{
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
528 |
ltime.reset(); |
2088.8.7
by Brian Aker
Merge in goto removal. |
529 |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
530 |
return true; |
1
by brian
clean slate |
531 |
}
|
2088.8.7
by Brian Aker
Merge in goto removal. |
532 |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
533 |
return false; |
534 |
}
|
|
535 |
||
2104.2.8
by Brian Aker
Merge in reference from pointer. |
536 |
bool Item::get_date_result(type::Time <ime,uint32_t fuzzydate) |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
537 |
{
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
538 |
return get_date(ltime, fuzzydate); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
539 |
}
|
540 |
||
541 |
bool Item::is_null() |
|
542 |
{
|
|
543 |
return false; |
|
544 |
}
|
|
545 |
||
546 |
void Item::update_null_value () |
|
547 |
{
|
|
548 |
(void) val_int(); |
|
549 |
}
|
|
550 |
||
551 |
void Item::top_level_item(void) |
|
552 |
{}
|
|
553 |
||
554 |
void Item::set_result_field(Field *) |
|
555 |
{}
|
|
556 |
||
557 |
bool Item::is_result_field(void) |
|
558 |
{
|
|
681
by Brian Aker
Style cleanup |
559 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
560 |
}
|
561 |
||
562 |
bool Item::is_bool_func(void) |
|
563 |
{
|
|
681
by Brian Aker
Style cleanup |
564 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
565 |
}
|
566 |
||
567 |
void Item::save_in_result_field(bool) |
|
568 |
{}
|
|
569 |
||
570 |
void Item::no_rows_in_result(void) |
|
571 |
{}
|
|
572 |
||
573 |
Item *Item::copy_or_same(Session *) |
|
574 |
{
|
|
575 |
return this; |
|
576 |
}
|
|
577 |
||
578 |
Item *Item::copy_andor_structure(Session *) |
|
579 |
{
|
|
580 |
return this; |
|
581 |
}
|
|
582 |
||
583 |
Item *Item::real_item(void) |
|
584 |
{
|
|
585 |
return this; |
|
586 |
}
|
|
587 |
||
779.3.10
by Monty Taylor
Turned on -Wshadow. |
588 |
const Item *Item::real_item(void) const |
589 |
{
|
|
590 |
return this; |
|
591 |
}
|
|
592 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
593 |
Item *Item::get_tmp_table_item(Session *session) |
594 |
{
|
|
595 |
return copy_or_same(session); |
|
596 |
}
|
|
597 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
598 |
const CHARSET_INFO *Item::default_charset() |
1
by brian
clean slate |
599 |
{
|
748
by Brian Aker
Removal of client side collation. |
600 |
return current_session->variables.getCollation(); |
1
by brian
clean slate |
601 |
}
|
602 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
603 |
const CHARSET_INFO *Item::compare_collation() |
604 |
{
|
|
605 |
return NULL; |
|
606 |
}
|
|
607 |
||
608 |
bool Item::walk(Item_processor processor, bool, unsigned char *arg) |
|
609 |
{
|
|
610 |
return (this->*processor)(arg); |
|
611 |
}
|
|
612 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
613 |
Item* Item::compile(Item_analyzer analyzer, |
614 |
unsigned char **arg_p, |
|
615 |
Item_transformer transformer, |
|
616 |
unsigned char *arg_t) |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
617 |
{
|
618 |
if ((this->*analyzer) (arg_p)) |
|
619 |
return ((this->*transformer) (arg_t)); |
|
681
by Brian Aker
Style cleanup |
620 |
return NULL; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
621 |
}
|
622 |
||
623 |
void Item::traverse_cond(Cond_traverser traverser, void *arg, traverse_order) |
|
624 |
{
|
|
625 |
(*traverser)(this, arg); |
|
626 |
}
|
|
627 |
||
628 |
bool Item::remove_dependence_processor(unsigned char *) |
|
629 |
{
|
|
681
by Brian Aker
Style cleanup |
630 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
631 |
}
|
632 |
||
633 |
bool Item::remove_fixed(unsigned char *) |
|
634 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
635 |
fixed= false; |
681
by Brian Aker
Style cleanup |
636 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
637 |
}
|
638 |
||
639 |
bool Item::collect_item_field_processor(unsigned char *) |
|
640 |
{
|
|
681
by Brian Aker
Style cleanup |
641 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
642 |
}
|
643 |
||
644 |
bool Item::find_item_in_field_list_processor(unsigned char *) |
|
645 |
{
|
|
681
by Brian Aker
Style cleanup |
646 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
647 |
}
|
648 |
||
649 |
bool Item::change_context_processor(unsigned char *) |
|
650 |
{
|
|
681
by Brian Aker
Style cleanup |
651 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
652 |
}
|
653 |
||
654 |
bool Item::register_field_in_read_map(unsigned char *) |
|
655 |
{
|
|
681
by Brian Aker
Style cleanup |
656 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
657 |
}
|
658 |
||
659 |
bool Item::subst_argument_checker(unsigned char **arg) |
|
660 |
{
|
|
661 |
if (*arg) |
|
662 |
*arg= NULL; |
|
663 |
return true; |
|
664 |
}
|
|
665 |
||
666 |
Item *Item::equal_fields_propagator(unsigned char *) |
|
667 |
{
|
|
668 |
return this; |
|
669 |
}
|
|
670 |
||
671 |
bool Item::set_no_const_sub(unsigned char *) |
|
672 |
{
|
|
673 |
return false; |
|
674 |
}
|
|
675 |
||
676 |
Item *Item::replace_equal_field(unsigned char *) |
|
677 |
{
|
|
678 |
return this; |
|
679 |
}
|
|
680 |
||
681 |
uint32_t Item::cols() |
|
682 |
{
|
|
683 |
return 1; |
|
684 |
}
|
|
685 |
||
686 |
Item* Item::element_index(uint32_t) |
|
687 |
{
|
|
688 |
return this; |
|
689 |
}
|
|
690 |
||
691 |
Item** Item::addr(uint32_t) |
|
692 |
{
|
|
681
by Brian Aker
Style cleanup |
693 |
return NULL; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
694 |
}
|
695 |
||
696 |
bool Item::null_inside() |
|
697 |
{
|
|
681
by Brian Aker
Style cleanup |
698 |
return false; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
699 |
}
|
700 |
||
701 |
void Item::bring_value() |
|
702 |
{}
|
|
703 |
||
704 |
Item *Item::neg_transformer(Session *) |
|
705 |
{
|
|
706 |
return NULL; |
|
707 |
}
|
|
708 |
||
709 |
Item *Item::update_value_transformer(unsigned char *) |
|
710 |
{
|
|
711 |
return this; |
|
712 |
}
|
|
713 |
||
714 |
void Item::delete_self() |
|
715 |
{
|
|
716 |
cleanup(); |
|
717 |
delete this; |
|
718 |
}
|
|
719 |
||
720 |
bool Item::result_as_int64_t() |
|
721 |
{
|
|
722 |
return false; |
|
723 |
}
|
|
724 |
||
725 |
bool Item::is_expensive() |
|
726 |
{
|
|
727 |
if (is_expensive_cache < 0) |
|
728 |
is_expensive_cache= walk(&Item::is_expensive_processor, 0, |
|
729 |
(unsigned char*)0); |
|
730 |
return test(is_expensive_cache); |
|
731 |
}
|
|
732 |
||
1
by brian
clean slate |
733 |
/*
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
734 |
need a special class to adjust printing : references to aggregate functions
|
1
by brian
clean slate |
735 |
must not be printed as refs because the aggregate functions that are added to
|
736 |
the front of select list are not printed as well.
|
|
737 |
*/
|
|
738 |
class Item_aggregate_ref : public Item_ref |
|
739 |
{
|
|
740 |
public: |
|
741 |
Item_aggregate_ref(Name_resolution_context *context_arg, Item **item, |
|
742 |
const char *table_name_arg, const char *field_name_arg) |
|
743 |
:Item_ref(context_arg, item, table_name_arg, field_name_arg) {} |
|
744 |
||
745 |
virtual inline void print (String *str, enum_query_type query_type) |
|
746 |
{
|
|
747 |
if (ref) |
|
748 |
(*ref)->print(str, query_type); |
|
749 |
else
|
|
750 |
Item_ident::print(str, query_type); |
|
751 |
}
|
|
752 |
};
|
|
753 |
||
584.4.9
by Monty Taylor
Renamed split_sum_func2 to split_sum_func. It's C++. |
754 |
void Item::split_sum_func(Session *session, Item **ref_pointer_array, |
755 |
List<Item> &fields, Item **ref, |
|
756 |
bool skip_registered) |
|
1
by brian
clean slate |
757 |
{
|
584.4.9
by Monty Taylor
Renamed split_sum_func2 to split_sum_func. It's C++. |
758 |
/* An item of type Item_sum is registered <=> ref_by != 0 */
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
759 |
if (type() == SUM_FUNC_ITEM && |
760 |
skip_registered && |
|
1
by brian
clean slate |
761 |
((Item_sum *) this)->ref_by) |
584.4.9
by Monty Taylor
Renamed split_sum_func2 to split_sum_func. It's C++. |
762 |
return; |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
763 |
|
1
by brian
clean slate |
764 |
if ((type() != SUM_FUNC_ITEM && with_sum_func) || |
765 |
(type() == FUNC_ITEM && |
|
766 |
(((Item_func *) this)->functype() == Item_func::ISNOTNULLTEST_FUNC || |
|
767 |
((Item_func *) this)->functype() == Item_func::TRIG_COND_FUNC))) |
|
768 |
{
|
|
769 |
/* Will split complicated items and ignore simple ones */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
770 |
split_sum_func(session, ref_pointer_array, fields); |
1
by brian
clean slate |
771 |
}
|
772 |
else if ((type() == SUM_FUNC_ITEM || (used_tables() & ~PARAM_TABLE_BIT)) && |
|
773 |
type() != SUBSELECT_ITEM && |
|
609
by Brian Aker
Dead class removal (more views) |
774 |
type() != REF_ITEM) |
1
by brian
clean slate |
775 |
{
|
776 |
/*
|
|
777 |
Replace item with a reference so that we can easily calculate
|
|
778 |
it (in case of sum functions) or copy it (in case of fields)
|
|
779 |
||
780 |
The test above is to ensure we don't do a reference for things
|
|
781 |
that are constants (PARAM_TABLE_BIT is in effect a constant)
|
|
782 |
or already referenced (for example an item in HAVING)
|
|
783 |
Exception is Item_direct_view_ref which we need to convert to
|
|
784 |
Item_ref to allow fields from view being stored in tmp table.
|
|
785 |
*/
|
|
786 |
Item_aggregate_ref *item_ref; |
|
482
by Brian Aker
Remove uint. |
787 |
uint32_t el= fields.elements; |
1
by brian
clean slate |
788 |
Item *real_itm= real_item(); |
789 |
||
790 |
ref_pointer_array[el]= real_itm; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
791 |
if (!(item_ref= new Item_aggregate_ref(&session->lex->current_select->context, |
1
by brian
clean slate |
792 |
ref_pointer_array + el, 0, name))) |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
793 |
return; /* fatal_error is set */ |
1
by brian
clean slate |
794 |
if (type() == SUM_FUNC_ITEM) |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
795 |
item_ref->depended_from= ((Item_sum *) this)->depended_from(); |
1
by brian
clean slate |
796 |
fields.push_front(real_itm); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
797 |
session->change_item_tree(ref, item_ref); |
1
by brian
clean slate |
798 |
}
|
799 |
}
|
|
800 |
||
801 |
/*
|
|
802 |
Functions to convert item to field (for send_fields)
|
|
803 |
*/
|
|
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
804 |
bool Item::fix_fields(Session *, Item **) |
1
by brian
clean slate |
805 |
{
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
806 |
/* We do not check fields which are fixed during construction */
|
807 |
assert(! fixed || basic_const_item()); |
|
808 |
fixed= true; |
|
56
by brian
Next pass of true/false update. |
809 |
return false; |
1
by brian
clean slate |
810 |
}
|
811 |
||
846
by Brian Aker
Removing on typedeffed class. |
812 |
void mark_as_dependent(Session *session, Select_Lex *last, Select_Lex *current, |
1
by brian
clean slate |
813 |
Item_ident *resolved_item, |
814 |
Item_ident *mark_item) |
|
815 |
{
|
|
816 |
const char *db_name= (resolved_item->db_name ? |
|
817 |
resolved_item->db_name : ""); |
|
818 |
const char *table_name= (resolved_item->table_name ? |
|
819 |
resolved_item->table_name : ""); |
|
846
by Brian Aker
Removing on typedeffed class. |
820 |
/* store pointer on Select_Lex from which item is dependent */
|
1
by brian
clean slate |
821 |
if (mark_item) |
822 |
mark_item->depended_from= last; |
|
823 |
current->mark_as_dependent(last); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
824 |
if (session->lex->describe & DESCRIBE_EXTENDED) |
1
by brian
clean slate |
825 |
{
|
261.4.1
by Felipe
- Renamed MYSQL_ERROR to DRIZZLE_ERROR. |
826 |
char warn_buff[DRIZZLE_ERRMSG_SIZE]; |
1366.1.17
by Siddharth Prakash Singh
changed another status of sprintf to snprintf |
827 |
snprintf(warn_buff, sizeof(warn_buff), ER(ER_WARN_FIELD_RESOLVED), |
1
by brian
clean slate |
828 |
db_name, (db_name[0] ? "." : ""), |
829 |
table_name, (table_name [0] ? "." : ""), |
|
830 |
resolved_item->field_name, |
|
831 |
current->select_number, last->select_number); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
832 |
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE, |
1
by brian
clean slate |
833 |
ER_WARN_FIELD_RESOLVED, warn_buff); |
834 |
}
|
|
835 |
}
|
|
836 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
837 |
void mark_select_range_as_dependent(Session *session, |
846
by Brian Aker
Removing on typedeffed class. |
838 |
Select_Lex *last_select, |
839 |
Select_Lex *current_sel, |
|
1
by brian
clean slate |
840 |
Field *found_field, Item *found_item, |
841 |
Item_ident *resolved_item) |
|
842 |
{
|
|
843 |
/*
|
|
844 |
Go from current SELECT to SELECT where field was resolved (it
|
|
845 |
have to be reachable from current SELECT, because it was already
|
|
846 |
done once when we resolved this field and cached result of
|
|
847 |
resolving)
|
|
848 |
*/
|
|
846
by Brian Aker
Removing on typedeffed class. |
849 |
Select_Lex *previous_select= current_sel; |
1
by brian
clean slate |
850 |
for (; previous_select->outer_select() != last_select; |
851 |
previous_select= previous_select->outer_select()) |
|
852 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
853 |
Item_subselect *prev_subselect_item= previous_select->master_unit()->item; |
1
by brian
clean slate |
854 |
prev_subselect_item->used_tables_cache|= OUTER_REF_TABLE_BIT; |
2060
by Brian Aker
Added native functions into the function table. |
855 |
prev_subselect_item->const_item_cache= false; |
1
by brian
clean slate |
856 |
}
|
857 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
858 |
Item_subselect *prev_subselect_item= previous_select->master_unit()->item; |
1
by brian
clean slate |
859 |
Item_ident *dependent= resolved_item; |
860 |
if (found_field == view_ref_found) |
|
861 |
{
|
|
862 |
Item::Type type= found_item->type(); |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
863 |
prev_subselect_item->used_tables_cache|= found_item->used_tables(); |
1
by brian
clean slate |
864 |
dependent= ((type == Item::REF_ITEM || type == Item::FIELD_ITEM) ? |
865 |
(Item_ident*) found_item : |
|
866 |
0); |
|
867 |
}
|
|
868 |
else
|
|
1660.1.3
by Brian Aker
Encapsulate Table in field |
869 |
prev_subselect_item->used_tables_cache|= found_field->getTable()->map; |
2060
by Brian Aker
Added native functions into the function table. |
870 |
prev_subselect_item->const_item_cache= false; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
871 |
mark_as_dependent(session, last_select, current_sel, resolved_item, |
1
by brian
clean slate |
872 |
dependent); |
873 |
}
|
|
874 |
}
|
|
875 |
||
876 |
/**
|
|
877 |
Search a GROUP BY clause for a field with a certain name.
|
|
878 |
||
879 |
Search the GROUP BY list for a column named as find_item. When searching
|
|
880 |
preference is given to columns that are qualified with the same table (and
|
|
881 |
database) name as the one being searched for.
|
|
882 |
||
883 |
@param find_item the item being searched for
|
|
884 |
@param group_list GROUP BY clause
|
|
885 |
||
886 |
@return
|
|
887 |
- the found item on success
|
|
888 |
- NULL if find_item is not in group_list
|
|
889 |
*/
|
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
890 |
static Item** find_field_in_group_list(Session *session, Item *find_item, Order *group_list) |
1
by brian
clean slate |
891 |
{
|
892 |
const char *db_name; |
|
893 |
const char *table_name; |
|
894 |
const char *field_name; |
|
1892.3.3
by tdavies
struct order_st changed and renamed to c++ class named:Order |
895 |
Order *found_group= NULL; |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
896 |
int found_match_degree= 0; |
1
by brian
clean slate |
897 |
Item_ident *cur_field; |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
898 |
int cur_match_degree= 0; |
899 |
char name_buff[NAME_LEN+1]; |
|
1
by brian
clean slate |
900 |
|
901 |
if (find_item->type() == Item::FIELD_ITEM || |
|
902 |
find_item->type() == Item::REF_ITEM) |
|
903 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
904 |
db_name= ((Item_ident*) find_item)->db_name; |
1
by brian
clean slate |
905 |
table_name= ((Item_ident*) find_item)->table_name; |
906 |
field_name= ((Item_ident*) find_item)->field_name; |
|
907 |
}
|
|
908 |
else
|
|
909 |
return NULL; |
|
910 |
||
1039.1.5
by Brian Aker
Remove lower case filename bits (aka we just lock into the most compatible |
911 |
if (db_name) |
1
by brian
clean slate |
912 |
{
|
913 |
/* Convert database to lower case for comparison */
|
|
629.5.4
by Toru Maesaka
Fourth pass of replacing MySQL's strmake() with libc calls |
914 |
strncpy(name_buff, db_name, sizeof(name_buff)-1); |
1
by brian
clean slate |
915 |
my_casedn_str(files_charset_info, name_buff); |
916 |
db_name= name_buff; |
|
917 |
}
|
|
918 |
||
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
919 |
assert(field_name != 0); |
1
by brian
clean slate |
920 |
|
1892.3.3
by tdavies
struct order_st changed and renamed to c++ class named:Order |
921 |
for (Order *cur_group= group_list ; cur_group ; cur_group= cur_group->next) |
1
by brian
clean slate |
922 |
{
|
923 |
if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM) |
|
924 |
{
|
|
925 |
cur_field= (Item_ident*) *cur_group->item; |
|
926 |
cur_match_degree= 0; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
927 |
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
928 |
assert(cur_field->field_name != 0); |
1
by brian
clean slate |
929 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
930 |
if (! my_strcasecmp(system_charset_info, cur_field->field_name, field_name)) |
1
by brian
clean slate |
931 |
++cur_match_degree; |
932 |
else
|
|
933 |
continue; |
|
934 |
||
935 |
if (cur_field->table_name && table_name) |
|
936 |
{
|
|
937 |
/* If field_name is qualified by a table name. */
|
|
938 |
if (my_strcasecmp(table_alias_charset, cur_field->table_name, table_name)) |
|
939 |
/* Same field names, different tables. */
|
|
940 |
return NULL; |
|
941 |
||
942 |
++cur_match_degree; |
|
943 |
if (cur_field->db_name && db_name) |
|
944 |
{
|
|
945 |
/* If field_name is also qualified by a database name. */
|
|
2085.2.3
by Brian Aker
Fix strcasecmp issues (ie, check UTF-8). |
946 |
if (my_strcasecmp(system_charset_info, cur_field->db_name, db_name)) |
947 |
{
|
|
1
by brian
clean slate |
948 |
/* Same field names, different databases. */
|
949 |
return NULL; |
|
2085.2.3
by Brian Aker
Fix strcasecmp issues (ie, check UTF-8). |
950 |
}
|
1
by brian
clean slate |
951 |
++cur_match_degree; |
952 |
}
|
|
953 |
}
|
|
954 |
||
955 |
if (cur_match_degree > found_match_degree) |
|
956 |
{
|
|
957 |
found_match_degree= cur_match_degree; |
|
958 |
found_group= cur_group; |
|
959 |
}
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
960 |
else if (found_group && |
961 |
(cur_match_degree == found_match_degree) && |
|
1
by brian
clean slate |
962 |
! (*(found_group->item))->eq(cur_field, 0)) |
963 |
{
|
|
964 |
/*
|
|
965 |
If the current resolve candidate matches equally well as the current
|
|
966 |
best match, they must reference the same column, otherwise the field
|
|
967 |
is ambiguous.
|
|
968 |
*/
|
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
969 |
my_error(ER_NON_UNIQ_ERROR, MYF(0), find_item->full_name(), session->where()); |
1
by brian
clean slate |
970 |
return NULL; |
971 |
}
|
|
972 |
}
|
|
973 |
}
|
|
974 |
||
975 |
if (found_group) |
|
976 |
return found_group->item; |
|
2024.1.3
by Brian Aker
Finish up issues with unsigned/int by fixing cast(). |
977 |
|
978 |
return NULL; |
|
1
by brian
clean slate |
979 |
}
|
980 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
981 |
Item** resolve_ref_in_select_and_group(Session *session, Item_ident *ref, Select_Lex *select) |
1
by brian
clean slate |
982 |
{
|
983 |
Item **group_by_ref= NULL; |
|
984 |
Item **select_ref= NULL; |
|
1892.3.3
by tdavies
struct order_st changed and renamed to c++ class named:Order |
985 |
Order *group_list= (Order*) select->group_list.first; |
56
by brian
Next pass of true/false update. |
986 |
bool ambiguous_fields= false; |
482
by Brian Aker
Remove uint. |
987 |
uint32_t counter; |
1
by brian
clean slate |
988 |
enum_resolution_type resolution; |
989 |
||
990 |
/*
|
|
991 |
Search for a column or derived column named as 'ref' in the SELECT
|
|
992 |
clause of the current select.
|
|
993 |
*/
|
|
1578.6.3
by Brian Aker
More current_session removal. |
994 |
if (!(select_ref= find_item_in_list(session, |
995 |
ref, *(select->get_item_list()), |
|
1
by brian
clean slate |
996 |
&counter, REPORT_EXCEPT_NOT_FOUND, |
997 |
&resolution))) |
|
998 |
return NULL; /* Some error occurred. */ |
|
999 |
if (resolution == RESOLVED_AGAINST_ALIAS) |
|
56
by brian
Next pass of true/false update. |
1000 |
ref->alias_name_used= true; |
1
by brian
clean slate |
1001 |
|
1002 |
/* If this is a non-aggregated field inside HAVING, search in GROUP BY. */
|
|
1003 |
if (select->having_fix_field && !ref->with_sum_func && group_list) |
|
1004 |
{
|
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
1005 |
group_by_ref= find_field_in_group_list(session, ref, group_list); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1006 |
|
1
by brian
clean slate |
1007 |
/* Check if the fields found in SELECT and GROUP BY are the same field. */
|
1008 |
if (group_by_ref && (select_ref != not_found_item) && |
|
1009 |
!((*group_by_ref)->eq(*select_ref, 0))) |
|
1010 |
{
|
|
56
by brian
Next pass of true/false update. |
1011 |
ambiguous_fields= true; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1012 |
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_NON_UNIQ_ERROR, |
1
by brian
clean slate |
1013 |
ER(ER_NON_UNIQ_ERROR), ref->full_name(), |
2114.4.10
by Brian Aker
Remove current_session from a couple of locations, encapsulate where in |
1014 |
session->where()); |
1
by brian
clean slate |
1015 |
|
1016 |
}
|
|
1017 |
}
|
|
1018 |
||
1019 |
if (select_ref != not_found_item || group_by_ref) |
|
1020 |
{
|
|
1021 |
if (select_ref != not_found_item && !ambiguous_fields) |
|
1022 |
{
|
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1023 |
assert(*select_ref != 0); |
1
by brian
clean slate |
1024 |
if (!select->ref_pointer_array[counter]) |
1025 |
{
|
|
1026 |
my_error(ER_ILLEGAL_REFERENCE, MYF(0), |
|
1027 |
ref->name, "forward reference in item list"); |
|
1028 |
return NULL; |
|
1029 |
}
|
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1030 |
assert((*select_ref)->fixed); |
1
by brian
clean slate |
1031 |
return (select->ref_pointer_array + counter); |
1032 |
}
|
|
1033 |
if (group_by_ref) |
|
1034 |
return group_by_ref; |
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1035 |
assert(false); |
1
by brian
clean slate |
1036 |
return NULL; /* So there is no compiler warning. */ |
1037 |
}
|
|
1038 |
||
1039 |
return (Item**) not_found_item; |
|
1040 |
}
|
|
1041 |
||
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
1042 |
void Item::init_make_field(SendField *tmp_field, |
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
1043 |
enum enum_field_types field_type_arg) |
1
by brian
clean slate |
1044 |
{
|
1045 |
char *empty_name= (char*) ""; |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1046 |
tmp_field->db_name= empty_name; |
1047 |
tmp_field->org_table_name= empty_name; |
|
1048 |
tmp_field->org_col_name= empty_name; |
|
1049 |
tmp_field->table_name= empty_name; |
|
1050 |
tmp_field->col_name= name; |
|
1051 |
tmp_field->charsetnr= collation.collation->number; |
|
1052 |
tmp_field->flags= (maybe_null ? 0 : NOT_NULL_FLAG) | |
|
1053 |
(my_binary_compare(collation.collation) ? |
|
1054 |
BINARY_FLAG : 0); |
|
1055 |
tmp_field->type= field_type_arg; |
|
1056 |
tmp_field->length= max_length; |
|
1057 |
tmp_field->decimals= decimals; |
|
1
by brian
clean slate |
1058 |
}
|
1059 |
||
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
1060 |
void Item::make_field(SendField *tmp_field) |
1
by brian
clean slate |
1061 |
{
|
1062 |
init_make_field(tmp_field, field_type()); |
|
1063 |
}
|
|
1064 |
||
1065 |
enum_field_types Item::string_field_type() const |
|
1066 |
{
|
|
240
by Brian Aker
Removed old/dead VARCHAR type from pre-5.0 |
1067 |
enum_field_types f_type= DRIZZLE_TYPE_VARCHAR; |
113
by Brian Aker
First pass on removing blob internals. |
1068 |
if (max_length >= 65536) |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1069 |
f_type= DRIZZLE_TYPE_BLOB; |
1
by brian
clean slate |
1070 |
return f_type; |
1071 |
}
|
|
1072 |
||
1073 |
enum_field_types Item::field_type() const |
|
1074 |
{
|
|
1075 |
switch (result_type()) { |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1076 |
case STRING_RESULT: |
1077 |
return string_field_type(); |
|
1078 |
case INT_RESULT: |
|
1079 |
return DRIZZLE_TYPE_LONGLONG; |
|
1080 |
case DECIMAL_RESULT: |
|
1211.1.1
by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update |
1081 |
return DRIZZLE_TYPE_DECIMAL; |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1082 |
case REAL_RESULT: |
1083 |
return DRIZZLE_TYPE_DOUBLE; |
|
1
by brian
clean slate |
1084 |
case ROW_RESULT: |
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1085 |
assert(0); |
1
by brian
clean slate |
1086 |
}
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1087 |
|
1088 |
abort(); |
|
1
by brian
clean slate |
1089 |
}
|
1090 |
||
1091 |
bool Item::is_datetime() |
|
1092 |
{
|
|
2167.3.1
by Brian Aker
Fix issues where int display length may be too small, and fix collation |
1093 |
return field::isDateTime(field_type()); |
1
by brian
clean slate |
1094 |
}
|
1095 |
||
1096 |
String *Item::check_well_formed_result(String *str, bool send_error) |
|
1097 |
{
|
|
1098 |
/* Check whether we got a well-formed string */
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1099 |
const CHARSET_INFO * const cs= str->charset(); |
1
by brian
clean slate |
1100 |
int well_formed_error; |
482
by Brian Aker
Remove uint. |
1101 |
uint32_t wlen= cs->cset->well_formed_len(cs, |
1
by brian
clean slate |
1102 |
str->ptr(), str->ptr() + str->length(), |
1103 |
str->length(), &well_formed_error); |
|
1104 |
if (wlen < str->length()) |
|
1105 |
{
|
|
1106 |
char hexbuf[7]; |
|
261.4.1
by Felipe
- Renamed MYSQL_ERROR to DRIZZLE_ERROR. |
1107 |
enum DRIZZLE_ERROR::enum_warning_level level; |
482
by Brian Aker
Remove uint. |
1108 |
uint32_t diff= str->length() - wlen; |
937.2.6
by Stewart Smith
make set_if_bigger typesafe for C and C++. Fix up everywhere. |
1109 |
set_if_smaller(diff, 3U); |
971.3.9
by Eric Day
Removed dependency for hex convert, fixed a few Protocol class issues for Solaris. |
1110 |
(void) drizzled_string_to_hex(hexbuf, str->ptr() + wlen, diff); |
1
by brian
clean slate |
1111 |
if (send_error) |
1112 |
{
|
|
1113 |
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), |
|
1114 |
cs->csname, hexbuf); |
|
681
by Brian Aker
Style cleanup |
1115 |
return NULL; |
1
by brian
clean slate |
1116 |
}
|
1117 |
{
|
|
261.4.1
by Felipe
- Renamed MYSQL_ERROR to DRIZZLE_ERROR. |
1118 |
level= DRIZZLE_ERROR::WARN_LEVEL_ERROR; |
1
by brian
clean slate |
1119 |
null_value= 1; |
1120 |
str= 0; |
|
1121 |
}
|
|
2148.5.3
by Brian Aker
Remove hard coded array for numbers (this also fixes a couple of spots where |
1122 |
push_warning_printf(&getSession(), level, ER_INVALID_CHARACTER_STRING, |
1
by brian
clean slate |
1123 |
ER(ER_INVALID_CHARACTER_STRING), cs->csname, hexbuf); |
1124 |
}
|
|
1125 |
return str; |
|
1126 |
}
|
|
1127 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1128 |
bool Item::eq_by_collation(Item *item, bool binary_cmp, const CHARSET_INFO * const cs) |
1
by brian
clean slate |
1129 |
{
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1130 |
const CHARSET_INFO *save_cs= 0; |
1131 |
const CHARSET_INFO *save_item_cs= 0; |
|
1
by brian
clean slate |
1132 |
if (collation.collation != cs) |
1133 |
{
|
|
1134 |
save_cs= collation.collation; |
|
1135 |
collation.collation= cs; |
|
1136 |
}
|
|
1137 |
if (item->collation.collation != cs) |
|
1138 |
{
|
|
1139 |
save_item_cs= item->collation.collation; |
|
1140 |
item->collation.collation= cs; |
|
1141 |
}
|
|
1142 |
bool res= eq(item, binary_cmp); |
|
1143 |
if (save_cs) |
|
1144 |
collation.collation= save_cs; |
|
1145 |
if (save_item_cs) |
|
1146 |
item->collation.collation= save_item_cs; |
|
1147 |
return res; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1148 |
}
|
1
by brian
clean slate |
1149 |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
1150 |
Field *Item::make_string_field(Table *table) |
1
by brian
clean slate |
1151 |
{
|
1152 |
Field *field; |
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1153 |
assert(collation.collation); |
1
by brian
clean slate |
1154 |
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB) |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1155 |
{
|
1
by brian
clean slate |
1156 |
field= new Field_blob(max_length, maybe_null, name, |
1157 |
collation.collation); |
|
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1158 |
}
|
241
by Brian Aker
First pass of CHAR removal. |
1159 |
else
|
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1160 |
{
|
1161 |
table->setVariableWidth(); |
|
1162 |
field= new Field_varstring(max_length, maybe_null, name, |
|
1
by brian
clean slate |
1163 |
collation.collation); |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1164 |
}
|
241
by Brian Aker
First pass of CHAR removal. |
1165 |
|
1
by brian
clean slate |
1166 |
if (field) |
1167 |
field->init(table); |
|
1168 |
return field; |
|
1169 |
}
|
|
1170 |
||
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
1171 |
Field *Item::tmp_table_field_from_field_type(Table *table, bool) |
1
by brian
clean slate |
1172 |
{
|
1173 |
/*
|
|
1174 |
The field functions defines a field to be not null if null_ptr is not 0
|
|
1175 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
1176 |
unsigned char *null_ptr= maybe_null ? (unsigned char*) "" : 0; |
1996.2.1
by Brian Aker
uuid type code. |
1177 |
Field *field= NULL; |
1
by brian
clean slate |
1178 |
|
1179 |
switch (field_type()) { |
|
1211.1.1
by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update |
1180 |
case DRIZZLE_TYPE_DECIMAL: |
1181 |
field= new Field_decimal((unsigned char*) 0, |
|
1119.9.6
by Jay Pipes
Removes the FIELDFLAG_DECIMAL, the f_is_dec() macro, and unscrews the unsigned flag in various places. |
1182 |
max_length, |
1183 |
null_ptr, |
|
1184 |
0, |
|
1185 |
Field::NONE, |
|
1186 |
name, |
|
2137.1.3
by Brian Aker
Move decimal_zero, and a light fix on the decimal_t type (ditch the |
1187 |
decimals); |
1
by brian
clean slate |
1188 |
break; |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1189 |
case DRIZZLE_TYPE_LONG: |
2007
by Brian Aker
Refactor naming for integers. |
1190 |
field= new field::Int32((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE, name); |
1
by brian
clean slate |
1191 |
break; |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1192 |
case DRIZZLE_TYPE_LONGLONG: |
2007
by Brian Aker
Refactor naming for integers. |
1193 |
field= new field::Int64((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE, name); |
1
by brian
clean slate |
1194 |
break; |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1195 |
case DRIZZLE_TYPE_DOUBLE: |
481
by Brian Aker
Remove all of uchar. |
1196 |
field= new Field_double((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE, |
2007
by Brian Aker
Refactor naming for integers. |
1197 |
name, decimals, 0, unsigned_flag); |
1
by brian
clean slate |
1198 |
break; |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1199 |
case DRIZZLE_TYPE_NULL: |
2167.3.1
by Brian Aker
Fix issues where int display length may be too small, and fix collation |
1200 |
field= new Field_null((unsigned char*) 0, max_length, name); |
1
by brian
clean slate |
1201 |
break; |
575.5.1
by David Axmark
Changed NEWDATE to DATE. One failing test but I think its somewhere else in the code |
1202 |
case DRIZZLE_TYPE_DATE: |
2167.3.1
by Brian Aker
Fix issues where int display length may be too small, and fix collation |
1203 |
field= new Field_date(maybe_null, name); |
1
by brian
clean slate |
1204 |
break; |
2046.2.1
by Brian Aker
First pass on micro timestamp. |
1205 |
|
1206 |
case DRIZZLE_TYPE_MICROTIME: |
|
1207 |
field= new field::Microtime(maybe_null, name); |
|
1208 |
break; |
|
1209 |
||
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1210 |
case DRIZZLE_TYPE_TIMESTAMP: |
2046.2.1
by Brian Aker
First pass on micro timestamp. |
1211 |
field= new field::Epoch(maybe_null, name); |
1
by brian
clean slate |
1212 |
break; |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1213 |
case DRIZZLE_TYPE_DATETIME: |
2167.3.1
by Brian Aker
Fix issues where int display length may be too small, and fix collation |
1214 |
field= new Field_datetime(maybe_null, name); |
1
by brian
clean slate |
1215 |
break; |
1999.4.7
by Brian Aker
Merge in first pass of TIME type (closer to EPOCH time). |
1216 |
case DRIZZLE_TYPE_TIME: |
2167.3.1
by Brian Aker
Fix issues where int display length may be too small, and fix collation |
1217 |
field= new field::Time(maybe_null, name); |
1999.4.7
by Brian Aker
Merge in first pass of TIME type (closer to EPOCH time). |
1218 |
break; |
2023.2.2
by Brian Aker
Merge in BOOL change to BOOLEAN. |
1219 |
case DRIZZLE_TYPE_BOOLEAN: |
1996.2.1
by Brian Aker
uuid type code. |
1220 |
case DRIZZLE_TYPE_UUID: |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1221 |
case DRIZZLE_TYPE_ENUM: |
1222 |
case DRIZZLE_TYPE_VARCHAR: |
|
1
by brian
clean slate |
1223 |
return make_string_field(table); |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1224 |
case DRIZZLE_TYPE_BLOB: |
1
by brian
clean slate |
1225 |
field= new Field_blob(max_length, maybe_null, name, collation.collation); |
1226 |
break; // Blob handled outside of case |
|
1227 |
}
|
|
1996.2.1
by Brian Aker
uuid type code. |
1228 |
assert(field); |
1229 |
||
1
by brian
clean slate |
1230 |
if (field) |
1231 |
field->init(table); |
|
1232 |
return field; |
|
1233 |
}
|
|
1234 |
||
1235 |
/*
|
|
1236 |
This implementation can lose str_value content, so if the
|
|
1237 |
Item uses str_value to store something, it should
|
|
1238 |
reimplement it's ::save_in_field() as Item_string, for example, does
|
|
1239 |
*/
|
|
1240 |
int Item::save_in_field(Field *field, bool no_conversions) |
|
1241 |
{
|
|
1242 |
int error; |
|
1243 |
if (result_type() == STRING_RESULT) |
|
1244 |
{
|
|
1245 |
String *result; |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1246 |
const CHARSET_INFO * const cs= collation.collation; |
1
by brian
clean slate |
1247 |
char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns |
1248 |
str_value.set_quick(buff, sizeof(buff), cs); |
|
1249 |
result=val_str(&str_value); |
|
1250 |
if (null_value) |
|
1251 |
{
|
|
1252 |
str_value.set_quick(0, 0, cs); |
|
1253 |
return set_field_to_null_with_conversions(field, no_conversions); |
|
1254 |
}
|
|
1255 |
||
56
by brian
Next pass of true/false update. |
1256 |
/* NOTE: If null_value == false, "result" must be not NULL. */
|
1
by brian
clean slate |
1257 |
|
1258 |
field->set_notnull(); |
|
1259 |
error=field->store(result->ptr(),result->length(),cs); |
|
1260 |
str_value.set_quick(0, 0, cs); |
|
1261 |
}
|
|
1262 |
else if (result_type() == REAL_RESULT && |
|
1263 |
field->result_type() == STRING_RESULT) |
|
1264 |
{
|
|
1265 |
double nr= val_real(); |
|
1266 |
if (null_value) |
|
1267 |
return set_field_to_null_with_conversions(field, no_conversions); |
|
1268 |
field->set_notnull(); |
|
1269 |
error= field->store(nr); |
|
1270 |
}
|
|
1271 |
else if (result_type() == REAL_RESULT) |
|
1272 |
{
|
|
1273 |
double nr= val_real(); |
|
1274 |
if (null_value) |
|
1275 |
return set_field_to_null(field); |
|
1276 |
field->set_notnull(); |
|
1277 |
error=field->store(nr); |
|
1278 |
}
|
|
1279 |
else if (result_type() == DECIMAL_RESULT) |
|
1280 |
{
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
1281 |
type::Decimal decimal_value; |
1282 |
type::Decimal *value= val_decimal(&decimal_value); |
|
1
by brian
clean slate |
1283 |
if (null_value) |
1284 |
return set_field_to_null_with_conversions(field, no_conversions); |
|
1285 |
field->set_notnull(); |
|
1286 |
error=field->store_decimal(value); |
|
1287 |
}
|
|
1288 |
else
|
|
1289 |
{
|
|
152
by Brian Aker
longlong replacement |
1290 |
int64_t nr=val_int(); |
1
by brian
clean slate |
1291 |
if (null_value) |
1292 |
return set_field_to_null_with_conversions(field, no_conversions); |
|
1293 |
field->set_notnull(); |
|
1294 |
error=field->store(nr, unsigned_flag); |
|
1295 |
}
|
|
1296 |
return error; |
|
1297 |
}
|
|
1298 |
||
1240.8.4
by Dennis Schoen
add Item functions |
1299 |
/**
|
1300 |
Check if an item is a constant one and can be cached.
|
|
1301 |
||
1302 |
@param arg [out] TRUE <=> Cache this item.
|
|
1303 |
||
1304 |
@return TRUE Go deeper in item tree.
|
|
1305 |
@return FALSE Don't go deeper in item tree.
|
|
1306 |
*/
|
|
1307 |
||
1308 |
bool Item::cache_const_expr_analyzer(unsigned char **arg) |
|
1309 |
{
|
|
1310 |
bool *cache_flag= (bool*)*arg; |
|
1311 |
if (!*cache_flag) |
|
1312 |
{
|
|
1313 |
Item *item= real_item(); |
|
1314 |
/*
|
|
1315 |
Cache constant items unless it's a basic constant, constant field or
|
|
1316 |
a subselect (they use their own cache).
|
|
1317 |
*/
|
|
1318 |
if (const_item() && |
|
1319 |
!(item->basic_const_item() || item->type() == Item::FIELD_ITEM || |
|
1320 |
item->type() == SUBSELECT_ITEM || |
|
1321 |
/*
|
|
1322 |
Do not cache GET_USER_VAR() function as its const_item() may
|
|
1323 |
return TRUE for the current thread but it still may change
|
|
1324 |
during the execution.
|
|
1325 |
*/
|
|
1326 |
(item->type() == Item::FUNC_ITEM && |
|
1327 |
((Item_func*)item)->functype() == Item_func::GUSERVAR_FUNC))) |
|
1328 |
*cache_flag= true; |
|
1329 |
return true; |
|
1330 |
}
|
|
1331 |
return false; |
|
1332 |
}
|
|
1333 |
||
1334 |
/**
|
|
1335 |
Cache item if needed.
|
|
1336 |
||
1337 |
@param arg TRUE <=> Cache this item.
|
|
1338 |
||
1339 |
@return cache if cache needed.
|
|
1340 |
@return this otherwise.
|
|
1341 |
*/
|
|
1342 |
||
1343 |
Item* Item::cache_const_expr_transformer(unsigned char *arg) |
|
1344 |
{
|
|
1345 |
if (*(bool*)arg) |
|
1346 |
{
|
|
1347 |
*((bool*)arg)= false; |
|
1348 |
Item_cache *cache= Item_cache::get_cache(this); |
|
1349 |
if (!cache) |
|
1350 |
return NULL; |
|
1351 |
cache->setup(this); |
|
1352 |
cache->store(this); |
|
1353 |
return cache; |
|
1354 |
}
|
|
1355 |
return this; |
|
1356 |
}
|
|
1357 |
||
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
1358 |
bool Item::send(plugin::Client *client, String *buffer) |
1
by brian
clean slate |
1359 |
{
|
1360 |
bool result= false; |
|
1361 |
enum_field_types f_type; |
|
1362 |
||
1363 |
switch ((f_type=field_type())) { |
|
1996.2.1
by Brian Aker
uuid type code. |
1364 |
case DRIZZLE_TYPE_DATE: |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1365 |
case DRIZZLE_TYPE_NULL: |
1366 |
case DRIZZLE_TYPE_ENUM: |
|
1367 |
case DRIZZLE_TYPE_BLOB: |
|
1368 |
case DRIZZLE_TYPE_VARCHAR: |
|
2023.2.2
by Brian Aker
Merge in BOOL change to BOOLEAN. |
1369 |
case DRIZZLE_TYPE_BOOLEAN: |
1996.2.1
by Brian Aker
uuid type code. |
1370 |
case DRIZZLE_TYPE_UUID: |
1211.1.1
by Brian Aker
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update |
1371 |
case DRIZZLE_TYPE_DECIMAL: |
1996.2.1
by Brian Aker
uuid type code. |
1372 |
{
|
1373 |
String *res; |
|
1374 |
if ((res=val_str(buffer))) |
|
1375 |
result= client->store(res->ptr(),res->length()); |
|
1376 |
break; |
|
1377 |
}
|
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1378 |
case DRIZZLE_TYPE_LONG: |
1996.2.1
by Brian Aker
uuid type code. |
1379 |
{
|
1380 |
int64_t nr; |
|
1381 |
nr= val_int(); |
|
1382 |
if (!null_value) |
|
1383 |
result= client->store((int32_t)nr); |
|
1384 |
break; |
|
1385 |
}
|
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1386 |
case DRIZZLE_TYPE_LONGLONG: |
971.3.17
by Eric Day
Cleaned up int/date related store functions. |
1387 |
{
|
1996.2.1
by Brian Aker
uuid type code. |
1388 |
int64_t nr; |
1389 |
nr= val_int(); |
|
1390 |
if (!null_value) |
|
1391 |
{
|
|
1392 |
if (unsigned_flag) |
|
1393 |
result= client->store((uint64_t)nr); |
|
1394 |
else
|
|
1395 |
result= client->store((int64_t)nr); |
|
1396 |
}
|
|
1397 |
break; |
|
971.3.17
by Eric Day
Cleaned up int/date related store functions. |
1398 |
}
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1399 |
case DRIZZLE_TYPE_DOUBLE: |
1996.2.1
by Brian Aker
uuid type code. |
1400 |
{
|
1401 |
double nr= val_real(); |
|
1402 |
if (!null_value) |
|
1403 |
result= client->store(nr, decimals, buffer); |
|
1404 |
break; |
|
1405 |
}
|
|
1999.4.7
by Brian Aker
Merge in first pass of TIME type (closer to EPOCH time). |
1406 |
case DRIZZLE_TYPE_TIME: |
1999.4.12
by Brian Aker
Adds additional testing, and fixes CAST again. |
1407 |
{
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
1408 |
type::Time tm; |
2104.2.8
by Brian Aker
Merge in reference from pointer. |
1409 |
get_time(tm); |
1999.4.12
by Brian Aker
Adds additional testing, and fixes CAST again. |
1410 |
if (not null_value) |
1411 |
result= client->store(&tm); |
|
1412 |
break; |
|
1413 |
}
|
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1414 |
case DRIZZLE_TYPE_DATETIME: |
2046.2.1
by Brian Aker
First pass on micro timestamp. |
1415 |
case DRIZZLE_TYPE_MICROTIME: |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1416 |
case DRIZZLE_TYPE_TIMESTAMP: |
1996.2.1
by Brian Aker
uuid type code. |
1417 |
{
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
1418 |
type::Time tm; |
2104.2.8
by Brian Aker
Merge in reference from pointer. |
1419 |
get_date(tm, TIME_FUZZY_DATE); |
1996.2.1
by Brian Aker
uuid type code. |
1420 |
if (!null_value) |
1421 |
result= client->store(&tm); |
|
1422 |
break; |
|
1423 |
}
|
|
1
by brian
clean slate |
1424 |
}
|
1425 |
if (null_value) |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
1426 |
result= client->store(); |
1996.2.1
by Brian Aker
uuid type code. |
1427 |
|
1
by brian
clean slate |
1428 |
return result; |
1429 |
}
|
|
1430 |
||
2154.2.4
by Brian Aker
This fixes 716459 |
1431 |
uint32_t Item::max_char_length() const |
1432 |
{
|
|
1433 |
return max_length / collation.collation->mbmaxlen; |
|
1434 |
}
|
|
1435 |
||
1436 |
void Item::fix_length_and_charset(uint32_t max_char_length_arg, CHARSET_INFO *cs) |
|
1437 |
{
|
|
1438 |
max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen); |
|
1439 |
collation.collation= cs; |
|
1440 |
}
|
|
1441 |
||
1442 |
void Item::fix_char_length(uint32_t max_char_length_arg) |
|
1443 |
{
|
|
1444 |
max_length= char_to_byte_length_safe(max_char_length_arg, collation.collation->mbmaxlen); |
|
1445 |
}
|
|
1446 |
||
1447 |
void Item::fix_char_length_uint64_t(uint64_t max_char_length_arg) |
|
1448 |
{
|
|
1449 |
uint64_t max_result_length= max_char_length_arg * |
|
1450 |
collation.collation->mbmaxlen; |
|
1451 |
||
1452 |
if (max_result_length >= MAX_BLOB_WIDTH) |
|
1453 |
{
|
|
1454 |
max_length= MAX_BLOB_WIDTH; |
|
1455 |
maybe_null= false; |
|
1456 |
}
|
|
1457 |
else
|
|
1458 |
{
|
|
1459 |
max_length= max_result_length; |
|
1460 |
}
|
|
1461 |
}
|
|
1462 |
||
1463 |
void Item::fix_length_and_charset_datetime(uint32_t max_char_length_arg) |
|
1464 |
{
|
|
1465 |
collation.set(&my_charset_bin); |
|
1466 |
fix_char_length(max_char_length_arg); |
|
1467 |
}
|
|
1468 |
||
1
by brian
clean slate |
1469 |
Item_result item_cmp_type(Item_result a,Item_result b) |
1470 |
{
|
|
1471 |
if (a == STRING_RESULT && b == STRING_RESULT) |
|
1472 |
return STRING_RESULT; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1473 |
|
1
by brian
clean slate |
1474 |
if (a == INT_RESULT && b == INT_RESULT) |
1475 |
return INT_RESULT; |
|
1476 |
else if (a == ROW_RESULT || b == ROW_RESULT) |
|
1477 |
return ROW_RESULT; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1478 |
|
1
by brian
clean slate |
1479 |
if ((a == INT_RESULT || a == DECIMAL_RESULT) && |
1480 |
(b == INT_RESULT || b == DECIMAL_RESULT)) |
|
1481 |
return DECIMAL_RESULT; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1482 |
|
1
by brian
clean slate |
1483 |
return REAL_RESULT; |
1484 |
}
|
|
1485 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1486 |
void resolve_const_item(Session *session, Item **ref, Item *comp_item) |
1
by brian
clean slate |
1487 |
{
|
1488 |
Item *item= *ref; |
|
1489 |
Item *new_item= NULL; |
|
1490 |
if (item->basic_const_item()) |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1491 |
return; /* Can't be better */ |
1
by brian
clean slate |
1492 |
Item_result res_type=item_cmp_type(comp_item->result_type(), |
1493 |
item->result_type()); |
|
1253.1.6
by Monty Taylor
Moved mem_root functions into drizzled::memory:: namespace. |
1494 |
char *name=item->name; /* Alloced by memory::sql_alloc */ |
1
by brian
clean slate |
1495 |
|
1496 |
switch (res_type) { |
|
1497 |
case STRING_RESULT: |
|
1498 |
{
|
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1499 |
char buff[MAX_FIELD_WIDTH]; |
1500 |
String tmp(buff,sizeof(buff),&my_charset_bin),*result; |
|
1501 |
result=item->val_str(&tmp); |
|
1502 |
if (item->null_value) |
|
1503 |
new_item= new Item_null(name); |
|
1504 |
else
|
|
1505 |
{
|
|
1506 |
uint32_t length= result->length(); |
|
1507 |
char *tmp_str= memory::sql_strmake(result->ptr(), length); |
|
1508 |
new_item= new Item_string(name, tmp_str, length, result->charset()); |
|
1509 |
}
|
|
1510 |
break; |
|
1
by brian
clean slate |
1511 |
}
|
1512 |
case INT_RESULT: |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1513 |
{
|
1514 |
int64_t result=item->val_int(); |
|
1515 |
uint32_t length=item->max_length; |
|
1516 |
bool null_value=item->null_value; |
|
1517 |
new_item= (null_value ? (Item*) new Item_null(name) : |
|
1518 |
(Item*) new Item_int(name, result, length)); |
|
1519 |
break; |
|
1520 |
}
|
|
1
by brian
clean slate |
1521 |
case ROW_RESULT: |
2008
by Brian Aker
Formatting + remove default from switch/case. |
1522 |
if (item->type() == Item::ROW_ITEM && comp_item->type() == Item::ROW_ITEM) |
1523 |
{
|
|
1524 |
/*
|
|
1525 |
Substitute constants only in Item_rows. Don't affect other Items
|
|
1526 |
with ROW_RESULT (eg Item_singlerow_subselect).
|
|
1
by brian
clean slate |
1527 |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1528 |
For such Items more optimal is to detect if it is constant and replace
|
1529 |
it with Item_row. This would optimize queries like this:
|
|
1530 |
SELECT * FROM t1 WHERE (a,b) = (SELECT a,b FROM t2 LIMIT 1);
|
|
1531 |
*/
|
|
1532 |
Item_row *item_row= (Item_row*) item; |
|
1533 |
Item_row *comp_item_row= (Item_row*) comp_item; |
|
1534 |
uint32_t col; |
|
1535 |
new_item= 0; |
|
1536 |
/*
|
|
1537 |
If item and comp_item are both Item_rows and have same number of cols
|
|
1538 |
then process items in Item_row one by one.
|
|
1539 |
We can't ignore NULL values here as this item may be used with <=>, in
|
|
1540 |
which case NULL's are significant.
|
|
1541 |
*/
|
|
1542 |
assert(item->result_type() == comp_item->result_type()); |
|
1543 |
assert(item_row->cols() == comp_item_row->cols()); |
|
1544 |
col= item_row->cols(); |
|
1545 |
while (col-- > 0) |
|
1546 |
resolve_const_item(session, item_row->addr(col), |
|
1547 |
comp_item_row->element_index(col)); |
|
1548 |
break; |
|
1549 |
}
|
|
1550 |
/* Fallthrough */
|
|
1
by brian
clean slate |
1551 |
case REAL_RESULT: |
2008
by Brian Aker
Formatting + remove default from switch/case. |
1552 |
{ // It must REAL_RESULT |
1553 |
double result= item->val_real(); |
|
1554 |
uint32_t length=item->max_length,decimals=item->decimals; |
|
1555 |
bool null_value=item->null_value; |
|
1556 |
new_item= (null_value ? (Item*) new Item_null(name) : (Item*) |
|
1557 |
new Item_float(name, result, decimals, length)); |
|
1558 |
break; |
|
1559 |
}
|
|
1
by brian
clean slate |
1560 |
case DECIMAL_RESULT: |
2008
by Brian Aker
Formatting + remove default from switch/case. |
1561 |
{
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
1562 |
type::Decimal decimal_value; |
1563 |
type::Decimal *result= item->val_decimal(&decimal_value); |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1564 |
uint32_t length= item->max_length, decimals= item->decimals; |
1565 |
bool null_value= item->null_value; |
|
1566 |
new_item= (null_value ? |
|
1567 |
(Item*) new Item_null(name) : |
|
1568 |
(Item*) new Item_decimal(name, result, length, decimals)); |
|
1569 |
break; |
|
1570 |
}
|
|
1571 |
}
|
|
1572 |
||
1
by brian
clean slate |
1573 |
if (new_item) |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1574 |
session->change_item_tree(ref, new_item); |
1
by brian
clean slate |
1575 |
}
|
1576 |
||
1577 |
bool field_is_equal_to_item(Field *field,Item *item) |
|
1578 |
{
|
|
1579 |
||
1580 |
Item_result res_type=item_cmp_type(field->result_type(), |
|
1581 |
item->result_type()); |
|
1582 |
if (res_type == STRING_RESULT) |
|
1583 |
{
|
|
1584 |
char item_buff[MAX_FIELD_WIDTH]; |
|
1585 |
char field_buff[MAX_FIELD_WIDTH]; |
|
1586 |
String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin),*item_result; |
|
1587 |
String field_tmp(field_buff,sizeof(field_buff),&my_charset_bin); |
|
1588 |
item_result=item->val_str(&item_tmp); |
|
1589 |
if (item->null_value) |
|
1590 |
return 1; // This must be true |
|
1996.2.1
by Brian Aker
uuid type code. |
1591 |
field->val_str_internal(&field_tmp); |
1592 |
return not stringcmp(&field_tmp,item_result); |
|
1
by brian
clean slate |
1593 |
}
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1594 |
|
1
by brian
clean slate |
1595 |
if (res_type == INT_RESULT) |
1596 |
return 1; // Both where of type int |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1597 |
|
1
by brian
clean slate |
1598 |
if (res_type == DECIMAL_RESULT) |
1599 |
{
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
1600 |
type::Decimal item_buf, *item_val, |
1
by brian
clean slate |
1601 |
field_buf, *field_val; |
1602 |
item_val= item->val_decimal(&item_buf); |
|
1603 |
if (item->null_value) |
|
1604 |
return 1; // This must be true |
|
1605 |
field_val= field->val_decimal(&field_buf); |
|
2030.1.2
by Brian Aker
First pass in refactoring of the name of my_decimal. |
1606 |
return !class_decimal_cmp(item_val, field_val); |
1
by brian
clean slate |
1607 |
}
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1608 |
|
1
by brian
clean slate |
1609 |
double result= item->val_real(); |
1610 |
if (item->null_value) |
|
1611 |
return 1; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1612 |
|
1
by brian
clean slate |
1613 |
return result == field->val_real(); |
1614 |
}
|
|
1615 |
||
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
1616 |
void dummy_error_processor(Session *, void *) |
1
by brian
clean slate |
1617 |
{}
|
1618 |
||
1619 |
/**
|
|
575.4.7
by Monty Taylor
More header cleanup. |
1620 |
Create field for temporary table using type of given item.
|
1621 |
||
1622 |
@param session Thread handler
|
|
1623 |
@param item Item to create a field for
|
|
1624 |
@param table Temporary table
|
|
1625 |
@param copy_func If set and item is a function, store copy of
|
|
1626 |
item in this array
|
|
1627 |
@param modify_item 1 if item->result_field should point to new
|
|
1628 |
item. This is relevent for how fill_record()
|
|
1629 |
is going to work:
|
|
1630 |
If modify_item is 1 then fill_record() will
|
|
1631 |
update the record in the original table.
|
|
1632 |
If modify_item is 0 then fill_record() will
|
|
1633 |
update the temporary table
|
|
1634 |
@param convert_blob_length If >0 create a varstring(convert_blob_length)
|
|
1635 |
field instead of blob.
|
|
1636 |
||
1637 |
@retval
|
|
1638 |
0 on error
|
|
1639 |
@retval
|
|
1640 |
new_created field
|
|
1641 |
*/
|
|
1642 |
static Field *create_tmp_field_from_item(Session *, |
|
1643 |
Item *item, Table *table, |
|
1644 |
Item ***copy_func, bool modify_item, |
|
1645 |
uint32_t convert_blob_length) |
|
1646 |
{
|
|
1647 |
bool maybe_null= item->maybe_null; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1648 |
Field *new_field= NULL; |
575.4.7
by Monty Taylor
More header cleanup. |
1649 |
|
1650 |
switch (item->result_type()) { |
|
1651 |
case REAL_RESULT: |
|
1652 |
new_field= new Field_double(item->max_length, maybe_null, |
|
1653 |
item->name, item->decimals, true); |
|
1654 |
break; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1655 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1656 |
case INT_RESULT: |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1657 |
/*
|
575.4.7
by Monty Taylor
More header cleanup. |
1658 |
Select an integer type with the minimal fit precision.
|
1659 |
MY_INT32_NUM_DECIMAL_DIGITS is sign inclusive, don't consider the sign.
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1660 |
Values with MY_INT32_NUM_DECIMAL_DIGITS digits may or may not fit into
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1661 |
Int32 -> make them field::Int64.
|
575.4.7
by Monty Taylor
More header cleanup. |
1662 |
*/
|
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
1663 |
if (item->unsigned_flag) |
1664 |
{
|
|
1665 |
new_field= new field::Size(item->max_length, maybe_null, |
|
1666 |
item->name, item->unsigned_flag); |
|
1667 |
}
|
|
1668 |
else if (item->max_length >= (MY_INT32_NUM_DECIMAL_DIGITS - 1)) |
|
1669 |
{
|
|
1670 |
new_field= new field::Int64(item->max_length, maybe_null, |
|
1671 |
item->name, item->unsigned_flag); |
|
1672 |
}
|
|
575.4.7
by Monty Taylor
More header cleanup. |
1673 |
else
|
2008.2.3
by Brian Aker
Fixing up a, somewhat, hidden unsigned type to solve a few issues around |
1674 |
{
|
1675 |
new_field= new field::Int32(item->max_length, maybe_null, |
|
1676 |
item->name, item->unsigned_flag); |
|
1677 |
}
|
|
1678 |
||
575.4.7
by Monty Taylor
More header cleanup. |
1679 |
break; |
2008
by Brian Aker
Formatting + remove default from switch/case. |
1680 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1681 |
case STRING_RESULT: |
1682 |
assert(item->collation.collation); |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1683 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1684 |
/*
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1685 |
DATE/TIME fields have STRING_RESULT result type.
|
575.4.7
by Monty Taylor
More header cleanup. |
1686 |
To preserve type they needed to be handled separately.
|
1687 |
*/
|
|
2167.3.2
by Brian Aker
Make use of isDateTime |
1688 |
if (field::isDateTime(item->field_type())) |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1689 |
{
|
575.4.7
by Monty Taylor
More header cleanup. |
1690 |
new_field= item->tmp_table_field_from_field_type(table, 1); |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1691 |
/*
|
1692 |
Make sure that the blob fits into a Field_varstring which has
|
|
1693 |
2-byte lenght.
|
|
1694 |
*/
|
|
1695 |
}
|
|
575.4.7
by Monty Taylor
More header cleanup. |
1696 |
else if (item->max_length/item->collation.collation->mbmaxlen > 255 && |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1697 |
convert_blob_length <= Field_varstring::MAX_SIZE && |
575.4.7
by Monty Taylor
More header cleanup. |
1698 |
convert_blob_length) |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1699 |
{
|
1700 |
table->setVariableWidth(); |
|
575.4.7
by Monty Taylor
More header cleanup. |
1701 |
new_field= new Field_varstring(convert_blob_length, maybe_null, |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1702 |
item->name, item->collation.collation); |
1703 |
}
|
|
575.4.7
by Monty Taylor
More header cleanup. |
1704 |
else
|
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1705 |
{
|
575.4.7
by Monty Taylor
More header cleanup. |
1706 |
new_field= item->make_string_field(table); |
1835.1.3
by Brian Aker
Fix variable such that we no longer pass share to varstring on creation. |
1707 |
}
|
575.4.7
by Monty Taylor
More header cleanup. |
1708 |
new_field->set_derivation(item->collation.derivation); |
1709 |
break; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1710 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1711 |
case DECIMAL_RESULT: |
1712 |
{
|
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1713 |
uint8_t dec= item->decimals; |
1714 |
uint8_t intg= ((Item_decimal *) item)->decimal_precision() - dec; |
|
1715 |
uint32_t len= item->max_length; |
|
575.4.7
by Monty Taylor
More header cleanup. |
1716 |
|
1717 |
/*
|
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1718 |
Trying to put too many digits overall in a DECIMAL(prec,dec)
|
1719 |
will always throw a warning. We must limit dec to
|
|
1720 |
DECIMAL_MAX_SCALE however to prevent an assert() later.
|
|
575.4.7
by Monty Taylor
More header cleanup. |
1721 |
*/
|
1722 |
||
2008
by Brian Aker
Formatting + remove default from switch/case. |
1723 |
if (dec > 0) |
1724 |
{
|
|
1725 |
signed int overflow; |
|
1726 |
||
1727 |
dec= min(dec, (uint8_t)DECIMAL_MAX_SCALE); |
|
1728 |
||
1729 |
/*
|
|
1730 |
If the value still overflows the field with the corrected dec,
|
|
1731 |
we'll throw out decimals rather than integers. This is still
|
|
1732 |
bad and of course throws a truncation warning.
|
|
1733 |
+1: for decimal point
|
|
1734 |
*/
|
|
1735 |
||
2030.1.2
by Brian Aker
First pass in refactoring of the name of my_decimal. |
1736 |
overflow= class_decimal_precision_to_length(intg + dec, dec, |
2008
by Brian Aker
Formatting + remove default from switch/case. |
1737 |
item->unsigned_flag) - len; |
1738 |
||
1739 |
if (overflow > 0) |
|
1740 |
dec= max(0, dec - overflow); // too long, discard fract |
|
1741 |
else
|
|
1742 |
len-= item->decimals - dec; // corrected value fits |
|
1743 |
}
|
|
1744 |
||
1745 |
new_field= new Field_decimal(len, |
|
1746 |
maybe_null, |
|
1747 |
item->name, |
|
1748 |
dec, |
|
1749 |
item->unsigned_flag); |
|
1750 |
break; |
|
575.4.7
by Monty Taylor
More header cleanup. |
1751 |
}
|
1752 |
||
1753 |
case ROW_RESULT: |
|
1754 |
// This case should never be choosen
|
|
1755 |
assert(0); |
|
1996.2.1
by Brian Aker
uuid type code. |
1756 |
abort(); |
575.4.7
by Monty Taylor
More header cleanup. |
1757 |
}
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1758 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1759 |
if (new_field) |
1760 |
new_field->init(table); |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1761 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1762 |
if (copy_func && item->is_result_field()) |
1763 |
*((*copy_func)++) = item; // Save for copy_funcs |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1764 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1765 |
if (modify_item) |
1766 |
item->set_result_field(new_field); |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1767 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1768 |
if (item->type() == Item::NULL_ITEM) |
1769 |
new_field->is_created_from_null_item= true; |
|
2008
by Brian Aker
Formatting + remove default from switch/case. |
1770 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1771 |
return new_field; |
1772 |
}
|
|
1773 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1774 |
Field *create_tmp_field(Session *session, |
1775 |
Table *table, |
|
1776 |
Item *item, |
|
1273.2.3
by Stewart Smith
cleanup trailing whitespace |
1777 |
Item::Type type, |
1778 |
Item ***copy_func, |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1779 |
Field **from_field, |
1273.2.3
by Stewart Smith
cleanup trailing whitespace |
1780 |
Field **default_field, |
1781 |
bool group, |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
1782 |
bool modify_item, |
1783 |
bool make_copy_field, |
|
575.4.7
by Monty Taylor
More header cleanup. |
1784 |
uint32_t convert_blob_length) |
1785 |
{
|
|
1786 |
Field *result; |
|
1787 |
Item::Type orig_type= type; |
|
1788 |
Item *orig_item= 0; |
|
1789 |
||
1790 |
if (type != Item::FIELD_ITEM && |
|
1791 |
item->real_item()->type() == Item::FIELD_ITEM) |
|
1792 |
{
|
|
1793 |
orig_item= item; |
|
1794 |
item= item->real_item(); |
|
1795 |
type= Item::FIELD_ITEM; |
|
1796 |
}
|
|
1797 |
||
1798 |
switch (type) { |
|
1799 |
case Item::SUM_FUNC_ITEM: |
|
1800 |
{
|
|
1801 |
Item_sum *item_sum=(Item_sum*) item; |
|
1802 |
result= item_sum->create_tmp_field(group, table, convert_blob_length); |
|
1803 |
if (!result) |
|
1804 |
my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR)); |
|
1805 |
return result; |
|
1806 |
}
|
|
1807 |
case Item::FIELD_ITEM: |
|
1808 |
case Item::DEFAULT_VALUE_ITEM: |
|
1809 |
{
|
|
1810 |
Item_field *field= (Item_field*) item; |
|
1811 |
bool orig_modify= modify_item; |
|
1812 |
if (orig_type == Item::REF_ITEM) |
|
1813 |
modify_item= 0; |
|
1814 |
/*
|
|
1815 |
If item have to be able to store NULLs but underlaid field can't do it,
|
|
1816 |
create_tmp_field_from_field() can't be used for tmp field creation.
|
|
1817 |
*/
|
|
1818 |
if (field->maybe_null && !field->field->maybe_null()) |
|
1819 |
{
|
|
1820 |
result= create_tmp_field_from_item(session, item, table, NULL, |
|
1821 |
modify_item, convert_blob_length); |
|
1822 |
*from_field= field->field; |
|
1823 |
if (result && modify_item) |
|
1824 |
field->result_field= result; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1825 |
}
|
575.4.7
by Monty Taylor
More header cleanup. |
1826 |
else
|
1996.2.1
by Brian Aker
uuid type code. |
1827 |
{
|
575.4.7
by Monty Taylor
More header cleanup. |
1828 |
result= create_tmp_field_from_field(session, (*from_field= field->field), |
1829 |
orig_item ? orig_item->name : |
|
1830 |
item->name, |
|
1831 |
table, |
|
1832 |
modify_item ? field : |
|
1833 |
NULL, |
|
1834 |
convert_blob_length); |
|
1996.2.1
by Brian Aker
uuid type code. |
1835 |
}
|
575.4.7
by Monty Taylor
More header cleanup. |
1836 |
if (orig_type == Item::REF_ITEM && orig_modify) |
1837 |
((Item_ref*)orig_item)->set_result_field(result); |
|
1838 |
if (field->field->eq_def(result)) |
|
1839 |
*default_field= field->field; |
|
1840 |
return result; |
|
1841 |
}
|
|
1842 |
/* Fall through */
|
|
1843 |
case Item::FUNC_ITEM: |
|
1844 |
/* Fall through */
|
|
1845 |
case Item::COND_ITEM: |
|
1846 |
case Item::FIELD_AVG_ITEM: |
|
1847 |
case Item::FIELD_STD_ITEM: |
|
1848 |
case Item::SUBSELECT_ITEM: |
|
1849 |
/* The following can only happen with 'CREATE TABLE ... SELECT' */
|
|
1850 |
case Item::PROC_ITEM: |
|
1851 |
case Item::INT_ITEM: |
|
1852 |
case Item::REAL_ITEM: |
|
1853 |
case Item::DECIMAL_ITEM: |
|
1854 |
case Item::STRING_ITEM: |
|
1855 |
case Item::REF_ITEM: |
|
1856 |
case Item::NULL_ITEM: |
|
1857 |
case Item::VARBIN_ITEM: |
|
1858 |
if (make_copy_field) |
|
1859 |
{
|
|
1860 |
assert(((Item_result_field*)item)->result_field); |
|
1861 |
*from_field= ((Item_result_field*)item)->result_field; |
|
1862 |
}
|
|
1863 |
return create_tmp_field_from_item(session, item, table, |
|
1864 |
(make_copy_field ? 0 : copy_func), |
|
1865 |
modify_item, convert_blob_length); |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1866 |
case Item::TYPE_HOLDER: |
575.4.7
by Monty Taylor
More header cleanup. |
1867 |
result= ((Item_type_holder *)item)->make_field_by_type(table); |
1868 |
result->set_derivation(item->collation.derivation); |
|
1869 |
return result; |
|
1870 |
default: // Dosen't have to be stored |
|
681
by Brian Aker
Style cleanup |
1871 |
return NULL; |
575.4.7
by Monty Taylor
More header cleanup. |
1872 |
}
|
1873 |
}
|
|
1874 |
||
1992.5.1
by Brian Aker
Additional cerr output bits for a few classes (Item, Field,...) |
1875 |
std::ostream& operator<<(std::ostream& output, const Item &item) |
1876 |
{
|
|
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
1877 |
switch (item.type()) |
1878 |
{
|
|
1879 |
case drizzled::Item::SUBSELECT_ITEM : |
|
1880 |
case drizzled::Item::FIELD_ITEM : |
|
1881 |
case drizzled::Item::SUM_FUNC_ITEM : |
|
1882 |
case drizzled::Item::STRING_ITEM : |
|
1883 |
case drizzled::Item::INT_ITEM : |
|
1884 |
case drizzled::Item::REAL_ITEM : |
|
1885 |
case drizzled::Item::NULL_ITEM : |
|
1886 |
case drizzled::Item::VARBIN_ITEM : |
|
1887 |
case drizzled::Item::COPY_STR_ITEM : |
|
1888 |
case drizzled::Item::FIELD_AVG_ITEM : |
|
1889 |
case drizzled::Item::DEFAULT_VALUE_ITEM : |
|
1890 |
case drizzled::Item::PROC_ITEM : |
|
1891 |
case drizzled::Item::COND_ITEM : |
|
1892 |
case drizzled::Item::REF_ITEM : |
|
1893 |
case drizzled::Item::FIELD_STD_ITEM : |
|
1894 |
case drizzled::Item::FIELD_VARIANCE_ITEM : |
|
1895 |
case drizzled::Item::INSERT_VALUE_ITEM : |
|
1896 |
case drizzled::Item::ROW_ITEM: |
|
1897 |
case drizzled::Item::CACHE_ITEM : |
|
1898 |
case drizzled::Item::TYPE_HOLDER : |
|
1899 |
case drizzled::Item::PARAM_ITEM : |
|
1900 |
case drizzled::Item::DECIMAL_ITEM : |
|
1901 |
case drizzled::Item::FUNC_ITEM : |
|
2023.2.8
by Brian Aker
Manage merge |
1902 |
case drizzled::Item::BOOLEAN_ITEM : |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
1903 |
{
|
1904 |
output << "Item:("; |
|
1905 |
output << item.full_name(); |
|
1906 |
output << ", "; |
|
1907 |
output << drizzled::display::type(item.type()); |
|
1908 |
output << ")"; |
|
1909 |
}
|
|
1910 |
break; |
|
1911 |
}
|
|
1992.5.1
by Brian Aker
Additional cerr output bits for a few classes (Item, Field,...) |
1912 |
|
1913 |
return output; // for multiple << operators. |
|
1914 |
}
|
|
1915 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
1916 |
} /* namespace drizzled */ |