390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
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 |
|
584.4.4
by Monty Taylor
Split out Name_resolution_context. |
20 |
#ifndef DRIZZLED_ITEM_H
|
21 |
#define DRIZZLED_ITEM_H
|
|
489.1.8
by Monty Taylor
Split out Item_int_func and Item_func from Item_func. (don't think too hard about the second one) |
22 |
|
584.4.1
by Monty Taylor
Split out DTCollation. |
23 |
#include <drizzled/dtcollation.h> |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
24 |
#include <mysys/drizzle_time.h> |
25 |
#include <drizzled/my_decimal.h> |
|
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
26 |
#include <drizzled/sql_bitmap.h> |
27 |
#include <drizzled/sql_list.h> |
|
28 |
#include <drizzled/sql_alloc.h> |
|
584.4.1
by Monty Taylor
Split out DTCollation. |
29 |
|
1
by brian
clean slate |
30 |
class Protocol; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
31 |
class TableList; |
1
by brian
clean slate |
32 |
class Item_field; |
584.4.4
by Monty Taylor
Split out Name_resolution_context. |
33 |
class Name_resolution_context; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
34 |
class st_select_lex; |
35 |
class Item_equal; |
|
36 |
class COND_EQUAL; |
|
37 |
class user_var_entry; |
|
38 |
class Item_sum; |
|
39 |
class Item_in_subselect; |
|
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
40 |
class Send_field; |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
41 |
class Field; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
42 |
|
43 |
void item_init(void); /* Init item functions */ |
|
44 |
||
1
by brian
clean slate |
45 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
46 |
void dummy_error_processor(Session *session, void *data); |
47 |
void view_error_processor(Session *session, void *data); |
|
1
by brian
clean slate |
48 |
|
49 |
||
50 |
/*************************************************************************/
|
|
51 |
/*
|
|
52 |
Analyzer function
|
|
53 |
SYNOPSIS
|
|
54 |
argp in/out IN: Analysis parameter
|
|
55 |
OUT: Parameter to be passed to the transformer
|
|
56 |
||
584.4.2
by Monty Taylor
Split out hybrid_type_traits. |
57 |
RETURN
|
163
by Brian Aker
Merge Monty's code. |
58 |
true Invoke the transformer
|
59 |
false Don't do it
|
|
1
by brian
clean slate |
60 |
|
61 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
62 |
typedef bool (Item::*Item_analyzer) (unsigned char **argp); |
63 |
typedef Item* (Item::*Item_transformer) (unsigned char *arg); |
|
1
by brian
clean slate |
64 |
typedef void (*Cond_traverser) (const Item *item, void *arg); |
584.4.2
by Monty Taylor
Split out hybrid_type_traits. |
65 |
typedef bool (Item::*Item_processor) (unsigned char *arg); |
1
by brian
clean slate |
66 |
|
67 |
||
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
68 |
class Item: public Sql_alloc |
1
by brian
clean slate |
69 |
{
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
70 |
/* Prevent use of these */
|
71 |
Item(const Item &); |
|
1
by brian
clean slate |
72 |
void operator=(Item &); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
73 |
|
1
by brian
clean slate |
74 |
/* Cache of the result of is_expensive(). */
|
206
by Brian Aker
Removed final uint dead types. |
75 |
int8_t is_expensive_cache; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
76 |
virtual bool is_expensive_processor(unsigned char *arg); |
1
by brian
clean slate |
77 |
|
78 |
public: |
|
79 |
||
608
by Brian Aker
Adding snowman test (plus a dead variable removal). |
80 |
enum Type {FIELD_ITEM= 0, |
81 |
FUNC_ITEM, |
|
82 |
SUM_FUNC_ITEM, |
|
83 |
STRING_ITEM, |
|
84 |
INT_ITEM, |
|
85 |
REAL_ITEM, |
|
86 |
NULL_ITEM, |
|
87 |
VARBIN_ITEM, |
|
88 |
COPY_STR_ITEM, |
|
89 |
FIELD_AVG_ITEM, |
|
90 |
DEFAULT_VALUE_ITEM, |
|
91 |
PROC_ITEM, |
|
92 |
COND_ITEM, |
|
93 |
REF_ITEM, |
|
94 |
FIELD_STD_ITEM, |
|
95 |
FIELD_VARIANCE_ITEM, |
|
96 |
INSERT_VALUE_ITEM, |
|
97 |
SUBSELECT_ITEM, |
|
98 |
ROW_ITEM, CACHE_ITEM, |
|
99 |
TYPE_HOLDER, |
|
100 |
PARAM_ITEM, |
|
101 |
DECIMAL_ITEM
|
|
102 |
};
|
|
1
by brian
clean slate |
103 |
|
104 |
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; |
|
105 |
||
106 |
enum traverse_order { POSTFIX, PREFIX }; |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
107 |
|
1
by brian
clean slate |
108 |
/* Reuse size, only used by SP local variable assignment, otherwize 0 */
|
482
by Brian Aker
Remove uint. |
109 |
uint32_t rsize; |
1
by brian
clean slate |
110 |
|
111 |
/*
|
|
112 |
str_values's main purpose is to be used to cache the value in
|
|
113 |
save_in_field
|
|
114 |
*/
|
|
115 |
String str_value; |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
116 |
|
117 |
/* Name from select */
|
|
118 |
char * name; |
|
119 |
||
1
by brian
clean slate |
120 |
/* Original item name (if it was renamed)*/
|
121 |
char * orig_name; |
|
122 |
Item *next; |
|
203
by Brian Aker
Small cleanup around uint32 types (need to merge). |
123 |
uint32_t max_length; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
124 |
|
125 |
/* Length of name */
|
|
126 |
uint32_t name_length; |
|
127 |
||
206
by Brian Aker
Removed final uint dead types. |
128 |
int8_t marker; |
129 |
uint8_t decimals; |
|
275
by Brian Aker
Full removal of my_bool from central server. |
130 |
bool maybe_null; /* If item may be null */ |
131 |
bool null_value; /* if item is null */ |
|
132 |
bool unsigned_flag; |
|
133 |
bool with_sum_func; |
|
134 |
bool fixed; /* If item fixed with fix_fields */ |
|
135 |
bool is_autogenerated_name; /* indicate was name of this Item |
|
1
by brian
clean slate |
136 |
autogenerated or set by user */
|
137 |
DTCollation collation; |
|
275
by Brian Aker
Full removal of my_bool from central server. |
138 |
bool with_subselect; /* If this item is a subselect or some |
1
by brian
clean slate |
139 |
of its arguments is or contains a
|
140 |
subselect. Computed by fix_fields. */
|
|
141 |
Item_result cmp_context; /* Comparison context */ |
|
142 |
// alloc & destruct is done as start of select using sql_alloc
|
|
143 |
Item(); |
|
144 |
/*
|
|
145 |
Constructor used by Item_field, Item_ref & aggregate (sum) functions.
|
|
146 |
Used for duplicating lists in processing queries with temporary
|
|
147 |
tables
|
|
148 |
Also it used for Item_cond_and/Item_cond_or for creating
|
|
149 |
top AND/OR structure of WHERE clause to protect it of
|
|
150 |
optimisation changes in prepared statements
|
|
151 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
152 |
Item(Session *session, Item *item); |
1
by brian
clean slate |
153 |
virtual ~Item() |
154 |
{
|
|
155 |
#ifdef EXTRA_DEBUG
|
|
156 |
name=0; |
|
157 |
#endif
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
158 |
}
|
159 |
void set_name(const char *str, uint32_t length, |
|
160 |
const CHARSET_INFO * const cs); |
|
1
by brian
clean slate |
161 |
void rename(char *new_name); |
162 |
void init_make_field(Send_field *tmp_field,enum enum_field_types type); |
|
163 |
virtual void cleanup(); |
|
164 |
virtual void make_field(Send_field *field); |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
165 |
Field *make_string_field(Table *table); |
520.1.21
by Brian Aker
THD -> Session rename |
166 |
virtual bool fix_fields(Session *, Item **); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
167 |
|
1
by brian
clean slate |
168 |
/*
|
169 |
Fix after some tables has been pulled out. Basically re-calculate all
|
|
170 |
attributes that are dependent on the tables.
|
|
171 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
172 |
virtual void fix_after_pullout(st_select_lex *new_parent, Item **ref); |
1
by brian
clean slate |
173 |
|
174 |
/*
|
|
175 |
should be used in case where we are sure that we do not need
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
176 |
complete fix_fields() procedure. */
|
1
by brian
clean slate |
177 |
inline void quick_fix_field() { fixed= 1; } |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
178 |
|
179 |
/*
|
|
180 |
Save value in field, but don't give any warnings
|
|
181 |
||
182 |
NOTES
|
|
183 |
This is used to temporary store and retrieve a value in a column,
|
|
184 |
for example in opt_range to adjust the key value to fit the column.
|
|
185 |
Return: Function returns 1 on overflow and -1 on fatal errors
|
|
186 |
*/
|
|
1
by brian
clean slate |
187 |
int save_in_field_no_warnings(Field *field, bool no_conversions); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
188 |
|
1
by brian
clean slate |
189 |
virtual int save_in_field(Field *field, bool no_conversions); |
190 |
virtual void save_org_in_field(Field *field) |
|
191 |
{ (void) save_in_field(field, 1); } |
|
192 |
virtual int save_safe_in_field(Field *field) |
|
193 |
{ return save_in_field(field, 1); } |
|
194 |
virtual bool send(Protocol *protocol, String *str); |
|
195 |
virtual bool eq(const Item *, bool binary_cmp) const; |
|
196 |
virtual Item_result result_type() const { return REAL_RESULT; } |
|
197 |
virtual Item_result cast_to_int_type() const { return result_type(); } |
|
198 |
virtual enum_field_types string_field_type() const; |
|
199 |
virtual enum_field_types field_type() const; |
|
200 |
virtual enum Type type() const =0; |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
201 |
|
1
by brian
clean slate |
202 |
/*
|
203 |
Return information about function monotonicity. See comment for
|
|
204 |
enum_monotonicity_info for details. This function can only be called
|
|
205 |
after fix_fields() call.
|
|
206 |
*/
|
|
207 |
virtual enum_monotonicity_info get_monotonicity_info() const |
|
208 |
{ return NON_MONOTONIC; } |
|
209 |
||
210 |
/*
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
211 |
Convert:
|
212 |
"func_arg $CMP$ const" half-interval
|
|
213 |
into:
|
|
214 |
"FUNC(func_arg) $CMP2$ const2"
|
|
1
by brian
clean slate |
215 |
|
216 |
SYNOPSIS
|
|
217 |
val_int_endpoint()
|
|
163
by Brian Aker
Merge Monty's code. |
218 |
left_endp false <=> The interval is "x < const" or "x <= const"
|
219 |
true <=> The interval is "x > const" or "x >= const"
|
|
1
by brian
clean slate |
220 |
|
163
by Brian Aker
Merge Monty's code. |
221 |
incl_endp IN true <=> the comparison is '<' or '>'
|
222 |
false <=> the comparison is '<=' or '>='
|
|
1
by brian
clean slate |
223 |
OUT The same but for the "F(x) $CMP$ F(const)" comparison
|
224 |
||
225 |
DESCRIPTION
|
|
226 |
This function is defined only for unary monotonic functions. The caller
|
|
227 |
supplies the source half-interval
|
|
228 |
||
229 |
x $CMP$ const
|
|
230 |
||
231 |
The value of const is supplied implicitly as the value this item's
|
|
232 |
argument, the form of $CMP$ comparison is specified through the
|
|
233 |
function's arguments. The calle returns the result interval
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
234 |
|
1
by brian
clean slate |
235 |
F(x) $CMP2$ F(const)
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
236 |
|
237 |
passing back F(const) as the return value, and the form of $CMP2$
|
|
1
by brian
clean slate |
238 |
through the out parameter. NULL values are assumed to be comparable and
|
239 |
be less than any non-NULL values.
|
|
240 |
||
241 |
RETURN
|
|
242 |
The output range bound, which equal to the value of val_int()
|
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
243 |
- If the value of the function is NULL then the bound is the
|
163
by Brian Aker
Merge Monty's code. |
244 |
smallest possible value of INT64_MIN
|
1
by brian
clean slate |
245 |
*/
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
246 |
virtual int64_t val_int_endpoint(bool left_endp, bool *incl_endp); |
1
by brian
clean slate |
247 |
|
248 |
||
249 |
/* valXXX methods must return NULL or 0 or 0.0 if null_value is set. */
|
|
250 |
/*
|
|
251 |
Return double precision floating point representation of item.
|
|
252 |
||
253 |
SYNOPSIS
|
|
254 |
val_real()
|
|
255 |
||
256 |
RETURN
|
|
163
by Brian Aker
Merge Monty's code. |
257 |
In case of NULL value return 0.0 and set null_value flag to true.
|
258 |
If value is not null null_value flag will be reset to false.
|
|
1
by brian
clean slate |
259 |
*/
|
260 |
virtual double val_real()=0; |
|
261 |
/*
|
|
262 |
Return integer representation of item.
|
|
263 |
||
264 |
SYNOPSIS
|
|
265 |
val_int()
|
|
266 |
||
267 |
RETURN
|
|
163
by Brian Aker
Merge Monty's code. |
268 |
In case of NULL value return 0 and set null_value flag to true.
|
269 |
If value is not null null_value flag will be reset to false.
|
|
1
by brian
clean slate |
270 |
*/
|
152
by Brian Aker
longlong replacement |
271 |
virtual int64_t val_int()=0; |
1
by brian
clean slate |
272 |
/*
|
273 |
This is just a shortcut to avoid the cast. You should still use
|
|
274 |
unsigned_flag to check the sign of the item.
|
|
275 |
*/
|
|
151
by Brian Aker
Ulonglong to uint64_t |
276 |
inline uint64_t val_uint() { return (uint64_t) val_int(); } |
1
by brian
clean slate |
277 |
/*
|
278 |
Return string representation of this item object.
|
|
279 |
||
280 |
SYNOPSIS
|
|
281 |
val_str()
|
|
282 |
str an allocated buffer this or any nested Item object can use to
|
|
283 |
store return value of this method.
|
|
284 |
||
285 |
NOTE
|
|
286 |
Buffer passed via argument should only be used if the item itself
|
|
287 |
doesn't have an own String buffer. In case when the item maintains
|
|
288 |
it's own string buffer, it's preferable to return it instead to
|
|
289 |
minimize number of mallocs/memcpys.
|
|
290 |
The caller of this method can modify returned string, but only in case
|
|
291 |
when it was allocated on heap, (is_alloced() is true). This allows
|
|
292 |
the caller to efficiently use a buffer allocated by a child without
|
|
293 |
having to allocate a buffer of it's own. The buffer, given to
|
|
294 |
val_str() as argument, belongs to the caller and is later used by the
|
|
295 |
caller at it's own choosing.
|
|
296 |
A few implications from the above:
|
|
297 |
- unless you return a string object which only points to your buffer
|
|
298 |
but doesn't manages it you should be ready that it will be
|
|
299 |
modified.
|
|
300 |
- even for not allocated strings (is_alloced() == false) the caller
|
|
301 |
can change charset (see Item_func_{typecast/binary}. XXX: is this
|
|
302 |
a bug?
|
|
303 |
- still you should try to minimize data copying and return internal
|
|
304 |
object whenever possible.
|
|
305 |
||
306 |
RETURN
|
|
307 |
In case of NULL value return 0 (NULL pointer) and set null_value flag
|
|
163
by Brian Aker
Merge Monty's code. |
308 |
to true.
|
309 |
If value is not null null_value flag will be reset to false.
|
|
1
by brian
clean slate |
310 |
*/
|
311 |
virtual String *val_str(String *str)=0; |
|
312 |
/*
|
|
313 |
Return decimal representation of item with fixed point.
|
|
314 |
||
315 |
SYNOPSIS
|
|
316 |
val_decimal()
|
|
317 |
decimal_buffer buffer which can be used by Item for returning value
|
|
318 |
(but can be not)
|
|
319 |
||
320 |
NOTE
|
|
321 |
Returned value should not be changed if it is not the same which was
|
|
322 |
passed via argument.
|
|
323 |
||
324 |
RETURN
|
|
325 |
Return pointer on my_decimal (it can be other then passed via argument)
|
|
163
by Brian Aker
Merge Monty's code. |
326 |
if value is not NULL (null_value flag will be reset to false).
|
1
by brian
clean slate |
327 |
In case of NULL value it return 0 pointer and set null_value flag
|
163
by Brian Aker
Merge Monty's code. |
328 |
to true.
|
1
by brian
clean slate |
329 |
*/
|
330 |
virtual my_decimal *val_decimal(my_decimal *decimal_buffer)= 0; |
|
331 |
/*
|
|
332 |
Return boolean value of item.
|
|
333 |
||
334 |
RETURN
|
|
163
by Brian Aker
Merge Monty's code. |
335 |
false value is false or NULL
|
336 |
true value is true (not equal to 0)
|
|
1
by brian
clean slate |
337 |
*/
|
338 |
virtual bool val_bool(); |
|
339 |
virtual String *val_nodeset(String*) { return 0; } |
|
340 |
/* Helper functions, see item_sum.cc */
|
|
341 |
String *val_string_from_real(String *str); |
|
342 |
String *val_string_from_int(String *str); |
|
343 |
String *val_string_from_decimal(String *str); |
|
344 |
my_decimal *val_decimal_from_real(my_decimal *decimal_value); |
|
345 |
my_decimal *val_decimal_from_int(my_decimal *decimal_value); |
|
346 |
my_decimal *val_decimal_from_string(my_decimal *decimal_value); |
|
347 |
my_decimal *val_decimal_from_date(my_decimal *decimal_value); |
|
348 |
my_decimal *val_decimal_from_time(my_decimal *decimal_value); |
|
152
by Brian Aker
longlong replacement |
349 |
int64_t val_int_from_decimal(); |
1
by brian
clean slate |
350 |
double val_real_from_decimal(); |
351 |
||
352 |
int save_time_in_field(Field *field); |
|
353 |
int save_date_in_field(Field *field); |
|
354 |
int save_str_value_in_field(Field *field, String *result); |
|
355 |
||
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
356 |
virtual Field *get_tmp_table_field(void) { return 0; } |
1
by brian
clean slate |
357 |
/* This is also used to create fields in CREATE ... SELECT: */
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
358 |
virtual Field *tmp_table_field(Table *t_arg); |
359 |
virtual const char *full_name(void) const; |
|
1
by brian
clean slate |
360 |
|
361 |
/*
|
|
362 |
*result* family of methods is analog of *val* family (see above) but
|
|
363 |
return value of result_field of item if it is present. If Item have not
|
|
364 |
result field, it return val(). This methods set null_value flag in same
|
|
365 |
way as *val* methods do it.
|
|
366 |
*/
|
|
367 |
virtual double val_result() { return val_real(); } |
|
152
by Brian Aker
longlong replacement |
368 |
virtual int64_t val_int_result() { return val_int(); } |
1
by brian
clean slate |
369 |
virtual String *str_result(String* tmp) { return val_str(tmp); } |
370 |
virtual my_decimal *val_decimal_result(my_decimal *val) |
|
371 |
{ return val_decimal(val); } |
|
372 |
virtual bool val_bool_result() { return val_bool(); } |
|
373 |
||
374 |
/* bit map of tables used by item */
|
|
375 |
virtual table_map used_tables() const { return (table_map) 0L; } |
|
376 |
/*
|
|
377 |
Return table map of tables that can't be NULL tables (tables that are
|
|
378 |
used in a context where if they would contain a NULL row generated
|
|
379 |
by a LEFT or RIGHT join, the item would not be true).
|
|
380 |
This expression is used on WHERE item to determinate if a LEFT JOIN can be
|
|
381 |
converted to a normal join.
|
|
382 |
Generally this function should return used_tables() if the function
|
|
383 |
would return null if any of the arguments are null
|
|
384 |
As this is only used in the beginning of optimization, the value don't
|
|
385 |
have to be updated in update_used_tables()
|
|
386 |
*/
|
|
387 |
virtual table_map not_null_tables() const { return used_tables(); } |
|
388 |
/*
|
|
389 |
Returns true if this is a simple constant item like an integer, not
|
|
390 |
a constant expression. Used in the optimizer to propagate basic constants.
|
|
391 |
*/
|
|
392 |
virtual bool basic_const_item() const { return 0; } |
|
393 |
/* cloning of constant items (0 if it is not const) */
|
|
394 |
virtual Item *clone_item() { return 0; } |
|
395 |
virtual cond_result eq_cmp_result() const { return COND_OK; } |
|
482
by Brian Aker
Remove uint. |
396 |
inline uint32_t float_length(uint32_t decimals_par) const |
1
by brian
clean slate |
397 |
{ return decimals != NOT_FIXED_DEC ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;} |
482
by Brian Aker
Remove uint. |
398 |
virtual uint32_t decimal_precision() const; |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
399 |
int decimal_int_part() const; |
400 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
401 |
/*
|
1
by brian
clean slate |
402 |
Returns true if this is constant (during query execution, i.e. its value
|
403 |
will not change until next fix_fields) and its value is known.
|
|
404 |
*/
|
|
405 |
virtual bool const_item() const { return used_tables() == 0; } |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
406 |
/*
|
1
by brian
clean slate |
407 |
Returns true if this is constant but its value may be not known yet.
|
408 |
(Can be used for parameters of prep. stmts or of stored procedures.)
|
|
409 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
410 |
virtual bool const_during_execution() const |
1
by brian
clean slate |
411 |
{ return (used_tables() & ~PARAM_TABLE_BIT) == 0; } |
412 |
||
413 |
/**
|
|
414 |
This method is used for to:
|
|
415 |
- to generate a view definition query (SELECT-statement);
|
|
416 |
- to generate a SQL-query for EXPLAIN EXTENDED;
|
|
417 |
- to generate a SQL-query to be shown in INFORMATION_SCHEMA;
|
|
418 |
- debug.
|
|
419 |
||
420 |
For more information about view definition query, INFORMATION_SCHEMA
|
|
421 |
query and why they should be generated from the Item-tree, @see
|
|
422 |
mysql_register_view().
|
|
423 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
424 |
virtual void print(String *str, enum_query_type query_type); |
1
by brian
clean slate |
425 |
|
426 |
void print_item_w_name(String *, enum_query_type query_type); |
|
427 |
virtual void update_used_tables() {} |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
428 |
virtual void split_sum_func(Session *session, Item **ref_pointer_array, |
429 |
List<Item> &fields); |
|
430 |
||
1
by brian
clean slate |
431 |
/* Called for items that really have to be split */
|
584.4.9
by Monty Taylor
Renamed split_sum_func2 to split_sum_func. It's C++. |
432 |
void split_sum_func(Session *session, Item **ref_pointer_array, |
433 |
List<Item> &fields, |
|
434 |
Item **ref, bool skip_registered); |
|
435 |
||
482
by Brian Aker
Remove uint. |
436 |
virtual bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
236.1.24
by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME. |
437 |
virtual bool get_time(DRIZZLE_TIME *ltime); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
438 |
virtual bool get_date_result(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
439 |
||
1
by brian
clean slate |
440 |
/*
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
441 |
The method allows to determine nullness of a complex expression
|
442 |
without fully evaluating it, instead of calling val/result*() then
|
|
1
by brian
clean slate |
443 |
checking null_value. Used in Item_func_isnull/Item_func_isnotnull
|
444 |
and Item_sum_count/Item_sum_count_distinct.
|
|
445 |
Any new item which can be NULL must implement this method.
|
|
446 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
447 |
virtual bool is_null(); |
1
by brian
clean slate |
448 |
|
449 |
/*
|
|
450 |
Make sure the null_value member has a correct value.
|
|
451 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
452 |
virtual void update_null_value (); |
1
by brian
clean slate |
453 |
|
454 |
/*
|
|
455 |
Inform the item that there will be no distinction between its result
|
|
163
by Brian Aker
Merge Monty's code. |
456 |
being false or NULL.
|
1
by brian
clean slate |
457 |
|
458 |
NOTE
|
|
459 |
This function will be called for eg. Items that are top-level AND-parts
|
|
460 |
of the WHERE clause. Items implementing this function (currently
|
|
461 |
Item_cond_and and subquery-related item) enable special optimizations
|
|
462 |
when they are "top level".
|
|
463 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
464 |
virtual void top_level_item(void); |
1
by brian
clean slate |
465 |
/*
|
466 |
set field of temporary table for Item which can be switched on temporary
|
|
467 |
table during query processing (grouping and so on)
|
|
468 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
469 |
virtual void set_result_field(Field *field); |
470 |
virtual bool is_result_field(void); |
|
471 |
virtual bool is_bool_func(void); |
|
472 |
virtual void save_in_result_field(bool no_conversions); |
|
473 |
||
1
by brian
clean slate |
474 |
/*
|
475 |
set value of aggregate function in case of no rows for grouping were found
|
|
476 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
477 |
virtual void no_rows_in_result(void); |
478 |
virtual Item *copy_or_same(Session *session); |
|
479 |
||
480 |
virtual Item *copy_andor_structure(Session *session); |
|
481 |
||
482 |
virtual Item *real_item(void); |
|
483 |
virtual Item *get_tmp_table_item(Session *session); |
|
1
by brian
clean slate |
484 |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
485 |
static const CHARSET_INFO *default_charset(); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
486 |
virtual const CHARSET_INFO *compare_collation(); |
1
by brian
clean slate |
487 |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
488 |
virtual bool walk(Item_processor processor, |
489 |
bool walk_subquery, |
|
490 |
unsigned char *arg); |
|
1
by brian
clean slate |
491 |
|
481
by Brian Aker
Remove all of uchar. |
492 |
virtual Item* transform(Item_transformer transformer, unsigned char *arg); |
1
by brian
clean slate |
493 |
|
494 |
/*
|
|
495 |
This function performs a generic "compilation" of the Item tree.
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
496 |
The process of compilation is assumed to go as follows:
|
497 |
||
1
by brian
clean slate |
498 |
compile()
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
499 |
{
|
1
by brian
clean slate |
500 |
if (this->*some_analyzer(...))
|
501 |
{
|
|
502 |
compile children if any;
|
|
503 |
this->*some_transformer(...);
|
|
504 |
}
|
|
505 |
}
|
|
506 |
||
507 |
i.e. analysis is performed top-down while transformation is done
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
508 |
bottom-up.
|
1
by brian
clean slate |
509 |
*/
|
481
by Brian Aker
Remove all of uchar. |
510 |
virtual Item* compile(Item_analyzer analyzer, unsigned char **arg_p, |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
511 |
Item_transformer transformer, unsigned char *arg_t); |
512 |
||
513 |
virtual void traverse_cond(Cond_traverser traverser, |
|
514 |
void *arg, |
|
515 |
traverse_order order); |
|
516 |
||
517 |
virtual bool remove_dependence_processor(unsigned char * arg); |
|
518 |
virtual bool remove_fixed(unsigned char * arg); |
|
519 |
virtual bool cleanup_processor(unsigned char *arg); |
|
520 |
virtual bool collect_item_field_processor(unsigned char * arg); |
|
521 |
virtual bool find_item_in_field_list_processor(unsigned char *arg); |
|
522 |
virtual bool change_context_processor(unsigned char *context); |
|
523 |
virtual bool reset_query_id_processor(unsigned char *query_id_arg); |
|
524 |
virtual bool register_field_in_read_map(unsigned char *arg); |
|
525 |
||
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
526 |
/*
|
527 |
The next function differs from the previous one that a bitmap to be updated
|
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
528 |
is passed as unsigned char *arg.
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
529 |
*/
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
530 |
virtual bool register_field_in_bitmap(unsigned char *arg); |
531 |
virtual bool subst_argument_checker(unsigned char **arg); |
|
1
by brian
clean slate |
532 |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
533 |
/*
|
534 |
Check if an expression/function is allowed for a virtual column
|
|
535 |
SYNOPSIS
|
|
536 |
check_vcol_func_processor()
|
|
537 |
arg is just ignored
|
|
538 |
RETURN VALUE
|
|
539 |
TRUE Function not accepted
|
|
540 |
FALSE Function accepted
|
|
541 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
542 |
virtual bool check_vcol_func_processor(unsigned char *arg); |
543 |
virtual Item *equal_fields_propagator(unsigned char * arg); |
|
544 |
virtual bool set_no_const_sub(unsigned char *arg); |
|
545 |
virtual Item *replace_equal_field(unsigned char * arg); |
|
1
by brian
clean slate |
546 |
|
547 |
||
548 |
/*
|
|
549 |
For SP local variable returns pointer to Item representing its
|
|
550 |
current value and pointer to current Item otherwise.
|
|
551 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
552 |
virtual Item *this_item(void); |
553 |
virtual const Item *this_item(void) const; |
|
1
by brian
clean slate |
554 |
|
555 |
/*
|
|
556 |
For SP local variable returns address of pointer to Item representing its
|
|
557 |
current value and pointer passed via parameter otherwise.
|
|
558 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
559 |
virtual Item **this_item_addr(Session *session, Item **addr_arg); |
1
by brian
clean slate |
560 |
|
561 |
// Row emulation
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
562 |
virtual uint32_t cols(); |
563 |
virtual Item* element_index(uint32_t i); |
|
564 |
virtual Item** addr(uint32_t i); |
|
482
by Brian Aker
Remove uint. |
565 |
virtual bool check_cols(uint32_t c); |
1
by brian
clean slate |
566 |
// It is not row => null inside is impossible
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
567 |
virtual bool null_inside(); |
1
by brian
clean slate |
568 |
// used in row subselects to get value of elements
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
569 |
virtual void bring_value(); |
1
by brian
clean slate |
570 |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
571 |
Field *tmp_table_field_from_field_type(Table *table, bool fixed_length); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
572 |
virtual Item_field *filed_for_view_update(); |
1
by brian
clean slate |
573 |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
574 |
virtual Item *neg_transformer(Session *session); |
575 |
virtual Item *update_value_transformer(unsigned char *select_arg); |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
576 |
virtual Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
577 |
void delete_self(); |
1
by brian
clean slate |
578 |
|
579 |
/*
|
|
163
by Brian Aker
Merge Monty's code. |
580 |
result_as_int64_t() must return true for Items representing DATE/TIME
|
1
by brian
clean slate |
581 |
functions and DATE/TIME table fields.
|
582 |
Those Items have result_type()==STRING_RESULT (and not INT_RESULT), but
|
|
583 |
their values should be compared as integers (because the integer
|
|
584 |
representation is more precise than the string one).
|
|
585 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
586 |
virtual bool result_as_int64_t(); |
1
by brian
clean slate |
587 |
bool is_datetime(); |
588 |
||
589 |
/*
|
|
590 |
Test whether an expression is expensive to compute. Used during
|
|
591 |
optimization to avoid computing expensive expressions during this
|
|
592 |
phase. Also used to force temp tables when sorting on expensive
|
|
593 |
functions.
|
|
594 |
TODO:
|
|
595 |
Normally we should have a method:
|
|
596 |
cost Item::execution_cost(),
|
|
597 |
where 'cost' is either 'double' or some structure of various cost
|
|
598 |
parameters.
|
|
599 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
600 |
virtual bool is_expensive(); |
601 |
||
1
by brian
clean slate |
602 |
String *check_well_formed_result(String *str, bool send_error= 0); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
603 |
bool eq_by_collation(Item *item, bool binary_cmp, |
604 |
const CHARSET_INFO * const cs); |
|
605 |
||
1
by brian
clean slate |
606 |
};
|
607 |
||
608 |
||
609 |
class Item_basic_constant :public Item |
|
610 |
{
|
|
611 |
public: |
|
612 |
/* to prevent drop fixed flag (no need parent cleanup call) */
|
|
613 |
void cleanup() |
|
614 |
{
|
|
615 |
/*
|
|
616 |
Restore the original field name as it might not have been allocated
|
|
617 |
in the statement memory. If the name is auto generated, it must be
|
|
618 |
done again between subsequent executions of a prepared statement.
|
|
619 |
*/
|
|
620 |
if (orig_name) |
|
621 |
name= orig_name; |
|
622 |
}
|
|
623 |
};
|
|
624 |
||
625 |
||
626 |
class Item_num: public Item_basic_constant |
|
627 |
{
|
|
628 |
public: |
|
629 |
Item_num() {} /* Remove gcc warning */ |
|
630 |
virtual Item_num *neg()= 0; |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
631 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
1
by brian
clean slate |
632 |
};
|
633 |
||
634 |
class Item_ident :public Item |
|
635 |
{
|
|
636 |
protected: |
|
637 |
/*
|
|
638 |
We have to store initial values of db_name, table_name and field_name
|
|
639 |
to be able to restore them during cleanup() because they can be
|
|
640 |
updated during fix_fields() to values from Field object and life-time
|
|
641 |
of those is shorter than life-time of Item_field.
|
|
642 |
*/
|
|
643 |
const char *orig_db_name; |
|
644 |
const char *orig_table_name; |
|
645 |
const char *orig_field_name; |
|
646 |
||
647 |
public: |
|
648 |
Name_resolution_context *context; |
|
649 |
const char *db_name; |
|
650 |
const char *table_name; |
|
651 |
const char *field_name; |
|
652 |
bool alias_name_used; /* true if item was resolved against alias */ |
|
653 |
/*
|
|
654 |
Cached value of index for this field in table->field array, used by prep.
|
|
584.4.10
by Monty Taylor
Broke out cached_item. |
655 |
stmts for speeding up their re-execution. Holds NO_CACHED_FIELD_INDEX
|
1
by brian
clean slate |
656 |
if index value is not known.
|
657 |
*/
|
|
482
by Brian Aker
Remove uint. |
658 |
uint32_t cached_field_index; |
1
by brian
clean slate |
659 |
/*
|
660 |
Cached pointer to table which contains this field, used for the same reason
|
|
661 |
by prep. stmt. too in case then we have not-fully qualified field.
|
|
662 |
0 - means no cached value.
|
|
663 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
664 |
TableList *cached_table; |
1
by brian
clean slate |
665 |
st_select_lex *depended_from; |
666 |
Item_ident(Name_resolution_context *context_arg, |
|
667 |
const char *db_name_arg, const char *table_name_arg, |
|
668 |
const char *field_name_arg); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
669 |
Item_ident(Session *session, Item_ident *item); |
1
by brian
clean slate |
670 |
const char *full_name() const; |
671 |
void cleanup(); |
|
481
by Brian Aker
Remove all of uchar. |
672 |
bool remove_dependence_processor(unsigned char * arg); |
1
by brian
clean slate |
673 |
virtual void print(String *str, enum_query_type query_type); |
481
by Brian Aker
Remove all of uchar. |
674 |
virtual bool change_context_processor(unsigned char *cntx) |
163
by Brian Aker
Merge Monty's code. |
675 |
{ context= (Name_resolution_context *)cntx; return false; } |
520.1.22
by Brian Aker
Second pass of thd cleanup |
676 |
friend bool insert_fields(Session *session, Name_resolution_context *context, |
1
by brian
clean slate |
677 |
const char *db_name, |
678 |
const char *table_name, List_iterator<Item> *it, |
|
679 |
bool any_privileges); |
|
680 |
};
|
|
681 |
||
682 |
||
683 |
class Item_ident_for_show :public Item |
|
684 |
{
|
|
685 |
public: |
|
686 |
Field *field; |
|
687 |
const char *db_name; |
|
688 |
const char *table_name; |
|
689 |
||
690 |
Item_ident_for_show(Field *par_field, const char *db_arg, |
|
691 |
const char *table_name_arg) |
|
692 |
:field(par_field), db_name(db_arg), table_name(table_name_arg) |
|
693 |
{}
|
|
694 |
||
695 |
enum Type type() const { return FIELD_ITEM; } |
|
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
696 |
double val_real(); |
697 |
int64_t val_int(); |
|
698 |
String *val_str(String *str); |
|
699 |
my_decimal *val_decimal(my_decimal *dec); |
|
1
by brian
clean slate |
700 |
void make_field(Send_field *tmp_field); |
701 |
};
|
|
702 |
||
703 |
||
704 |
class Item_field :public Item_ident |
|
705 |
{
|
|
706 |
protected: |
|
707 |
void set_field(Field *field); |
|
708 |
public: |
|
709 |
Field *field,*result_field; |
|
710 |
Item_equal *item_equal; |
|
711 |
bool no_const_subst; |
|
712 |
/*
|
|
163
by Brian Aker
Merge Monty's code. |
713 |
if any_privileges set to true then here real effective privileges will
|
1
by brian
clean slate |
714 |
be stored
|
715 |
*/
|
|
482
by Brian Aker
Remove uint. |
716 |
uint32_t have_privileges; |
1
by brian
clean slate |
717 |
/* field need any privileges (for VIEW creation) */
|
718 |
bool any_privileges; |
|
719 |
Item_field(Name_resolution_context *context_arg, |
|
720 |
const char *db_arg,const char *table_name_arg, |
|
721 |
const char *field_name_arg); |
|
722 |
/*
|
|
723 |
Constructor needed to process subselect with temporary tables (see Item)
|
|
724 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
725 |
Item_field(Session *session, Item_field *item); |
1
by brian
clean slate |
726 |
/*
|
727 |
Constructor used inside setup_wild(), ensures that field, table,
|
|
728 |
and database names will live as long as Item_field (this is important
|
|
729 |
in prepared statements).
|
|
730 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
731 |
Item_field(Session *session, Name_resolution_context *context_arg, Field *field); |
1
by brian
clean slate |
732 |
/*
|
733 |
If this constructor is used, fix_fields() won't work, because
|
|
734 |
db_name, table_name and column_name are unknown. It's necessary to call
|
|
735 |
reset_field() before fix_fields() for all fields created this way.
|
|
736 |
*/
|
|
737 |
Item_field(Field *field); |
|
738 |
enum Type type() const { return FIELD_ITEM; } |
|
739 |
bool eq(const Item *item, bool binary_cmp) const; |
|
740 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
741 |
int64_t val_int(); |
1
by brian
clean slate |
742 |
my_decimal *val_decimal(my_decimal *); |
743 |
String *val_str(String*); |
|
744 |
double val_result(); |
|
152
by Brian Aker
longlong replacement |
745 |
int64_t val_int_result(); |
1
by brian
clean slate |
746 |
String *str_result(String* tmp); |
747 |
my_decimal *val_decimal_result(my_decimal *); |
|
748 |
bool val_bool_result(); |
|
749 |
bool send(Protocol *protocol, String *str_arg); |
|
750 |
void reset_field(Field *f); |
|
520.1.21
by Brian Aker
THD -> Session rename |
751 |
bool fix_fields(Session *, Item **); |
1
by brian
clean slate |
752 |
void fix_after_pullout(st_select_lex *new_parent, Item **ref); |
753 |
void make_field(Send_field *tmp_field); |
|
754 |
int save_in_field(Field *field,bool no_conversions); |
|
755 |
void save_org_in_field(Field *field); |
|
756 |
table_map used_tables() const; |
|
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
757 |
enum Item_result result_type () const; |
758 |
Item_result cast_to_int_type() const; |
|
759 |
enum_field_types field_type() const; |
|
1
by brian
clean slate |
760 |
enum_monotonicity_info get_monotonicity_info() const |
761 |
{
|
|
762 |
return MONOTONIC_STRICT_INCREASING; |
|
763 |
}
|
|
152
by Brian Aker
longlong replacement |
764 |
int64_t val_int_endpoint(bool left_endp, bool *incl_endp); |
1
by brian
clean slate |
765 |
Field *get_tmp_table_field() { return result_field; } |
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
766 |
Field *tmp_table_field(Table *t_arg __attribute__((unused))) { return result_field; } |
482
by Brian Aker
Remove uint. |
767 |
bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
768 |
bool get_date_result(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
|
236.1.24
by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME. |
769 |
bool get_time(DRIZZLE_TIME *ltime); |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
770 |
bool is_null(); |
1
by brian
clean slate |
771 |
void update_null_value(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
772 |
Item *get_tmp_table_item(Session *session); |
481
by Brian Aker
Remove all of uchar. |
773 |
bool collect_item_field_processor(unsigned char * arg); |
774 |
bool find_item_in_field_list_processor(unsigned char *arg); |
|
775 |
bool register_field_in_read_map(unsigned char *arg); |
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
776 |
bool register_field_in_bitmap(unsigned char *arg); |
777 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
|
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
778 |
{ return false; } |
1
by brian
clean slate |
779 |
void cleanup(); |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
780 |
bool result_as_int64_t(); |
1
by brian
clean slate |
781 |
Item_equal *find_item_equal(COND_EQUAL *cond_equal); |
481
by Brian Aker
Remove all of uchar. |
782 |
bool subst_argument_checker(unsigned char **arg); |
783 |
Item *equal_fields_propagator(unsigned char *arg); |
|
784 |
bool set_no_const_sub(unsigned char *arg); |
|
785 |
Item *replace_equal_field(unsigned char *arg); |
|
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
786 |
uint32_t max_disp_length(); |
1
by brian
clean slate |
787 |
Item_field *filed_for_view_update() { return this; } |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
788 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
789 |
int fix_outer_field(Session *session, Field **field, Item **reference); |
481
by Brian Aker
Remove all of uchar. |
790 |
virtual Item *update_value_transformer(unsigned char *select_arg); |
1
by brian
clean slate |
791 |
virtual void print(String *str, enum_query_type query_type); |
792 |
||
793 |
friend class Item_default_value; |
|
794 |
friend class Item_insert_value; |
|
795 |
friend class st_select_lex_unit; |
|
796 |
};
|
|
797 |
||
798 |
class Item_null :public Item_basic_constant |
|
799 |
{
|
|
800 |
public: |
|
801 |
Item_null(char *name_par=0) |
|
802 |
{
|
|
163
by Brian Aker
Merge Monty's code. |
803 |
maybe_null= null_value= true; |
1
by brian
clean slate |
804 |
max_length= 0; |
805 |
name= name_par ? name_par : (char*) "NULL"; |
|
806 |
fixed= 1; |
|
807 |
collation.set(&my_charset_bin, DERIVATION_IGNORABLE); |
|
808 |
}
|
|
809 |
enum Type type() const { return NULL_ITEM; } |
|
810 |
bool eq(const Item *item, bool binary_cmp) const; |
|
811 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
812 |
int64_t val_int(); |
1
by brian
clean slate |
813 |
String *val_str(String *str); |
814 |
my_decimal *val_decimal(my_decimal *); |
|
815 |
int save_in_field(Field *field, bool no_conversions); |
|
816 |
int save_safe_in_field(Field *field); |
|
817 |
bool send(Protocol *protocol, String *str); |
|
818 |
enum Item_result result_type () const { return STRING_RESULT; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
819 |
enum_field_types field_type() const { return DRIZZLE_TYPE_NULL; } |
1
by brian
clean slate |
820 |
bool basic_const_item() const { return 1; } |
821 |
Item *clone_item() { return new Item_null(name); } |
|
822 |
bool is_null() { return 1; } |
|
823 |
||
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
824 |
virtual inline void print(String *str, |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
825 |
enum_query_type query_type __attribute__((unused))) |
1
by brian
clean slate |
826 |
{
|
827 |
str->append(STRING_WITH_LEN("NULL")); |
|
828 |
}
|
|
829 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
830 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
481.3.1
by Monty Taylor
Merged vcol stuff. |
831 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
832 |
{ return false; } |
1
by brian
clean slate |
833 |
};
|
834 |
||
835 |
class Item_null_result :public Item_null |
|
836 |
{
|
|
837 |
public: |
|
838 |
Field *result_field; |
|
839 |
Item_null_result() : Item_null(), result_field(0) {} |
|
840 |
bool is_result_field() { return result_field != 0; } |
|
841 |
void save_in_result_field(bool no_conversions) |
|
842 |
{
|
|
843 |
save_in_field(result_field, no_conversions); |
|
844 |
}
|
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
845 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
846 |
{ return true; } |
1
by brian
clean slate |
847 |
};
|
848 |
||
849 |
/* Item represents one placeholder ('?') of prepared statement */
|
|
850 |
||
851 |
class Item_param :public Item |
|
852 |
{
|
|
853 |
char cnvbuf[MAX_FIELD_WIDTH]; |
|
854 |
String cnvstr; |
|
855 |
Item *cnvitem; |
|
856 |
||
857 |
public: |
|
858 |
enum enum_item_param_state |
|
859 |
{
|
|
860 |
NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, |
|
861 |
STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE, |
|
862 |
DECIMAL_VALUE
|
|
863 |
} state; |
|
864 |
||
865 |
/*
|
|
866 |
A buffer for string and long data values. Historically all allocated
|
|
867 |
values returned from val_str() were treated as eligible to
|
|
868 |
modification. I. e. in some cases Item_func_concat can append it's
|
|
869 |
second argument to return value of the first one. Because of that we
|
|
870 |
can't return the original buffer holding string data from val_str(),
|
|
871 |
and have to have one buffer for data and another just pointing to
|
|
872 |
the data. This is the latter one and it's returned from val_str().
|
|
873 |
Can not be declared inside the union as it's not a POD type.
|
|
874 |
*/
|
|
875 |
String str_value_ptr; |
|
876 |
my_decimal decimal_value; |
|
877 |
union
|
|
878 |
{
|
|
152
by Brian Aker
longlong replacement |
879 |
int64_t integer; |
1
by brian
clean slate |
880 |
double real; |
881 |
/*
|
|
882 |
Character sets conversion info for string values.
|
|
883 |
Character sets of client and connection defined at bind time are used
|
|
884 |
for all conversions, even if one of them is later changed (i.e.
|
|
885 |
between subsequent calls to mysql_stmt_execute).
|
|
886 |
*/
|
|
887 |
struct CONVERSION_INFO |
|
888 |
{
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
889 |
const CHARSET_INFO *character_set_client; |
890 |
const CHARSET_INFO *character_set_of_placeholder; |
|
1
by brian
clean slate |
891 |
/*
|
892 |
This points at character set of connection if conversion
|
|
893 |
to it is required (i. e. if placeholder typecode is not BLOB).
|
|
894 |
Otherwise it's equal to character_set_client (to simplify
|
|
895 |
check in convert_str_value()).
|
|
896 |
*/
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
897 |
const CHARSET_INFO *final_character_set_of_str_value; |
1
by brian
clean slate |
898 |
} cs_info; |
236.1.24
by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME. |
899 |
DRIZZLE_TIME time; |
1
by brian
clean slate |
900 |
} value; |
901 |
||
902 |
/* Cached values for virtual methods to save us one switch. */
|
|
903 |
enum Item_result item_result_type; |
|
904 |
enum Type item_type; |
|
905 |
||
906 |
/*
|
|
907 |
Used when this item is used in a temporary table.
|
|
908 |
This is NOT placeholder metadata sent to client, as this value
|
|
909 |
is assigned after sending metadata (in setup_one_conversion_function).
|
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
910 |
For example in case of 'SELECT ?' you'll get DRIZZLE_TYPE_STRING both
|
1
by brian
clean slate |
911 |
in result set and placeholders metadata, no matter what type you will
|
912 |
supply for this placeholder in mysql_stmt_execute.
|
|
913 |
*/
|
|
914 |
enum enum_field_types param_type; |
|
915 |
/*
|
|
916 |
Offset of placeholder inside statement text. Used to create
|
|
917 |
no-placeholders version of this statement for the binary log.
|
|
918 |
*/
|
|
482
by Brian Aker
Remove uint. |
919 |
uint32_t pos_in_query; |
1
by brian
clean slate |
920 |
|
482
by Brian Aker
Remove uint. |
921 |
Item_param(uint32_t pos_in_query_arg); |
1
by brian
clean slate |
922 |
|
923 |
enum Item_result result_type () const { return item_result_type; } |
|
924 |
enum Type type() const { return item_type; } |
|
925 |
enum_field_types field_type() const { return param_type; } |
|
926 |
||
927 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
928 |
int64_t val_int(); |
1
by brian
clean slate |
929 |
my_decimal *val_decimal(my_decimal*); |
930 |
String *val_str(String*); |
|
236.1.24
by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME. |
931 |
bool get_time(DRIZZLE_TIME *tm); |
482
by Brian Aker
Remove uint. |
932 |
bool get_date(DRIZZLE_TIME *tm, uint32_t fuzzydate); |
1
by brian
clean slate |
933 |
int save_in_field(Field *field, bool no_conversions); |
934 |
||
935 |
void set_null(); |
|
203
by Brian Aker
Small cleanup around uint32 types (need to merge). |
936 |
void set_int(int64_t i, uint32_t max_length_arg); |
1
by brian
clean slate |
937 |
void set_double(double i); |
287.3.11
by Monty Taylor
Rolled back a couple of overly anxious consts. |
938 |
void set_decimal(char *str, ulong length); |
1
by brian
clean slate |
939 |
bool set_str(const char *str, ulong length); |
940 |
bool set_longdata(const char *str, ulong length); |
|
398.1.1
by Monty Taylor
Remove typedef enum enum_drizzle_timestamp_type timestamp_type; |
941 |
void set_time(DRIZZLE_TIME *tm, enum enum_drizzle_timestamp_type type, |
942 |
uint32_t max_length_arg); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
943 |
bool set_from_user_var(Session *session, const user_var_entry *entry); |
1
by brian
clean slate |
944 |
void reset(); |
945 |
/*
|
|
946 |
Assign placeholder value from bind data.
|
|
947 |
Note, that 'len' has different semantics in embedded library (as we
|
|
948 |
don't need to check that packet is not broken there). See
|
|
949 |
sql_prepare.cc for details.
|
|
950 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
951 |
void (*set_param_func)(Item_param *param, unsigned char **pos, ulong len); |
1
by brian
clean slate |
952 |
|
953 |
const String *query_val_str(String *str) const; |
|
954 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
955 |
bool convert_str_value(Session *session); |
1
by brian
clean slate |
956 |
|
957 |
/*
|
|
958 |
If value for parameter was not set we treat it as non-const
|
|
959 |
so noone will use parameters value in fix_fields still
|
|
960 |
parameter is constant during execution.
|
|
961 |
*/
|
|
962 |
virtual table_map used_tables() const |
|
963 |
{ return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; } |
|
964 |
virtual void print(String *str, enum_query_type query_type); |
|
965 |
bool is_null() |
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
966 |
{ assert(state != NO_VALUE); return state == NULL_VALUE; } |
1
by brian
clean slate |
967 |
bool basic_const_item() const; |
968 |
/*
|
|
969 |
This method is used to make a copy of a basic constant item when
|
|
970 |
propagating constants in the optimizer. The reason to create a new
|
|
971 |
item and not use the existing one is not precisely known (2005/04/16).
|
|
972 |
Probably we are trying to preserve tree structure of items, in other
|
|
973 |
words, avoid pointing at one item from two different nodes of the tree.
|
|
974 |
Return a new basic constant item if parameter value is a basic
|
|
975 |
constant, assert otherwise. This method is called only if
|
|
163
by Brian Aker
Merge Monty's code. |
976 |
basic_const_item returned true.
|
1
by brian
clean slate |
977 |
*/
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
978 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
1
by brian
clean slate |
979 |
Item *clone_item(); |
980 |
/*
|
|
981 |
Implement by-value equality evaluation if parameter value
|
|
982 |
is set and is a basic constant (integer, real or string).
|
|
163
by Brian Aker
Merge Monty's code. |
983 |
Otherwise return false.
|
1
by brian
clean slate |
984 |
*/
|
985 |
bool eq(const Item *item, bool binary_cmp) const; |
|
986 |
/** Item is a argument to a limit clause. */
|
|
987 |
bool limit_clause_param; |
|
988 |
};
|
|
989 |
||
990 |
||
991 |
class Item_int :public Item_num |
|
992 |
{
|
|
993 |
public: |
|
152
by Brian Aker
longlong replacement |
994 |
int64_t value; |
482
by Brian Aker
Remove uint. |
995 |
Item_int(int32_t i,uint32_t length= MY_INT32_NUM_DECIMAL_DIGITS) |
152
by Brian Aker
longlong replacement |
996 |
:value((int64_t) i) |
1
by brian
clean slate |
997 |
{ max_length=length; fixed= 1; } |
482
by Brian Aker
Remove uint. |
998 |
Item_int(int64_t i,uint32_t length= MY_INT64_NUM_DECIMAL_DIGITS) |
1
by brian
clean slate |
999 |
:value(i) |
1000 |
{ max_length=length; fixed= 1; } |
|
482
by Brian Aker
Remove uint. |
1001 |
Item_int(uint64_t i, uint32_t length= MY_INT64_NUM_DECIMAL_DIGITS) |
152
by Brian Aker
longlong replacement |
1002 |
:value((int64_t)i) |
1
by brian
clean slate |
1003 |
{ max_length=length; fixed= 1; unsigned_flag= 1; } |
482
by Brian Aker
Remove uint. |
1004 |
Item_int(const char *str_arg,int64_t i,uint32_t length) :value(i) |
1
by brian
clean slate |
1005 |
{ max_length=length; name=(char*) str_arg; fixed= 1; } |
482
by Brian Aker
Remove uint. |
1006 |
Item_int(const char *str_arg, uint32_t length=64); |
1
by brian
clean slate |
1007 |
enum Type type() const { return INT_ITEM; } |
1008 |
enum Item_result result_type () const { return INT_RESULT; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1009 |
enum_field_types field_type() const { return DRIZZLE_TYPE_LONGLONG; } |
152
by Brian Aker
longlong replacement |
1010 |
int64_t val_int() { assert(fixed == 1); return value; } |
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1011 |
double val_real() { assert(fixed == 1); return (double) value; } |
1
by brian
clean slate |
1012 |
my_decimal *val_decimal(my_decimal *); |
1013 |
String *val_str(String*); |
|
1014 |
int save_in_field(Field *field, bool no_conversions); |
|
1015 |
bool basic_const_item() const { return 1; } |
|
1016 |
Item *clone_item() { return new Item_int(name,value,max_length); } |
|
1017 |
virtual void print(String *str, enum_query_type query_type); |
|
1018 |
Item_num *neg() { value= -value; return this; } |
|
482
by Brian Aker
Remove uint. |
1019 |
uint32_t decimal_precision() const |
1
by brian
clean slate |
1020 |
{ return (uint)(max_length - test(value < 0)); } |
1021 |
bool eq(const Item *, bool binary_cmp) const; |
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
1022 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1023 |
{ return false; } |
1
by brian
clean slate |
1024 |
};
|
1025 |
||
1026 |
||
1027 |
class Item_uint :public Item_int |
|
1028 |
{
|
|
1029 |
public: |
|
482
by Brian Aker
Remove uint. |
1030 |
Item_uint(const char *str_arg, uint32_t length); |
151
by Brian Aker
Ulonglong to uint64_t |
1031 |
Item_uint(uint64_t i) :Item_int((uint64_t) i, 10) {} |
482
by Brian Aker
Remove uint. |
1032 |
Item_uint(const char *str_arg, int64_t i, uint32_t length); |
1
by brian
clean slate |
1033 |
double val_real() |
151
by Brian Aker
Ulonglong to uint64_t |
1034 |
{ assert(fixed == 1); return uint64_t2double((uint64_t)value); } |
1
by brian
clean slate |
1035 |
String *val_str(String*); |
1036 |
Item *clone_item() { return new Item_uint(name, value, max_length); } |
|
1037 |
int save_in_field(Field *field, bool no_conversions); |
|
1038 |
virtual void print(String *str, enum_query_type query_type); |
|
1039 |
Item_num *neg (); |
|
482
by Brian Aker
Remove uint. |
1040 |
uint32_t decimal_precision() const { return max_length; } |
481.3.1
by Monty Taylor
Merged vcol stuff. |
1041 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1042 |
{ return false; } |
1
by brian
clean slate |
1043 |
};
|
1044 |
||
1045 |
||
1046 |
/* decimal (fixed point) constant */
|
|
1047 |
class Item_decimal :public Item_num |
|
1048 |
{
|
|
1049 |
protected: |
|
1050 |
my_decimal decimal_value; |
|
1051 |
public: |
|
482
by Brian Aker
Remove uint. |
1052 |
Item_decimal(const char *str_arg, uint32_t length, const CHARSET_INFO * const charset); |
1
by brian
clean slate |
1053 |
Item_decimal(const char *str, const my_decimal *val_arg, |
482
by Brian Aker
Remove uint. |
1054 |
uint32_t decimal_par, uint32_t length); |
1
by brian
clean slate |
1055 |
Item_decimal(my_decimal *value_par); |
152
by Brian Aker
longlong replacement |
1056 |
Item_decimal(int64_t val, bool unsig); |
1
by brian
clean slate |
1057 |
Item_decimal(double val, int precision, int scale); |
481
by Brian Aker
Remove all of uchar. |
1058 |
Item_decimal(const unsigned char *bin, int precision, int scale); |
1
by brian
clean slate |
1059 |
|
1060 |
enum Type type() const { return DECIMAL_ITEM; } |
|
1061 |
enum Item_result result_type () const { return DECIMAL_RESULT; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1062 |
enum_field_types field_type() const { return DRIZZLE_TYPE_NEWDECIMAL; } |
152
by Brian Aker
longlong replacement |
1063 |
int64_t val_int(); |
1
by brian
clean slate |
1064 |
double val_real(); |
1065 |
String *val_str(String*); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1066 |
my_decimal *val_decimal(my_decimal *val __attribute__((unused))) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1067 |
{ return &decimal_value; } |
1
by brian
clean slate |
1068 |
int save_in_field(Field *field, bool no_conversions); |
1069 |
bool basic_const_item() const { return 1; } |
|
1070 |
Item *clone_item() |
|
1071 |
{
|
|
1072 |
return new Item_decimal(name, &decimal_value, decimals, max_length); |
|
1073 |
}
|
|
1074 |
virtual void print(String *str, enum_query_type query_type); |
|
1075 |
Item_num *neg() |
|
1076 |
{
|
|
1077 |
my_decimal_neg(&decimal_value); |
|
1078 |
unsigned_flag= !decimal_value.sign(); |
|
1079 |
return this; |
|
1080 |
}
|
|
482
by Brian Aker
Remove uint. |
1081 |
uint32_t decimal_precision() const { return decimal_value.precision(); } |
1
by brian
clean slate |
1082 |
bool eq(const Item *, bool binary_cmp) const; |
1083 |
void set_decimal_value(my_decimal *value_par); |
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
1084 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1085 |
{ return false; } |
1
by brian
clean slate |
1086 |
};
|
1087 |
||
1088 |
||
1089 |
class Item_float :public Item_num |
|
1090 |
{
|
|
1091 |
char *presentation; |
|
1092 |
public: |
|
1093 |
double value; |
|
1094 |
// Item_real() :value(0) {}
|
|
482
by Brian Aker
Remove uint. |
1095 |
Item_float(const char *str_arg, uint32_t length); |
1096 |
Item_float(const char *str,double val_arg,uint32_t decimal_par,uint32_t length) |
|
1
by brian
clean slate |
1097 |
:value(val_arg) |
1098 |
{
|
|
1099 |
presentation= name=(char*) str; |
|
206
by Brian Aker
Removed final uint dead types. |
1100 |
decimals=(uint8_t) decimal_par; |
1
by brian
clean slate |
1101 |
max_length=length; |
1102 |
fixed= 1; |
|
1103 |
}
|
|
482
by Brian Aker
Remove uint. |
1104 |
Item_float(double value_par, uint32_t decimal_par) :presentation(0), value(value_par) |
1
by brian
clean slate |
1105 |
{
|
206
by Brian Aker
Removed final uint dead types. |
1106 |
decimals= (uint8_t) decimal_par; |
1
by brian
clean slate |
1107 |
fixed= 1; |
1108 |
}
|
|
1109 |
int save_in_field(Field *field, bool no_conversions); |
|
1110 |
enum Type type() const { return REAL_ITEM; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1111 |
enum_field_types field_type() const { return DRIZZLE_TYPE_DOUBLE; } |
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1112 |
double val_real() { assert(fixed == 1); return value; } |
572.1.4
by Monty Taylor
Removed a bunch of unusued tests and defines from autoconf. |
1113 |
int64_t val_int(); |
1
by brian
clean slate |
1114 |
String *val_str(String*); |
1115 |
my_decimal *val_decimal(my_decimal *); |
|
1116 |
bool basic_const_item() const { return 1; } |
|
1117 |
Item *clone_item() |
|
1118 |
{ return new Item_float(name, value, decimals, max_length); } |
|
1119 |
Item_num *neg() { value= -value; return this; } |
|
1120 |
virtual void print(String *str, enum_query_type query_type); |
|
1121 |
bool eq(const Item *, bool binary_cmp) const; |
|
1122 |
};
|
|
1123 |
||
1124 |
||
1125 |
class Item_static_float_func :public Item_float |
|
1126 |
{
|
|
1127 |
const char *func_name; |
|
1128 |
public: |
|
482
by Brian Aker
Remove uint. |
1129 |
Item_static_float_func(const char *str, double val_arg, uint32_t decimal_par, |
1130 |
uint32_t length) |
|
461
by Monty Taylor
Removed NullS. bu-bye. |
1131 |
:Item_float(NULL, val_arg, decimal_par, length), func_name(str) |
1
by brian
clean slate |
1132 |
{}
|
1133 |
||
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1134 |
virtual inline void print(String *str, |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1135 |
enum_query_type query_type __attribute__((unused))) |
1
by brian
clean slate |
1136 |
{
|
1137 |
str->append(func_name); |
|
1138 |
}
|
|
1139 |
||
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1140 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
481.3.1
by Monty Taylor
Merged vcol stuff. |
1141 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1142 |
{ return false; } |
1
by brian
clean slate |
1143 |
};
|
1144 |
||
1145 |
||
1146 |
class Item_string :public Item_basic_constant |
|
1147 |
{
|
|
1148 |
public: |
|
482
by Brian Aker
Remove uint. |
1149 |
Item_string(const char *str,uint32_t length, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1150 |
const CHARSET_INFO * const cs, Derivation dv= DERIVATION_COERCIBLE, |
482
by Brian Aker
Remove uint. |
1151 |
uint32_t repertoire= MY_REPERTOIRE_UNICODE30) |
163
by Brian Aker
Merge Monty's code. |
1152 |
: m_cs_specified(false) |
1
by brian
clean slate |
1153 |
{
|
1154 |
str_value.set_or_copy_aligned(str, length, cs); |
|
1155 |
collation.set(cs, dv, repertoire); |
|
1156 |
/*
|
|
1157 |
We have to have a different max_length than 'length' here to
|
|
1158 |
ensure that we get the right length if we do use the item
|
|
1159 |
to create a new table. In this case max_length must be the maximum
|
|
1160 |
number of chars for a string of this type because we in Create_field::
|
|
1161 |
divide the max_length with mbmaxlen).
|
|
1162 |
*/
|
|
1163 |
max_length= str_value.numchars()*cs->mbmaxlen; |
|
1164 |
set_name(str, length, cs); |
|
1165 |
decimals=NOT_FIXED_DEC; |
|
1166 |
// it is constant => can be used without fix_fields (and frequently used)
|
|
1167 |
fixed= 1; |
|
1168 |
}
|
|
1169 |
/* Just create an item and do not fill string representation */
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1170 |
Item_string(const CHARSET_INFO * const cs, Derivation dv= DERIVATION_COERCIBLE) |
163
by Brian Aker
Merge Monty's code. |
1171 |
: m_cs_specified(false) |
1
by brian
clean slate |
1172 |
{
|
1173 |
collation.set(cs, dv); |
|
1174 |
max_length= 0; |
|
1175 |
set_name(NULL, 0, cs); |
|
1176 |
decimals= NOT_FIXED_DEC; |
|
1177 |
fixed= 1; |
|
1178 |
}
|
|
482
by Brian Aker
Remove uint. |
1179 |
Item_string(const char *name_par, const char *str, uint32_t length, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1180 |
const CHARSET_INFO * const cs, Derivation dv= DERIVATION_COERCIBLE, |
482
by Brian Aker
Remove uint. |
1181 |
uint32_t repertoire= MY_REPERTOIRE_UNICODE30) |
163
by Brian Aker
Merge Monty's code. |
1182 |
: m_cs_specified(false) |
1
by brian
clean slate |
1183 |
{
|
1184 |
str_value.set_or_copy_aligned(str, length, cs); |
|
1185 |
collation.set(cs, dv, repertoire); |
|
1186 |
max_length= str_value.numchars()*cs->mbmaxlen; |
|
1187 |
set_name(name_par, 0, cs); |
|
1188 |
decimals=NOT_FIXED_DEC; |
|
1189 |
// it is constant => can be used without fix_fields (and frequently used)
|
|
1190 |
fixed= 1; |
|
1191 |
}
|
|
1192 |
void set_repertoire_from_value() |
|
1193 |
{
|
|
1194 |
collation.repertoire= my_string_repertoire(str_value.charset(), |
|
1195 |
str_value.ptr(), |
|
1196 |
str_value.length()); |
|
1197 |
}
|
|
1198 |
enum Type type() const { return STRING_ITEM; } |
|
1199 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
1200 |
int64_t val_int(); |
1
by brian
clean slate |
1201 |
String *val_str(String*) |
1202 |
{
|
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1203 |
assert(fixed == 1); |
1
by brian
clean slate |
1204 |
return (String*) &str_value; |
1205 |
}
|
|
1206 |
my_decimal *val_decimal(my_decimal *); |
|
1207 |
int save_in_field(Field *field, bool no_conversions); |
|
1208 |
enum Item_result result_type () const { return STRING_RESULT; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1209 |
enum_field_types field_type() const { return DRIZZLE_TYPE_VARCHAR; } |
1
by brian
clean slate |
1210 |
bool basic_const_item() const { return 1; } |
1211 |
bool eq(const Item *item, bool binary_cmp) const; |
|
1212 |
Item *clone_item() |
|
1213 |
{
|
|
1214 |
return new Item_string(name, str_value.ptr(), |
|
1215 |
str_value.length(), collation.collation); |
|
1216 |
}
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1217 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
482
by Brian Aker
Remove uint. |
1218 |
inline void append(char *str, uint32_t length) |
1
by brian
clean slate |
1219 |
{
|
1220 |
str_value.append(str, length); |
|
1221 |
max_length= str_value.numchars() * collation.collation->mbmaxlen; |
|
1222 |
}
|
|
1223 |
virtual void print(String *str, enum_query_type query_type); |
|
1224 |
||
1225 |
/**
|
|
163
by Brian Aker
Merge Monty's code. |
1226 |
Return true if character-set-introducer was explicitly specified in the
|
1
by brian
clean slate |
1227 |
original query for this item (text literal).
|
1228 |
||
1229 |
This operation is to be called from Item_string::print(). The idea is
|
|
1230 |
that when a query is generated (re-constructed) from the Item-tree,
|
|
1231 |
character-set-introducers should appear only for those literals, where
|
|
1232 |
they were explicitly specified by the user. Otherwise, that may lead to
|
|
1233 |
loss collation information (character set introducers implies default
|
|
1234 |
collation for the literal).
|
|
1235 |
||
1236 |
Basically, that makes sense only for views and hopefully will be gone
|
|
1237 |
one day when we start using original query as a view definition.
|
|
1238 |
||
1239 |
@return This operation returns the value of m_cs_specified attribute.
|
|
163
by Brian Aker
Merge Monty's code. |
1240 |
@retval true if character set introducer was explicitly specified in
|
1
by brian
clean slate |
1241 |
the original query.
|
163
by Brian Aker
Merge Monty's code. |
1242 |
@retval false otherwise.
|
1
by brian
clean slate |
1243 |
*/
|
1244 |
inline bool is_cs_specified() const |
|
1245 |
{
|
|
1246 |
return m_cs_specified; |
|
1247 |
}
|
|
1248 |
||
1249 |
/**
|
|
1250 |
Set the value of m_cs_specified attribute.
|
|
1251 |
||
1252 |
m_cs_specified attribute shows whether character-set-introducer was
|
|
1253 |
explicitly specified in the original query for this text literal or
|
|
1254 |
not. The attribute makes sense (is used) only for views.
|
|
1255 |
||
1256 |
This operation is to be called from the parser during parsing an input
|
|
1257 |
query.
|
|
1258 |
*/
|
|
1259 |
inline void set_cs_specified(bool cs_specified) |
|
1260 |
{
|
|
1261 |
m_cs_specified= cs_specified; |
|
1262 |
}
|
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
1263 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1264 |
{ return false; } |
1
by brian
clean slate |
1265 |
|
1266 |
private: |
|
1267 |
bool m_cs_specified; |
|
1268 |
};
|
|
1269 |
||
1270 |
||
1271 |
class Item_static_string_func :public Item_string |
|
1272 |
{
|
|
1273 |
const char *func_name; |
|
1274 |
public: |
|
482
by Brian Aker
Remove uint. |
1275 |
Item_static_string_func(const char *name_par, const char *str, uint32_t length, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1276 |
const CHARSET_INFO * const cs, |
1
by brian
clean slate |
1277 |
Derivation dv= DERIVATION_COERCIBLE) |
461
by Monty Taylor
Removed NullS. bu-bye. |
1278 |
:Item_string(NULL, str, length, cs, dv), func_name(name_par) |
1
by brian
clean slate |
1279 |
{}
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1280 |
Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
1
by brian
clean slate |
1281 |
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1282 |
virtual inline void print(String *str, |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1283 |
enum_query_type query_type __attribute__((unused))) |
1
by brian
clean slate |
1284 |
{
|
1285 |
str->append(func_name); |
|
1286 |
}
|
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
1287 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1288 |
{ return true; } |
1
by brian
clean slate |
1289 |
};
|
1290 |
||
1291 |
||
1292 |
/* for show tables */
|
|
1293 |
class Item_return_date_time :public Item_string |
|
1294 |
{
|
|
1295 |
enum_field_types date_time_field_type; |
|
1296 |
public: |
|
1297 |
Item_return_date_time(const char *name_arg, enum_field_types field_type_arg) |
|
1298 |
:Item_string(name_arg, 0, &my_charset_bin), |
|
1299 |
date_time_field_type(field_type_arg) |
|
1300 |
{ } |
|
1301 |
enum_field_types field_type() const { return date_time_field_type; } |
|
1302 |
};
|
|
1303 |
||
1304 |
||
1305 |
class Item_blob :public Item_string |
|
1306 |
{
|
|
1307 |
public: |
|
482
by Brian Aker
Remove uint. |
1308 |
Item_blob(const char *name, uint32_t length) : |
1
by brian
clean slate |
1309 |
Item_string(name, length, &my_charset_bin) |
1310 |
{ max_length= length; } |
|
1311 |
enum Type type() const { return TYPE_HOLDER; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1312 |
enum_field_types field_type() const { return DRIZZLE_TYPE_BLOB; } |
1
by brian
clean slate |
1313 |
};
|
1314 |
||
1315 |
||
1316 |
/**
|
|
1317 |
Item_empty_string -- is a utility class to put an item into List<Item>
|
|
1318 |
which is then used in protocol.send_fields() when sending SHOW output to
|
|
1319 |
the client.
|
|
1320 |
*/
|
|
1321 |
||
1322 |
class Item_empty_string :public Item_string |
|
1323 |
{
|
|
1324 |
public: |
|
482
by Brian Aker
Remove uint. |
1325 |
Item_empty_string(const char *header,uint32_t length, const CHARSET_INFO * cs= NULL) : |
1
by brian
clean slate |
1326 |
Item_string("",0, cs ? cs : &my_charset_utf8_general_ci) |
1327 |
{ name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; } |
|
1328 |
void make_field(Send_field *field); |
|
1329 |
};
|
|
1330 |
||
1331 |
||
1332 |
class Item_return_int :public Item_int |
|
1333 |
{
|
|
1334 |
enum_field_types int_field_type; |
|
1335 |
public: |
|
482
by Brian Aker
Remove uint. |
1336 |
Item_return_int(const char *name_arg, uint32_t length, |
152
by Brian Aker
longlong replacement |
1337 |
enum_field_types field_type_arg, int64_t value= 0) |
1
by brian
clean slate |
1338 |
:Item_int(name_arg, value, length), int_field_type(field_type_arg) |
1339 |
{
|
|
1340 |
unsigned_flag=1; |
|
1341 |
}
|
|
1342 |
enum_field_types field_type() const { return int_field_type; } |
|
1343 |
};
|
|
1344 |
||
1345 |
||
1346 |
class Item_hex_string: public Item_basic_constant |
|
1347 |
{
|
|
1348 |
public: |
|
1349 |
Item_hex_string() {} |
|
482
by Brian Aker
Remove uint. |
1350 |
Item_hex_string(const char *str,uint32_t str_length); |
1
by brian
clean slate |
1351 |
enum Type type() const { return VARBIN_ITEM; } |
1352 |
double val_real() |
|
1353 |
{
|
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1354 |
assert(fixed == 1); |
151
by Brian Aker
Ulonglong to uint64_t |
1355 |
return (double) (uint64_t) Item_hex_string::val_int(); |
1
by brian
clean slate |
1356 |
}
|
152
by Brian Aker
longlong replacement |
1357 |
int64_t val_int(); |
1
by brian
clean slate |
1358 |
bool basic_const_item() const { return 1; } |
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1359 |
String *val_str(String*) { assert(fixed == 1); return &str_value; } |
1
by brian
clean slate |
1360 |
my_decimal *val_decimal(my_decimal *); |
1361 |
int save_in_field(Field *field, bool no_conversions); |
|
1362 |
enum Item_result result_type () const { return STRING_RESULT; } |
|
1363 |
enum Item_result cast_to_int_type() const { return INT_RESULT; } |
|
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
1364 |
enum_field_types field_type() const { return DRIZZLE_TYPE_VARCHAR; } |
1
by brian
clean slate |
1365 |
virtual void print(String *str, enum_query_type query_type); |
1366 |
bool eq(const Item *item, bool binary_cmp) const; |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1367 |
virtual Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
481.3.1
by Monty Taylor
Merged vcol stuff. |
1368 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1369 |
{ return false; } |
1
by brian
clean slate |
1370 |
};
|
1371 |
||
1372 |
||
1373 |
class Item_bin_string: public Item_hex_string |
|
1374 |
{
|
|
1375 |
public: |
|
482
by Brian Aker
Remove uint. |
1376 |
Item_bin_string(const char *str,uint32_t str_length); |
1
by brian
clean slate |
1377 |
};
|
1378 |
||
1379 |
class Item_result_field :public Item /* Item with result field */ |
|
1380 |
{
|
|
1381 |
public: |
|
1382 |
Field *result_field; /* Save result here */ |
|
1383 |
Item_result_field() :result_field(0) {} |
|
1384 |
// Constructor used for Item_sum/Item_cond_and/or (see Item comment)
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1385 |
Item_result_field(Session *session, Item_result_field *item): |
1386 |
Item(session, item), result_field(item->result_field) |
|
1
by brian
clean slate |
1387 |
{}
|
1388 |
~Item_result_field() {} /* Required with gcc 2.95 */ |
|
1389 |
Field *get_tmp_table_field() { return result_field; } |
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
1390 |
Field *tmp_table_field(Table *t_arg __attribute__((unused))) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1391 |
{ return result_field; } |
1
by brian
clean slate |
1392 |
table_map used_tables() const { return 1; } |
1393 |
virtual void fix_length_and_dec()=0; |
|
1394 |
void set_result_field(Field *field) { result_field= field; } |
|
1395 |
bool is_result_field() { return 1; } |
|
1396 |
void save_in_result_field(bool no_conversions) |
|
1397 |
{
|
|
1398 |
save_in_field(result_field, no_conversions); |
|
1399 |
}
|
|
1400 |
void cleanup(); |
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
1401 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1402 |
{ return false; } |
1
by brian
clean slate |
1403 |
};
|
1404 |
||
1405 |
||
1406 |
class Item_ref :public Item_ident |
|
1407 |
{
|
|
1408 |
protected: |
|
1409 |
void set_properties(); |
|
1410 |
public: |
|
1411 |
enum Ref_Type { REF, DIRECT_REF, VIEW_REF, OUTER_REF }; |
|
1412 |
Field *result_field; /* Save result here */ |
|
1413 |
Item **ref; |
|
1414 |
Item_ref(Name_resolution_context *context_arg, |
|
1415 |
const char *db_arg, const char *table_name_arg, |
|
1416 |
const char *field_name_arg) |
|
1417 |
:Item_ident(context_arg, db_arg, table_name_arg, field_name_arg), |
|
1418 |
result_field(0), ref(0) {} |
|
1419 |
/*
|
|
1420 |
This constructor is used in two scenarios:
|
|
1421 |
A) *item = NULL
|
|
1422 |
No initialization is performed, fix_fields() call will be necessary.
|
|
1423 |
|
|
1424 |
B) *item points to an Item this Item_ref will refer to. This is
|
|
1425 |
used for GROUP BY. fix_fields() will not be called in this case,
|
|
1426 |
so we call set_properties to make this item "fixed". set_properties
|
|
1427 |
performs a subset of action Item_ref::fix_fields does, and this subset
|
|
1428 |
is enough for Item_ref's used in GROUP BY.
|
|
1429 |
|
|
1430 |
TODO we probably fix a superset of problems like in BUG#6658. Check this
|
|
1431 |
with Bar, and if we have a more broader set of problems like this.
|
|
1432 |
*/
|
|
1433 |
Item_ref(Name_resolution_context *context_arg, Item **item, |
|
1434 |
const char *table_name_arg, const char *field_name_arg, |
|
163
by Brian Aker
Merge Monty's code. |
1435 |
bool alias_name_used_arg= false); |
1
by brian
clean slate |
1436 |
|
1437 |
/* Constructor need to process subselect with temporary tables (see Item) */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1438 |
Item_ref(Session *session, Item_ref *item) |
1439 |
:Item_ident(session, item), result_field(item->result_field), ref(item->ref) {} |
|
1
by brian
clean slate |
1440 |
enum Type type() const { return REF_ITEM; } |
1441 |
bool eq(const Item *item, bool binary_cmp) const |
|
1442 |
{
|
|
1443 |
Item *it= ((Item *) item)->real_item(); |
|
1444 |
return ref && (*ref)->eq(it, binary_cmp); |
|
1445 |
}
|
|
1446 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
1447 |
int64_t val_int(); |
1
by brian
clean slate |
1448 |
my_decimal *val_decimal(my_decimal *); |
1449 |
bool val_bool(); |
|
1450 |
String *val_str(String* tmp); |
|
1451 |
bool is_null(); |
|
482
by Brian Aker
Remove uint. |
1452 |
bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
1
by brian
clean slate |
1453 |
double val_result(); |
152
by Brian Aker
longlong replacement |
1454 |
int64_t val_int_result(); |
1
by brian
clean slate |
1455 |
String *str_result(String* tmp); |
1456 |
my_decimal *val_decimal_result(my_decimal *); |
|
1457 |
bool val_bool_result(); |
|
1458 |
bool send(Protocol *prot, String *tmp); |
|
1459 |
void make_field(Send_field *field); |
|
520.1.21
by Brian Aker
THD -> Session rename |
1460 |
bool fix_fields(Session *, Item **); |
1
by brian
clean slate |
1461 |
void fix_after_pullout(st_select_lex *new_parent, Item **ref); |
1462 |
int save_in_field(Field *field, bool no_conversions); |
|
1463 |
void save_org_in_field(Field *field); |
|
1464 |
enum Item_result result_type () const { return (*ref)->result_type(); } |
|
1465 |
enum_field_types field_type() const { return (*ref)->field_type(); } |
|
1466 |
Field *get_tmp_table_field() |
|
1467 |
{ return result_field ? result_field : (*ref)->get_tmp_table_field(); } |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1468 |
Item *get_tmp_table_item(Session *session); |
1
by brian
clean slate |
1469 |
table_map used_tables() const |
1470 |
{
|
|
1471 |
return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); |
|
1472 |
}
|
|
1473 |
void update_used_tables() |
|
1474 |
{
|
|
1475 |
if (!depended_from) |
|
1476 |
(*ref)->update_used_tables(); |
|
1477 |
}
|
|
1478 |
table_map not_null_tables() const { return (*ref)->not_null_tables(); } |
|
1479 |
void set_result_field(Field *field) { result_field= field; } |
|
1480 |
bool is_result_field() { return 1; } |
|
1481 |
void save_in_result_field(bool no_conversions) |
|
1482 |
{
|
|
1483 |
(*ref)->save_in_field(result_field, no_conversions); |
|
1484 |
}
|
|
1485 |
Item *real_item() |
|
1486 |
{
|
|
1487 |
return ref ? (*ref)->real_item() : this; |
|
1488 |
}
|
|
481
by Brian Aker
Remove all of uchar. |
1489 |
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg) |
1
by brian
clean slate |
1490 |
{ return (*ref)->walk(processor, walk_subquery, arg); } |
1491 |
virtual void print(String *str, enum_query_type query_type); |
|
152
by Brian Aker
longlong replacement |
1492 |
bool result_as_int64_t() |
1
by brian
clean slate |
1493 |
{
|
152
by Brian Aker
longlong replacement |
1494 |
return (*ref)->result_as_int64_t(); |
1
by brian
clean slate |
1495 |
}
|
1496 |
void cleanup(); |
|
1497 |
Item_field *filed_for_view_update() |
|
1498 |
{ return (*ref)->filed_for_view_update(); } |
|
1499 |
virtual Ref_Type ref_type() { return REF; } |
|
1500 |
||
1501 |
// Row emulation: forwarding of ROW-related calls to ref
|
|
482
by Brian Aker
Remove uint. |
1502 |
uint32_t cols() |
1
by brian
clean slate |
1503 |
{
|
1504 |
return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1; |
|
1505 |
}
|
|
482
by Brian Aker
Remove uint. |
1506 |
Item* element_index(uint32_t i) |
1
by brian
clean slate |
1507 |
{
|
1508 |
return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this; |
|
1509 |
}
|
|
482
by Brian Aker
Remove uint. |
1510 |
Item** addr(uint32_t i) |
1
by brian
clean slate |
1511 |
{
|
1512 |
return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0; |
|
1513 |
}
|
|
482
by Brian Aker
Remove uint. |
1514 |
bool check_cols(uint32_t c) |
1
by brian
clean slate |
1515 |
{
|
1516 |
return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c) |
|
1517 |
: Item::check_cols(c); |
|
1518 |
}
|
|
1519 |
bool null_inside() |
|
1520 |
{
|
|
1521 |
return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0; |
|
1522 |
}
|
|
1523 |
void bring_value() |
|
1524 |
{
|
|
1525 |
if (ref && result_type() == ROW_RESULT) |
|
1526 |
(*ref)->bring_value(); |
|
1527 |
}
|
|
1528 |
||
1529 |
};
|
|
1530 |
||
1531 |
||
1532 |
/*
|
|
1533 |
The same as Item_ref, but get value from val_* family of method to get
|
|
1534 |
value of item on which it referred instead of result* family.
|
|
1535 |
*/
|
|
1536 |
class Item_direct_ref :public Item_ref |
|
1537 |
{
|
|
1538 |
public: |
|
1539 |
Item_direct_ref(Name_resolution_context *context_arg, Item **item, |
|
1540 |
const char *table_name_arg, |
|
1541 |
const char *field_name_arg, |
|
163
by Brian Aker
Merge Monty's code. |
1542 |
bool alias_name_used_arg= false) |
1
by brian
clean slate |
1543 |
:Item_ref(context_arg, item, table_name_arg, |
1544 |
field_name_arg, alias_name_used_arg) |
|
1545 |
{}
|
|
1546 |
/* Constructor need to process subselect with temporary tables (see Item) */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1547 |
Item_direct_ref(Session *session, Item_direct_ref *item) : Item_ref(session, item) {} |
1
by brian
clean slate |
1548 |
|
1549 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
1550 |
int64_t val_int(); |
1
by brian
clean slate |
1551 |
String *val_str(String* tmp); |
1552 |
my_decimal *val_decimal(my_decimal *); |
|
1553 |
bool val_bool(); |
|
1554 |
bool is_null(); |
|
482
by Brian Aker
Remove uint. |
1555 |
bool get_date(DRIZZLE_TIME *ltime,uint32_t fuzzydate); |
1
by brian
clean slate |
1556 |
virtual Ref_Type ref_type() { return DIRECT_REF; } |
1557 |
};
|
|
1558 |
||
1559 |
/*
|
|
1560 |
Class for outer fields.
|
|
1561 |
An object of this class is created when the select where the outer field was
|
|
1562 |
resolved is a grouping one. After it has been fixed the ref field will point
|
|
1563 |
to either an Item_ref or an Item_direct_ref object which will be used to
|
|
1564 |
access the field.
|
|
1565 |
See also comments for the fix_inner_refs() and the
|
|
1566 |
Item_field::fix_outer_field() functions.
|
|
1567 |
*/
|
|
1568 |
||
1569 |
class Item_outer_ref :public Item_direct_ref |
|
1570 |
{
|
|
1571 |
public: |
|
1572 |
Item *outer_ref; |
|
1573 |
/* The aggregate function under which this outer ref is used, if any. */
|
|
1574 |
Item_sum *in_sum_func; |
|
1575 |
/*
|
|
163
by Brian Aker
Merge Monty's code. |
1576 |
true <=> that the outer_ref is already present in the select list
|
1
by brian
clean slate |
1577 |
of the outer select.
|
1578 |
*/
|
|
1579 |
bool found_in_select_list; |
|
1580 |
Item_outer_ref(Name_resolution_context *context_arg, |
|
1581 |
Item_field *outer_field_arg) |
|
1582 |
:Item_direct_ref(context_arg, 0, outer_field_arg->table_name, |
|
1583 |
outer_field_arg->field_name), |
|
1584 |
outer_ref(outer_field_arg), in_sum_func(0), |
|
1585 |
found_in_select_list(0) |
|
1586 |
{
|
|
1587 |
ref= &outer_ref; |
|
1588 |
set_properties(); |
|
1589 |
fixed= 0; |
|
1590 |
}
|
|
1591 |
Item_outer_ref(Name_resolution_context *context_arg, Item **item, |
|
1592 |
const char *table_name_arg, const char *field_name_arg, |
|
1593 |
bool alias_name_used_arg) |
|
1594 |
:Item_direct_ref(context_arg, item, table_name_arg, field_name_arg, |
|
1595 |
alias_name_used_arg), |
|
1596 |
outer_ref(0), in_sum_func(0), found_in_select_list(1) |
|
1597 |
{}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1598 |
void save_in_result_field(bool no_conversions __attribute__((unused))) |
1
by brian
clean slate |
1599 |
{
|
1600 |
outer_ref->save_org_in_field(result_field); |
|
1601 |
}
|
|
520.1.21
by Brian Aker
THD -> Session rename |
1602 |
bool fix_fields(Session *, Item **); |
1
by brian
clean slate |
1603 |
void fix_after_pullout(st_select_lex *new_parent, Item **ref); |
1604 |
table_map used_tables() const |
|
1605 |
{
|
|
1606 |
return (*ref)->const_item() ? 0 : OUTER_REF_TABLE_BIT; |
|
1607 |
}
|
|
1608 |
virtual Ref_Type ref_type() { return OUTER_REF; } |
|
1609 |
};
|
|
1610 |
||
1611 |
||
1612 |
||
1613 |
/*
|
|
1614 |
An object of this class:
|
|
1615 |
- Converts val_XXX() calls to ref->val_XXX_result() calls, like Item_ref.
|
|
163
by Brian Aker
Merge Monty's code. |
1616 |
- Sets owner->was_null=true if it has returned a NULL value from any
|
1
by brian
clean slate |
1617 |
val_XXX() function. This allows to inject an Item_ref_null_helper
|
1618 |
object into subquery and then check if the subquery has produced a row
|
|
1619 |
with NULL value.
|
|
1620 |
*/
|
|
1621 |
||
1622 |
class Item_ref_null_helper: public Item_ref |
|
1623 |
{
|
|
1624 |
protected: |
|
1625 |
Item_in_subselect* owner; |
|
1626 |
public: |
|
1627 |
Item_ref_null_helper(Name_resolution_context *context_arg, |
|
1628 |
Item_in_subselect* master, Item **item, |
|
1629 |
const char *table_name_arg, const char *field_name_arg) |
|
1630 |
:Item_ref(context_arg, item, table_name_arg, field_name_arg), |
|
1631 |
owner(master) {} |
|
1632 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
1633 |
int64_t val_int(); |
1
by brian
clean slate |
1634 |
String* val_str(String* s); |
1635 |
my_decimal *val_decimal(my_decimal *); |
|
1636 |
bool val_bool(); |
|
482
by Brian Aker
Remove uint. |
1637 |
bool get_date(DRIZZLE_TIME *ltime, uint32_t fuzzydate); |
1
by brian
clean slate |
1638 |
virtual void print(String *str, enum_query_type query_type); |
1639 |
/*
|
|
1640 |
we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE
|
|
1641 |
*/
|
|
1642 |
table_map used_tables() const |
|
1643 |
{
|
|
1644 |
return (depended_from ? |
|
1645 |
OUTER_REF_TABLE_BIT : |
|
1646 |
(*ref)->used_tables() | RAND_TABLE_BIT); |
|
1647 |
}
|
|
1648 |
};
|
|
1649 |
||
1650 |
/*
|
|
1651 |
The following class is used to optimize comparing of date and bigint columns
|
|
1652 |
We need to save the original item ('ref') to be able to call
|
|
1653 |
ref->save_in_field(). This is used to create index search keys.
|
|
1654 |
|
|
1655 |
An instance of Item_int_with_ref may have signed or unsigned integer value.
|
|
1656 |
|
|
1657 |
*/
|
|
1658 |
||
1659 |
class Item_int_with_ref :public Item_int |
|
1660 |
{
|
|
1661 |
Item *ref; |
|
1662 |
public: |
|
275
by Brian Aker
Full removal of my_bool from central server. |
1663 |
Item_int_with_ref(int64_t i, Item *ref_arg, bool unsigned_arg) : |
1
by brian
clean slate |
1664 |
Item_int(i), ref(ref_arg) |
1665 |
{
|
|
1666 |
unsigned_flag= unsigned_arg; |
|
1667 |
}
|
|
1668 |
int save_in_field(Field *field, bool no_conversions) |
|
1669 |
{
|
|
1670 |
return ref->save_in_field(field, no_conversions); |
|
1671 |
}
|
|
1672 |
Item *clone_item(); |
|
1673 |
virtual Item *real_item() { return ref; } |
|
1674 |
};
|
|
1675 |
||
1676 |
||
1677 |
class Item_copy_string :public Item |
|
1678 |
{
|
|
1679 |
enum enum_field_types cached_field_type; |
|
1680 |
public: |
|
1681 |
Item *item; |
|
1682 |
Item_copy_string(Item *i) :item(i) |
|
1683 |
{
|
|
275
by Brian Aker
Full removal of my_bool from central server. |
1684 |
null_value= maybe_null= item->maybe_null; |
1
by brian
clean slate |
1685 |
decimals=item->decimals; |
1686 |
max_length=item->max_length; |
|
1687 |
name=item->name; |
|
1688 |
cached_field_type= item->field_type(); |
|
1689 |
}
|
|
1690 |
enum Type type() const { return COPY_STR_ITEM; } |
|
1691 |
enum Item_result result_type () const { return STRING_RESULT; } |
|
1692 |
enum_field_types field_type() const { return cached_field_type; } |
|
1693 |
double val_real() |
|
1694 |
{
|
|
1695 |
int err_not_used; |
|
1696 |
char *end_not_used; |
|
1697 |
return (null_value ? 0.0 : |
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
1698 |
my_strntod(str_value.charset(), (char*) str_value.ptr(), |
1699 |
str_value.length(), &end_not_used, &err_not_used)); |
|
1
by brian
clean slate |
1700 |
}
|
152
by Brian Aker
longlong replacement |
1701 |
int64_t val_int() |
1
by brian
clean slate |
1702 |
{
|
1703 |
int err; |
|
398.1.8
by Monty Taylor
Enabled -Wlong-long. |
1704 |
return null_value ? 0 : my_strntoll(str_value.charset(),str_value.ptr(), |
1705 |
str_value.length(),10, (char**) 0, |
|
1706 |
&err); |
|
1
by brian
clean slate |
1707 |
}
|
1708 |
String *val_str(String*); |
|
1709 |
my_decimal *val_decimal(my_decimal *); |
|
1710 |
void make_field(Send_field *field) { item->make_field(field); } |
|
1711 |
void copy(); |
|
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1712 |
int save_in_field(Field *field, |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1713 |
bool no_conversions __attribute__((unused))) |
1
by brian
clean slate |
1714 |
{
|
1715 |
return save_str_value_in_field(field, &str_value); |
|
1716 |
}
|
|
1717 |
table_map used_tables() const { return (table_map) 1L; } |
|
1718 |
bool const_item() const { return 0; } |
|
1719 |
bool is_null() { return null_value; } |
|
1720 |
};
|
|
1721 |
class Item_default_value : public Item_field |
|
1722 |
{
|
|
1723 |
public: |
|
1724 |
Item *arg; |
|
1725 |
Item_default_value(Name_resolution_context *context_arg) |
|
1726 |
:Item_field(context_arg, (const char *)NULL, (const char *)NULL, |
|
1727 |
(const char *)NULL), |
|
1728 |
arg(NULL) {} |
|
1729 |
Item_default_value(Name_resolution_context *context_arg, Item *a) |
|
1730 |
:Item_field(context_arg, (const char *)NULL, (const char *)NULL, |
|
1731 |
(const char *)NULL), |
|
1732 |
arg(a) {} |
|
1733 |
enum Type type() const { return DEFAULT_VALUE_ITEM; } |
|
1734 |
bool eq(const Item *item, bool binary_cmp) const; |
|
520.1.21
by Brian Aker
THD -> Session rename |
1735 |
bool fix_fields(Session *, Item **); |
1
by brian
clean slate |
1736 |
virtual void print(String *str, enum_query_type query_type); |
1737 |
int save_in_field(Field *field_arg, bool no_conversions); |
|
1738 |
table_map used_tables() const { return (table_map)0L; } |
|
1739 |
||
481
by Brian Aker
Remove all of uchar. |
1740 |
bool walk(Item_processor processor, bool walk_subquery, unsigned char *args) |
1
by brian
clean slate |
1741 |
{
|
1742 |
return arg->walk(processor, walk_subquery, args) || |
|
1743 |
(this->*processor)(args); |
|
1744 |
}
|
|
1745 |
||
481
by Brian Aker
Remove all of uchar. |
1746 |
Item *transform(Item_transformer transformer, unsigned char *args); |
1
by brian
clean slate |
1747 |
};
|
1748 |
||
1749 |
/*
|
|
1750 |
Item_insert_value -- an implementation of VALUES() function.
|
|
1751 |
You can use the VALUES(col_name) function in the UPDATE clause
|
|
1752 |
to refer to column values from the INSERT portion of the INSERT
|
|
1753 |
... UPDATE statement. In other words, VALUES(col_name) in the
|
|
1754 |
UPDATE clause refers to the value of col_name that would be
|
|
1755 |
inserted, had no duplicate-key conflict occurred.
|
|
1756 |
In all other places this function returns NULL.
|
|
1757 |
*/
|
|
1758 |
||
1759 |
class Item_insert_value : public Item_field |
|
1760 |
{
|
|
1761 |
public: |
|
1762 |
Item *arg; |
|
1763 |
Item_insert_value(Name_resolution_context *context_arg, Item *a) |
|
1764 |
:Item_field(context_arg, (const char *)NULL, (const char *)NULL, |
|
1765 |
(const char *)NULL), |
|
1766 |
arg(a) {} |
|
1767 |
bool eq(const Item *item, bool binary_cmp) const; |
|
520.1.21
by Brian Aker
THD -> Session rename |
1768 |
bool fix_fields(Session *, Item **); |
1
by brian
clean slate |
1769 |
virtual void print(String *str, enum_query_type query_type); |
1770 |
int save_in_field(Field *field_arg, bool no_conversions) |
|
1771 |
{
|
|
1772 |
return Item_field::save_in_field(field_arg, no_conversions); |
|
1773 |
}
|
|
1774 |
/*
|
|
1775 |
We use RAND_TABLE_BIT to prevent Item_insert_value from
|
|
1776 |
being treated as a constant and precalculated before execution
|
|
1777 |
*/
|
|
1778 |
table_map used_tables() const { return RAND_TABLE_BIT; } |
|
1779 |
||
481
by Brian Aker
Remove all of uchar. |
1780 |
bool walk(Item_processor processor, bool walk_subquery, unsigned char *args) |
1
by brian
clean slate |
1781 |
{
|
1782 |
return arg->walk(processor, walk_subquery, args) || |
|
1783 |
(this->*processor)(args); |
|
1784 |
}
|
|
481.3.1
by Monty Taylor
Merged vcol stuff. |
1785 |
bool check_vcol_func_processor(unsigned char *arg __attribute__((unused))) |
383.7.1
by Andrey Zhakov
Initial submit of code and tests |
1786 |
{ return true; } |
1
by brian
clean slate |
1787 |
};
|
1788 |
||
1789 |
||
1790 |
class Item_cache: public Item_basic_constant |
|
1791 |
{
|
|
1792 |
protected: |
|
1793 |
Item *example; |
|
1794 |
table_map used_table_map; |
|
1795 |
/*
|
|
1796 |
Field that this object will get value from. This is set/used by
|
|
1797 |
index-based subquery engines to detect and remove the equality injected
|
|
1798 |
by IN->EXISTS transformation.
|
|
1799 |
For all other uses of Item_cache, cached_field doesn't matter.
|
|
1800 |
*/
|
|
1801 |
Field *cached_field; |
|
1802 |
enum enum_field_types cached_field_type; |
|
1803 |
public: |
|
1804 |
Item_cache(): |
|
241
by Brian Aker
First pass of CHAR removal. |
1805 |
example(0), used_table_map(0), cached_field(0), cached_field_type(DRIZZLE_TYPE_VARCHAR) |
1
by brian
clean slate |
1806 |
{
|
1807 |
fixed= 1; |
|
1808 |
null_value= 1; |
|
1809 |
}
|
|
1810 |
Item_cache(enum_field_types field_type_arg): |
|
1811 |
example(0), used_table_map(0), cached_field(0), cached_field_type(field_type_arg) |
|
1812 |
{
|
|
1813 |
fixed= 1; |
|
1814 |
null_value= 1; |
|
1815 |
}
|
|
1816 |
||
1817 |
void set_used_tables(table_map map) { used_table_map= map; } |
|
1818 |
||
482
by Brian Aker
Remove uint. |
1819 |
virtual bool allocate(uint32_t i __attribute__((unused))) |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1820 |
{ return 0; } |
1
by brian
clean slate |
1821 |
virtual bool setup(Item *item) |
1822 |
{
|
|
1823 |
example= item; |
|
1824 |
max_length= item->max_length; |
|
1825 |
decimals= item->decimals; |
|
1826 |
collation.set(item->collation); |
|
1827 |
unsigned_flag= item->unsigned_flag; |
|
1828 |
if (item->type() == FIELD_ITEM) |
|
1829 |
cached_field= ((Item_field *)item)->field; |
|
1830 |
return 0; |
|
1831 |
};
|
|
1832 |
virtual void store(Item *)= 0; |
|
1833 |
enum Type type() const { return CACHE_ITEM; } |
|
1834 |
enum_field_types field_type() const { return cached_field_type; } |
|
1835 |
static Item_cache* get_cache(const Item *item); |
|
1836 |
table_map used_tables() const { return used_table_map; } |
|
1837 |
virtual void keep_array() {} |
|
1838 |
virtual void print(String *str, enum_query_type query_type); |
|
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
1839 |
bool eq_def(Field *field); |
53.2.32
by Monty Taylor
First large swath at getting handler stuff clean. |
1840 |
bool eq(const Item *item, |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1841 |
bool binary_cmp __attribute__((unused))) const |
1
by brian
clean slate |
1842 |
{
|
1843 |
return this == item; |
|
1844 |
}
|
|
1845 |
};
|
|
1846 |
||
1847 |
||
1848 |
class Item_cache_int: public Item_cache |
|
1849 |
{
|
|
1850 |
protected: |
|
152
by Brian Aker
longlong replacement |
1851 |
int64_t value; |
1
by brian
clean slate |
1852 |
public: |
1853 |
Item_cache_int(): Item_cache(), value(0) {} |
|
1854 |
Item_cache_int(enum_field_types field_type_arg): |
|
1855 |
Item_cache(field_type_arg), value(0) {} |
|
1856 |
||
1857 |
void store(Item *item); |
|
152
by Brian Aker
longlong replacement |
1858 |
void store(Item *item, int64_t val_arg); |
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1859 |
double val_real() { assert(fixed == 1); return (double) value; } |
152
by Brian Aker
longlong replacement |
1860 |
int64_t val_int() { assert(fixed == 1); return value; } |
1
by brian
clean slate |
1861 |
String* val_str(String *str); |
1862 |
my_decimal *val_decimal(my_decimal *); |
|
1863 |
enum Item_result result_type() const { return INT_RESULT; } |
|
163
by Brian Aker
Merge Monty's code. |
1864 |
bool result_as_int64_t() { return true; } |
1
by brian
clean slate |
1865 |
};
|
1866 |
||
1867 |
||
1868 |
class Item_cache_real: public Item_cache |
|
1869 |
{
|
|
1870 |
double value; |
|
1871 |
public: |
|
1872 |
Item_cache_real(): Item_cache(), value(0) {} |
|
1873 |
||
1874 |
void store(Item *item); |
|
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1875 |
double val_real() { assert(fixed == 1); return value; } |
152
by Brian Aker
longlong replacement |
1876 |
int64_t val_int(); |
1
by brian
clean slate |
1877 |
String* val_str(String *str); |
1878 |
my_decimal *val_decimal(my_decimal *); |
|
1879 |
enum Item_result result_type() const { return REAL_RESULT; } |
|
1880 |
};
|
|
1881 |
||
1882 |
||
1883 |
class Item_cache_decimal: public Item_cache |
|
1884 |
{
|
|
1885 |
protected: |
|
1886 |
my_decimal decimal_value; |
|
1887 |
public: |
|
1888 |
Item_cache_decimal(): Item_cache() {} |
|
1889 |
||
1890 |
void store(Item *item); |
|
1891 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
1892 |
int64_t val_int(); |
1
by brian
clean slate |
1893 |
String* val_str(String *str); |
1894 |
my_decimal *val_decimal(my_decimal *); |
|
1895 |
enum Item_result result_type() const { return DECIMAL_RESULT; } |
|
1896 |
};
|
|
1897 |
||
1898 |
||
1899 |
class Item_cache_str: public Item_cache |
|
1900 |
{
|
|
1901 |
char buffer[STRING_BUFFER_USUAL_SIZE]; |
|
1902 |
String *value, value_buff; |
|
1903 |
bool is_varbinary; |
|
584.1.12
by Monty Taylor
HA! Removed item.h from common_includes. woot. |
1904 |
|
1
by brian
clean slate |
1905 |
public: |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
1906 |
Item_cache_str(const Item *item); |
1
by brian
clean slate |
1907 |
void store(Item *item); |
1908 |
double val_real(); |
|
152
by Brian Aker
longlong replacement |
1909 |
int64_t val_int(); |
51.1.55
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE - 1st clean pass on item.h/cc |
1910 |
String* val_str(String *) { assert(fixed == 1); return value; } |
1
by brian
clean slate |
1911 |
my_decimal *val_decimal(my_decimal *); |
1912 |
enum Item_result result_type() const { return STRING_RESULT; } |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1913 |
const CHARSET_INFO *charset() const { return value->charset(); }; |
1
by brian
clean slate |
1914 |
int save_in_field(Field *field, bool no_conversions); |
1915 |
};
|
|
1916 |
||
1917 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
1918 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1919 |
void mark_select_range_as_dependent(Session *session, |
1
by brian
clean slate |
1920 |
st_select_lex *last_select, |
1921 |
st_select_lex *current_sel, |
|
1922 |
Field *found_field, Item *found_item, |
|
1923 |
Item_ident *resolved_item); |
|
1924 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1925 |
extern void resolve_const_item(Session *session, Item **ref, Item *cmp_item); |
1
by brian
clean slate |
1926 |
extern bool field_is_equal_to_item(Field *field,Item *item); |
489.1.8
by Monty Taylor
Split out Item_int_func and Item_func from Item_func. (don't think too hard about the second one) |
1927 |
|
575.4.7
by Monty Taylor
More header cleanup. |
1928 |
/**
|
1929 |
Create field for temporary table.
|
|
1930 |
||
1931 |
@param session Thread handler
|
|
1932 |
@param table Temporary table
|
|
1933 |
@param item Item to create a field for
|
|
1934 |
@param type Type of item (normally item->type)
|
|
1935 |
@param copy_func If set and item is a function, store copy of item
|
|
1936 |
in this array
|
|
1937 |
@param from_field if field will be created using other field as example,
|
|
1938 |
pointer example field will be written here
|
|
1939 |
@param default_field If field has a default value field, store it here
|
|
1940 |
@param group 1 if we are going to do a relative group by on result
|
|
1941 |
@param modify_item 1 if item->result_field should point to new item.
|
|
1942 |
This is relevent for how fill_record() is going to
|
|
1943 |
work:
|
|
1944 |
If modify_item is 1 then fill_record() will update
|
|
1945 |
the record in the original table.
|
|
1946 |
If modify_item is 0 then fill_record() will update
|
|
1947 |
the temporary table
|
|
1948 |
@param convert_blob_length If >0 create a varstring(convert_blob_length)
|
|
1949 |
field instead of blob.
|
|
1950 |
||
1951 |
@retval
|
|
1952 |
0 on error
|
|
1953 |
@retval
|
|
1954 |
new_created field
|
|
1955 |
*/
|
|
1956 |
||
1957 |
/* TODO: This is here for now because it needs the Item::Type. It should live
|
|
1958 |
in Field or Table once item.h is clean enough to actually include */
|
|
1959 |
Field *create_tmp_field(Session *session, Table *table, Item *item, |
|
1960 |
Item::Type type, |
|
1961 |
Item ***copy_func, Field **from_field, |
|
1962 |
Field **def_field, |
|
1963 |
bool group, bool modify_item, |
|
1964 |
bool table_cant_handle_bit_fields, |
|
1965 |
bool make_copy_field, |
|
1966 |
uint32_t convert_blob_length); |
|
1967 |
||
584.4.4
by Monty Taylor
Split out Name_resolution_context. |
1968 |
#endif /* DRIZZLED_ITEM_H */ |