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 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
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 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
20 |
|
21 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
22 |
#pragma once
|
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) |
23 |
|
2187.7.3
by Brian Aker
Simple encapsulation of Lex |
24 |
#include <drizzled/dtcollation.h> |
2154.2.3
by Brian Aker
Update headers (more removal of session). |
25 |
#include <drizzled/global_charset_info.h> |
2187.7.3
by Brian Aker
Simple encapsulation of Lex |
26 |
#include <drizzled/item_result.h> |
27 |
#include <drizzled/memory/sql_alloc.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. |
28 |
#include <drizzled/sql_list.h> |
2154.2.4
by Brian Aker
This fixes 716459 |
29 |
#include <drizzled/sql_string.h> |
584.4.1
by Monty Taylor
Split out DTCollation. |
30 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
31 |
#include <drizzled/visibility.h> |
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
32 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
33 |
namespace drizzled |
34 |
{
|
|
35 |
||
2154.2.4
by Brian Aker
This fixes 716459 |
36 |
class Field; |
37 |
class Item_equal; |
|
1
by brian
clean slate |
38 |
class Item_field; |
2154.2.4
by Brian Aker
This fixes 716459 |
39 |
class Item_ident; |
40 |
class Item_in_subselect; |
|
41 |
class Item_sum; |
|
846
by Brian Aker
Removing on typedeffed class. |
42 |
class Select_Lex; |
2154.2.4
by Brian Aker
This fixes 716459 |
43 |
class SendField; |
44 |
class Table; |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
45 |
class user_var_entry; |
46 |
||
2154.2.4
by Brian Aker
This fixes 716459 |
47 |
namespace plugin { class Client; } |
48 |
namespace type { class Time; } |
|
49 |
namespace type { class Decimal; } |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
50 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
51 |
/**
|
52 |
Dummy error processor used by default by Name_resolution_context.
|
|
53 |
||
54 |
@note
|
|
55 |
do nothing
|
|
56 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
57 |
void dummy_error_processor(Session *session, void *data); |
1
by brian
clean slate |
58 |
|
59 |
/*
|
|
60 |
Analyzer function
|
|
61 |
SYNOPSIS
|
|
62 |
argp in/out IN: Analysis parameter
|
|
63 |
OUT: Parameter to be passed to the transformer
|
|
64 |
||
584.4.2
by Monty Taylor
Split out hybrid_type_traits. |
65 |
RETURN
|
163
by Brian Aker
Merge Monty's code. |
66 |
true Invoke the transformer
|
67 |
false Don't do it
|
|
1
by brian
clean slate |
68 |
|
69 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
70 |
typedef bool (Item::*Item_analyzer) (unsigned char **argp); |
71 |
typedef Item* (Item::*Item_transformer) (unsigned char *arg); |
|
1
by brian
clean slate |
72 |
typedef void (*Cond_traverser) (const Item *item, void *arg); |
584.4.2
by Monty Taylor
Split out hybrid_type_traits. |
73 |
typedef bool (Item::*Item_processor) (unsigned char *arg); |
1
by brian
clean slate |
74 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
75 |
/**
|
1237.6.7
by Brian Aker
More removal of field |
76 |
* The Item class is the base class for all items in the parsed
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
77 |
* statement "tree" or Lex. Each item represents something in the
|
78 |
* execution plan.
|
|
79 |
*/
|
|
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
80 |
class DRIZZLED_API Item : public memory::SqlAlloc |
1
by brian
clean slate |
81 |
{
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
82 |
/* Prevent use of these */
|
83 |
Item(const Item &); |
|
1
by brian
clean slate |
84 |
void operator=(Item &); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
85 |
|
1
by brian
clean slate |
86 |
/* Cache of the result of is_expensive(). */
|
206
by Brian Aker
Removed final uint dead types. |
87 |
int8_t is_expensive_cache; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
88 |
virtual bool is_expensive_processor(unsigned char *arg); |
1
by brian
clean slate |
89 |
|
90 |
public: |
|
91 |
||
1237.6.7
by Brian Aker
More removal of field |
92 |
enum Type |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
93 |
{
|
94 |
FIELD_ITEM= 0, |
|
608
by Brian Aker
Adding snowman test (plus a dead variable removal). |
95 |
FUNC_ITEM, |
96 |
SUM_FUNC_ITEM, |
|
97 |
STRING_ITEM, |
|
98 |
INT_ITEM, |
|
99 |
REAL_ITEM, |
|
100 |
NULL_ITEM, |
|
101 |
VARBIN_ITEM, |
|
102 |
COPY_STR_ITEM, |
|
103 |
FIELD_AVG_ITEM, |
|
104 |
DEFAULT_VALUE_ITEM, |
|
105 |
PROC_ITEM, |
|
106 |
COND_ITEM, |
|
107 |
REF_ITEM, |
|
108 |
FIELD_STD_ITEM, |
|
109 |
FIELD_VARIANCE_ITEM, |
|
110 |
INSERT_VALUE_ITEM, |
|
111 |
SUBSELECT_ITEM, |
|
112 |
ROW_ITEM, CACHE_ITEM, |
|
113 |
TYPE_HOLDER, |
|
114 |
PARAM_ITEM, |
|
2023.2.7
by Brian Aker
Create an Bool primtive type for item. |
115 |
BOOLEAN_ITEM, |
608
by Brian Aker
Adding snowman test (plus a dead variable removal). |
116 |
DECIMAL_ITEM
|
117 |
};
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
118 |
enum traverse_order |
1237.6.7
by Brian Aker
More removal of field |
119 |
{
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
120 |
T_POSTFIX, |
121 |
T_PREFIX
|
|
122 |
};
|
|
123 |
enum cond_result |
|
124 |
{
|
|
125 |
COND_UNDEF, |
|
126 |
COND_OK, |
|
127 |
COND_TRUE, |
|
128 |
COND_FALSE
|
|
129 |
};
|
|
130 |
||
131 |
/**
|
|
132 |
* str_values's main purpose is to be used to cache the value in
|
|
133 |
* save_in_field
|
|
134 |
*/
|
|
1
by brian
clean slate |
135 |
String str_value; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
136 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
137 |
/** Name from select */
|
138 |
char *name; |
|
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
139 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
140 |
/** Length of name */
|
141 |
uint32_t name_length; |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
142 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
143 |
/** Original item name (if it was renamed) */
|
144 |
char *orig_name; |
|
1
by brian
clean slate |
145 |
Item *next; |
203
by Brian Aker
Small cleanup around uint32 types (need to merge). |
146 |
uint32_t max_length; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
147 |
|
206
by Brian Aker
Removed final uint dead types. |
148 |
int8_t marker; |
149 |
uint8_t decimals; |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
150 |
bool fixed; /**< If item fixed with fix_fields */ |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
151 |
bool maybe_null; /**< True if item may be null */ |
152 |
bool null_value; /**< True if item is null */ |
|
275
by Brian Aker
Full removal of my_bool from central server. |
153 |
bool unsigned_flag; |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
154 |
|
155 |
bool is_unsigned() const |
|
156 |
{
|
|
157 |
return unsigned_flag; |
|
158 |
}
|
|
159 |
||
160 |
virtual bool negative() const |
|
161 |
{
|
|
162 |
return false; |
|
163 |
}
|
|
164 |
||
275
by Brian Aker
Full removal of my_bool from central server. |
165 |
bool with_sum_func; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
166 |
bool is_autogenerated_name; /**< indicates whether name of this Item was autogenerated or set by user */ |
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
167 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
168 |
/**
|
169 |
* If this item is a subselect or some of its arguments is or contains a
|
|
1237.6.7
by Brian Aker
More removal of field |
170 |
* subselect. Computed by fix_fields.
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
171 |
*/
|
172 |
bool with_subselect; |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
173 |
DTCollation collation; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
174 |
Item_result cmp_context; /**< Comparison context */ |
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
175 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
176 |
/**
|
177 |
* Constructor
|
|
178 |
*
|
|
179 |
* @note
|
|
180 |
*
|
|
1253.1.6
by Monty Taylor
Moved mem_root functions into drizzled::memory:: namespace. |
181 |
* Alloc & destruct is done as start of select using memory::sql_alloc
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
182 |
*/
|
1
by brian
clean slate |
183 |
Item(); |
2023.2.7
by Brian Aker
Create an Bool primtive type for item. |
184 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
185 |
/**
|
186 |
* Constructor used by Item_field, Item_ref & aggregate (sum) functions.
|
|
1237.6.7
by Brian Aker
More removal of field |
187 |
*
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
188 |
* Used for duplicating lists in processing queries with temporary
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
189 |
* tables.
|
1237.6.7
by Brian Aker
More removal of field |
190 |
*
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
191 |
* Also it used for Item_cond_and/Item_cond_or for creating
|
192 |
* top AND/OR structure of WHERE clause to protect it of
|
|
193 |
* optimisation changes in prepared statements
|
|
194 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
195 |
Item(Session *session, Item *item); |
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
196 |
|
1
by brian
clean slate |
197 |
virtual ~Item() |
198 |
{
|
|
199 |
#ifdef EXTRA_DEBUG
|
|
2023.2.7
by Brian Aker
Create an Bool primtive type for item. |
200 |
name= NULL; |
1
by brian
clean slate |
201 |
#endif
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
202 |
}
|
1273.16.4
by Brian Aker
Added columsn for COLUMNS |
203 |
|
204 |
void set_name(const std::string &arg) |
|
205 |
{
|
|
206 |
set_name(arg.c_str(), arg.length(), system_charset_info); |
|
207 |
}
|
|
208 |
||
209 |
void set_name(const char *str, uint32_t length, const CHARSET_INFO * const cs= system_charset_info); |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
210 |
/**
|
211 |
* Renames item (used for views, cleanup() return original name).
|
|
212 |
*
|
|
213 |
* @param new_name new name of item;
|
|
214 |
*/
|
|
1
by brian
clean slate |
215 |
void rename(char *new_name); |
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
216 |
void init_make_field(SendField *tmp_field,enum enum_field_types type); |
1
by brian
clean slate |
217 |
virtual void cleanup(); |
1052.2.4
by Nathan Williams
No actual code changes. Changed Send_field to SendField to be consistent with coding standards. |
218 |
virtual void make_field(SendField *field); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
219 |
/**
|
220 |
Create a field to hold a string value from an item.
|
|
221 |
||
222 |
If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob @n
|
|
223 |
If max_length > 0 create a varchar @n
|
|
224 |
If max_length == 0 create a CHAR(0)
|
|
225 |
||
226 |
@param table Table for which the field is created
|
|
227 |
*/
|
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
228 |
Field *make_string_field(Table *table); |
520.1.21
by Brian Aker
THD -> Session rename |
229 |
virtual bool fix_fields(Session *, Item **); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
230 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
231 |
/**
|
232 |
* Fix after some tables has been pulled out. Basically re-calculate all
|
|
233 |
* attributes that are dependent on the tables.
|
|
234 |
*/
|
|
846
by Brian Aker
Removing on typedeffed class. |
235 |
virtual void fix_after_pullout(Select_Lex *new_parent, Item **ref); |
1
by brian
clean slate |
236 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
237 |
/**
|
238 |
* Should be used in case where we are sure that we do not need
|
|
1237.6.7
by Brian Aker
More removal of field |
239 |
* complete fix_fields() procedure.
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
240 |
*/
|
241 |
inline void quick_fix_field() |
|
242 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
243 |
fixed= true; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
244 |
}
|
245 |
||
1
by brian
clean slate |
246 |
virtual int save_in_field(Field *field, bool no_conversions); |
247 |
virtual void save_org_in_field(Field *field) |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
248 |
{
|
249 |
(void) save_in_field(field, true); |
|
250 |
}
|
|
1
by brian
clean slate |
251 |
virtual int save_safe_in_field(Field *field) |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
252 |
{
|
253 |
return save_in_field(field, true); |
|
254 |
}
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
255 |
/**
|
256 |
* This is only called from items that is not of type item_field.
|
|
257 |
*/
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
258 |
virtual bool send(plugin::Client *client, String *str); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
259 |
/**
|
1237.6.7
by Brian Aker
More removal of field |
260 |
Compares this Item to another Item, returning true if Item's
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
261 |
are functionally equal.
|
262 |
||
263 |
@details
|
|
264 |
||
265 |
This function is called when:
|
|
266 |
- Comparing items in the WHERE clause (when doing where optimization)
|
|
267 |
- When trying to find an order_st BY/GROUP BY item in the SELECT part
|
|
268 |
*/
|
|
1
by brian
clean slate |
269 |
virtual bool eq(const Item *, bool binary_cmp) const; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
270 |
virtual Item_result result_type() const |
271 |
{
|
|
272 |
return REAL_RESULT; |
|
273 |
}
|
|
274 |
virtual Item_result cast_to_int_type() const |
|
275 |
{
|
|
276 |
return result_type(); |
|
277 |
}
|
|
1
by brian
clean slate |
278 |
virtual enum_field_types string_field_type() const; |
279 |
virtual enum_field_types field_type() const; |
|
280 |
virtual enum Type type() const =0; |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
281 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
282 |
/**
|
283 |
* Converts
|
|
284 |
* "func_arg $CMP$ const" half-interval
|
|
285 |
* into
|
|
286 |
* "FUNC(func_arg) $CMP2$ const2"
|
|
287 |
*
|
|
288 |
* @details
|
|
289 |
*
|
|
290 |
* left_endp false <=> The interval is "x < const" or "x <= const"
|
|
291 |
* true <=> The interval is "x > const" or "x >= const"
|
|
292 |
*
|
|
293 |
* incl_endp IN true <=> the comparison is '<' or '>'
|
|
294 |
* false <=> the comparison is '<=' or '>='
|
|
295 |
* OUT The same but for the "F(x) $CMP$ F(const)" comparison
|
|
296 |
*
|
|
297 |
* This function is defined only for unary monotonic functions. The caller
|
|
298 |
* supplies the source half-interval
|
|
1237.6.7
by Brian Aker
More removal of field |
299 |
*
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
300 |
* x $CMP$ const
|
301 |
*
|
|
302 |
* The value of const is supplied implicitly as the value this item's
|
|
303 |
* argument, the form of $CMP$ comparison is specified through the
|
|
304 |
* function's arguments. The calle returns the result interval
|
|
1237.6.7
by Brian Aker
More removal of field |
305 |
*
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
306 |
* F(x) $CMP2$ F(const)
|
307 |
*
|
|
308 |
* passing back F(const) as the return value, and the form of $CMP2$
|
|
309 |
* through the out parameter. NULL values are assumed to be comparable and
|
|
310 |
* be less than any non-NULL values.
|
|
311 |
*
|
|
312 |
* @retval
|
|
313 |
*
|
|
314 |
* The output range bound, which equal to the value of val_int()
|
|
315 |
* - If the value of the function is NULL then the bound is the
|
|
316 |
* smallest possible value of INT64_MIN
|
|
317 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
318 |
virtual int64_t val_int_endpoint(bool left_endp, bool *incl_endp); |
1
by brian
clean slate |
319 |
|
320 |
/* valXXX methods must return NULL or 0 or 0.0 if null_value is set. */
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
321 |
/**
|
322 |
* Returns double precision floating point representation of item.
|
|
323 |
*
|
|
324 |
* @retval
|
|
325 |
*
|
|
326 |
* In case of NULL value return 0.0 and set null_value flag to true.
|
|
327 |
* If value is not null null_value flag will be reset to false.
|
|
328 |
*/
|
|
1
by brian
clean slate |
329 |
virtual double val_real()=0; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
330 |
/**
|
331 |
* Returns integer representation of item.
|
|
332 |
*
|
|
333 |
* @retval
|
|
1237.6.7
by Brian Aker
More removal of field |
334 |
*
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
335 |
* In case of NULL value return 0 and set null_value flag to true.
|
336 |
* If value is not null null_value flag will be reset to false.
|
|
337 |
*/
|
|
152
by Brian Aker
longlong replacement |
338 |
virtual int64_t val_int()=0; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
339 |
/**
|
340 |
* This is just a shortcut to avoid the cast. You should still use
|
|
341 |
* unsigned_flag to check the sign of the item.
|
|
342 |
*/
|
|
343 |
inline uint64_t val_uint() |
|
344 |
{
|
|
345 |
return (uint64_t) val_int(); |
|
346 |
}
|
|
347 |
/**
|
|
348 |
* Return string representation of this item object.
|
|
349 |
*
|
|
350 |
* @param an allocated buffer this or any nested Item object can use to
|
|
351 |
* store return value of this method.
|
|
352 |
*
|
|
353 |
* @note
|
|
354 |
*
|
|
355 |
* Buffer passed via argument should only be used if the item itself
|
|
356 |
* doesn't have an own String buffer. In case when the item maintains
|
|
357 |
* it's own string buffer, it's preferable to return it instead to
|
|
358 |
* minimize number of mallocs/memcpys.
|
|
359 |
*
|
|
360 |
* The caller of this method can modify returned string, but only in case
|
|
361 |
* when it was allocated on heap, (is_alloced() is true). This allows
|
|
362 |
* the caller to efficiently use a buffer allocated by a child without
|
|
363 |
* having to allocate a buffer of it's own. The buffer, given to
|
|
364 |
* val_str() as argument, belongs to the caller and is later used by the
|
|
365 |
* caller at it's own choosing.
|
|
366 |
*
|
|
367 |
* A few implications from the above:
|
|
368 |
* - unless you return a string object which only points to your buffer
|
|
369 |
* but doesn't manages it you should be ready that it will be
|
|
370 |
* modified.
|
|
371 |
* - even for not allocated strings (is_alloced() == false) the caller
|
|
372 |
* can change charset (see Item_func_{typecast/binary}. XXX: is this
|
|
373 |
* a bug?
|
|
374 |
* - still you should try to minimize data copying and return internal
|
|
375 |
* object whenever possible.
|
|
376 |
*
|
|
377 |
* @retval
|
|
378 |
* In case of NULL value return 0 (NULL pointer) and set null_value flag
|
|
379 |
* to true.
|
|
380 |
* If value is not null null_value flag will be reset to false.
|
|
381 |
*/
|
|
1
by brian
clean slate |
382 |
virtual String *val_str(String *str)=0; |
2023.2.4
by Brian Aker
Merge in cast() for BOOLEAN. |
383 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
384 |
/**
|
385 |
* Return decimal representation of item with fixed point.
|
|
386 |
*
|
|
387 |
* @param buffer which can be used by Item for returning value
|
|
388 |
* (but can be not)
|
|
389 |
*
|
|
390 |
* @note
|
|
391 |
*
|
|
392 |
* Returned value should not be changed if it is not the same which was
|
|
393 |
* passed via argument.
|
|
394 |
*
|
|
395 |
* @retval
|
|
396 |
*
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
397 |
* Return pointer on type::Decimal (it can be other then passed via argument)
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
398 |
* if value is not NULL (null_value flag will be reset to false).
|
399 |
* In case of NULL value it return 0 pointer and set null_value flag
|
|
400 |
* to true.
|
|
401 |
*/
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
402 |
virtual type::Decimal *val_decimal(type::Decimal *decimal_buffer)= 0; |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
403 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
404 |
/**
|
405 |
* Return boolean value of item.
|
|
406 |
*
|
|
407 |
* @retval
|
|
408 |
*
|
|
409 |
* false value is false or NULL
|
|
410 |
* true value is true (not equal to 0)
|
|
411 |
*/
|
|
1
by brian
clean slate |
412 |
virtual bool val_bool(); |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
413 |
|
1
by brian
clean slate |
414 |
/* Helper functions, see item_sum.cc */
|
415 |
String *val_string_from_real(String *str); |
|
416 |
String *val_string_from_int(String *str); |
|
417 |
String *val_string_from_decimal(String *str); |
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
418 |
type::Decimal *val_decimal_from_real(type::Decimal *decimal_value); |
419 |
type::Decimal *val_decimal_from_int(type::Decimal *decimal_value); |
|
420 |
type::Decimal *val_decimal_from_string(type::Decimal *decimal_value); |
|
421 |
type::Decimal *val_decimal_from_date(type::Decimal *decimal_value); |
|
422 |
type::Decimal *val_decimal_from_time(type::Decimal *decimal_value); |
|
152
by Brian Aker
longlong replacement |
423 |
int64_t val_int_from_decimal(); |
1
by brian
clean slate |
424 |
double val_real_from_decimal(); |
425 |
||
2126.3.1
by Brian Aker
Add bool int patch |
426 |
bool save_time_in_field(Field *field); |
427 |
bool save_date_in_field(Field *field); |
|
428 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
429 |
/**
|
430 |
* Stores a string value in field directly
|
|
431 |
*
|
|
432 |
* @details
|
|
433 |
*
|
|
434 |
* The method is used by Item_*::save_in_field implementations
|
|
435 |
* when we don't need to calculate the value to store
|
|
1237.6.7
by Brian Aker
More removal of field |
436 |
*
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
437 |
* @see Item_string::save_in_field() implementation for example
|
438 |
*
|
|
439 |
* @param Pointer to field where to store
|
|
440 |
* @param Pointer to the string value to be stored
|
|
441 |
*
|
|
442 |
* @retval
|
|
443 |
* Nonzero value if error
|
|
444 |
*
|
|
445 |
*/
|
|
1
by brian
clean slate |
446 |
int save_str_value_in_field(Field *field, String *result); |
447 |
||
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
448 |
virtual Field *get_tmp_table_field(void) |
449 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
450 |
return NULL; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
451 |
}
|
1
by brian
clean slate |
452 |
/* This is also used to create fields in CREATE ... SELECT: */
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
453 |
virtual Field *tmp_table_field(Table *t_arg); |
454 |
virtual const char *full_name(void) const; |
|
1
by brian
clean slate |
455 |
|
456 |
/*
|
|
457 |
*result* family of methods is analog of *val* family (see above) but
|
|
458 |
return value of result_field of item if it is present. If Item have not
|
|
459 |
result field, it return val(). This methods set null_value flag in same
|
|
460 |
way as *val* methods do it.
|
|
461 |
*/
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
462 |
virtual double val_result() |
463 |
{
|
|
464 |
return val_real(); |
|
465 |
}
|
|
466 |
virtual int64_t val_int_result() |
|
467 |
{
|
|
468 |
return val_int(); |
|
469 |
}
|
|
470 |
virtual String *str_result(String* tmp) |
|
471 |
{
|
|
472 |
return val_str(tmp); |
|
473 |
}
|
|
2030.1.4
by Brian Aker
Change my_decimal to Decimal |
474 |
virtual type::Decimal *val_decimal_result(type::Decimal *val) |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
475 |
{
|
476 |
return val_decimal(val); |
|
477 |
}
|
|
478 |
virtual bool val_bool_result() |
|
479 |
{
|
|
480 |
return val_bool(); |
|
481 |
}
|
|
482 |
/**
|
|
483 |
* Returns bit map of tables used by item
|
|
484 |
*/
|
|
485 |
virtual table_map used_tables() const |
|
486 |
{
|
|
487 |
return (table_map) 0L; |
|
488 |
}
|
|
489 |
/**
|
|
1
by brian
clean slate |
490 |
Return table map of tables that can't be NULL tables (tables that are
|
491 |
used in a context where if they would contain a NULL row generated
|
|
492 |
by a LEFT or RIGHT join, the item would not be true).
|
|
493 |
This expression is used on WHERE item to determinate if a LEFT JOIN can be
|
|
494 |
converted to a normal join.
|
|
495 |
Generally this function should return used_tables() if the function
|
|
496 |
would return null if any of the arguments are null
|
|
497 |
As this is only used in the beginning of optimization, the value don't
|
|
498 |
have to be updated in update_used_tables()
|
|
499 |
*/
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
500 |
virtual table_map not_null_tables() const |
501 |
{
|
|
502 |
return used_tables(); |
|
503 |
}
|
|
504 |
/**
|
|
1
by brian
clean slate |
505 |
Returns true if this is a simple constant item like an integer, not
|
506 |
a constant expression. Used in the optimizer to propagate basic constants.
|
|
507 |
*/
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
508 |
virtual bool basic_const_item() const |
509 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
510 |
return false; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
511 |
}
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
512 |
/* cloning of constant items (NULL if it is not const) */
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
513 |
virtual Item *clone_item() |
514 |
{
|
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
515 |
return NULL; |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
516 |
}
|
517 |
virtual cond_result eq_cmp_result() const |
|
518 |
{
|
|
519 |
return COND_OK; |
|
520 |
}
|
|
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
521 |
uint32_t float_length(uint32_t decimals_par) const; |
482
by Brian Aker
Remove uint. |
522 |
virtual uint32_t decimal_precision() const; |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
523 |
int decimal_int_part() const; |
524 |
||
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
525 |
/**
|
1
by brian
clean slate |
526 |
Returns true if this is constant (during query execution, i.e. its value
|
527 |
will not change until next fix_fields) and its value is known.
|
|
528 |
*/
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
529 |
virtual bool const_item() const |
530 |
{
|
|
531 |
return used_tables() == 0; |
|
532 |
}
|
|
533 |
/**
|
|
1
by brian
clean slate |
534 |
Returns true if this is constant but its value may be not known yet.
|
535 |
(Can be used for parameters of prep. stmts or of stored procedures.)
|
|
536 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
537 |
virtual bool const_during_execution() const |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
538 |
{
|
539 |
return (used_tables() & ~PARAM_TABLE_BIT) == 0; |
|
540 |
}
|
|
1
by brian
clean slate |
541 |
|
542 |
/**
|
|
543 |
This method is used for to:
|
|
544 |
- to generate a view definition query (SELECT-statement);
|
|
545 |
- to generate a SQL-query for EXPLAIN EXTENDED;
|
|
546 |
- to generate a SQL-query to be shown in INFORMATION_SCHEMA;
|
|
547 |
- debug.
|
|
548 |
||
549 |
For more information about view definition query, INFORMATION_SCHEMA
|
|
550 |
query and why they should be generated from the Item-tree, @see
|
|
2026.2.1
by Monty Taylor
Renamed things prefixed mysql_ or mysqld_ |
551 |
register_view().
|
1
by brian
clean slate |
552 |
*/
|
2215.2.1
by Stewart Smith
remove enum_query_type which was effectively unused. It was set to one value once, compared to it once (i.e. always true) and passed around everywhere doing nothing. |
553 |
virtual void print(String *str); |
1
by brian
clean slate |
554 |
|
2215.2.1
by Stewart Smith
remove enum_query_type which was effectively unused. It was set to one value once, compared to it once (i.e. always true) and passed around everywhere doing nothing. |
555 |
void print_item_w_name(String *); |
1
by brian
clean slate |
556 |
virtual void update_used_tables() {} |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
557 |
virtual void split_sum_func(Session *session, |
558 |
Item **ref_pointer_array, |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
559 |
List<Item> &fields); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
560 |
/**
|
561 |
Move SUM items out from item tree and replace with reference.
|
|
562 |
||
563 |
@param session Thread handler
|
|
564 |
@param ref_pointer_array Pointer to array of reference fields
|
|
565 |
@param fields All fields in select
|
|
566 |
@param ref Pointer to item
|
|
567 |
@param skip_registered <=> function be must skipped for registered
|
|
568 |
SUM items
|
|
569 |
||
570 |
@note
|
|
571 |
This is from split_sum_func() for items that should be split
|
|
572 |
||
573 |
All found SUM items are added FIRST in the fields list and
|
|
574 |
we replace the item with a reference.
|
|
575 |
||
576 |
session->fatal_error() may be called if we are out of memory
|
|
577 |
*/
|
|
578 |
void split_sum_func(Session *session, |
|
579 |
Item **ref_pointer_array, |
|
779.3.18
by Monty Taylor
Cleaned up warnings up through innodb. |
580 |
List<Item> &fields, |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
581 |
Item **ref, |
582 |
bool skip_registered); |
|
584.4.9
by Monty Taylor
Renamed split_sum_func2 to split_sum_func. It's C++. |
583 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
584 |
/**
|
2030.1.5
by Brian Aker
Update for moving DRIZZLE_TIME to type::Time |
585 |
Get the value of the function as a type::Time structure.
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
586 |
As a extra convenience the time structure is reset on error!
|
587 |
*/
|
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
588 |
virtual bool get_date(type::Time <ime, uint32_t fuzzydate); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
589 |
/**
|
590 |
Get time of first argument.
|
|
591 |
||
592 |
As a extra convenience the time structure is reset on error!
|
|
593 |
*/
|
|
2104.2.8
by Brian Aker
Merge in reference from pointer. |
594 |
virtual bool get_time(type::Time <ime); |
595 |
virtual bool get_date_result(type::Time <ime,uint32_t fuzzydate); |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
596 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
597 |
/**
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
598 |
The method allows to determine nullness of a complex expression
|
599 |
without fully evaluating it, instead of calling val/result*() then
|
|
1
by brian
clean slate |
600 |
checking null_value. Used in Item_func_isnull/Item_func_isnotnull
|
601 |
and Item_sum_count/Item_sum_count_distinct.
|
|
602 |
Any new item which can be NULL must implement this method.
|
|
603 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
604 |
virtual bool is_null(); |
1
by brian
clean slate |
605 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
606 |
/** Make sure the null_value member has a correct value. */
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
607 |
virtual void update_null_value (); |
1
by brian
clean slate |
608 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
609 |
/**
|
1
by brian
clean slate |
610 |
Inform the item that there will be no distinction between its result
|
163
by Brian Aker
Merge Monty's code. |
611 |
being false or NULL.
|
1
by brian
clean slate |
612 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
613 |
@note
|
614 |
||
1
by brian
clean slate |
615 |
This function will be called for eg. Items that are top-level AND-parts
|
616 |
of the WHERE clause. Items implementing this function (currently
|
|
617 |
Item_cond_and and subquery-related item) enable special optimizations
|
|
618 |
when they are "top level".
|
|
619 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
620 |
virtual void top_level_item(void); |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
621 |
/**
|
622 |
* Sets field of temporary table for Item which can be switched on temporary
|
|
623 |
* table during query processing (grouping and so on)
|
|
624 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
625 |
virtual void set_result_field(Field *field); |
626 |
virtual bool is_result_field(void); |
|
627 |
virtual bool is_bool_func(void); |
|
628 |
virtual void save_in_result_field(bool no_conversions); |
|
629 |
||
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
630 |
/**
|
631 |
* Sets value of aggregate function in case of no rows for grouping were found
|
|
632 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
633 |
virtual void no_rows_in_result(void); |
634 |
virtual Item *copy_or_same(Session *session); |
|
635 |
||
636 |
virtual Item *copy_andor_structure(Session *session); |
|
637 |
||
638 |
virtual Item *real_item(void); |
|
779.3.10
by Monty Taylor
Turned on -Wshadow. |
639 |
virtual const Item *real_item(void) const; |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
640 |
virtual Item *get_tmp_table_item(Session *session); |
1
by brian
clean slate |
641 |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
642 |
static const CHARSET_INFO *default_charset(); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
643 |
virtual const CHARSET_INFO *compare_collation(); |
1
by brian
clean slate |
644 |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
645 |
virtual bool walk(Item_processor processor, |
646 |
bool walk_subquery, |
|
647 |
unsigned char *arg); |
|
1
by brian
clean slate |
648 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
649 |
/**
|
650 |
Traverse item tree possibly transforming it (replacing items).
|
|
651 |
||
652 |
If you don't need to transform an item tree, but only traverse
|
|
653 |
it, please use Item::walk() instead.
|
|
654 |
||
655 |
@param transformer functor that performs transformation of a subtree
|
|
656 |
@param arg opaque argument passed to the functor
|
|
657 |
||
658 |
@return
|
|
659 |
Returns pointer to the new subtree root. Session::change_item_tree()
|
|
660 |
should be called for it if transformation took place, i.e. if a
|
|
661 |
pointer to newly allocated item is returned.
|
|
662 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
663 |
virtual Item* transform(Item_transformer transformer, unsigned char *arg); |
1
by brian
clean slate |
664 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
665 |
/**
|
1
by brian
clean slate |
666 |
This function performs a generic "compilation" of the Item tree.
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
667 |
The process of compilation is assumed to go as follows:
|
668 |
||
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
669 |
@code
|
1
by brian
clean slate |
670 |
compile()
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
671 |
{
|
1
by brian
clean slate |
672 |
if (this->*some_analyzer(...))
|
673 |
{
|
|
674 |
compile children if any;
|
|
675 |
this->*some_transformer(...);
|
|
676 |
}
|
|
677 |
}
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
678 |
@endcode
|
1
by brian
clean slate |
679 |
|
680 |
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 |
681 |
bottom-up.
|
1
by brian
clean slate |
682 |
*/
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
683 |
virtual Item* compile(Item_analyzer analyzer, |
684 |
unsigned char **arg_p, |
|
685 |
Item_transformer transformer, |
|
686 |
unsigned char *arg_t); |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
687 |
|
688 |
virtual void traverse_cond(Cond_traverser traverser, |
|
689 |
void *arg, |
|
690 |
traverse_order order); |
|
691 |
||
692 |
virtual bool remove_dependence_processor(unsigned char * arg); |
|
693 |
virtual bool remove_fixed(unsigned char * arg); |
|
694 |
virtual bool collect_item_field_processor(unsigned char * arg); |
|
695 |
virtual bool find_item_in_field_list_processor(unsigned char *arg); |
|
696 |
virtual bool change_context_processor(unsigned char *context); |
|
697 |
virtual bool register_field_in_read_map(unsigned char *arg); |
|
698 |
virtual bool subst_argument_checker(unsigned char **arg); |
|
1
by brian
clean slate |
699 |
|
1240.8.4
by Dennis Schoen
add Item functions |
700 |
virtual bool cache_const_expr_analyzer(unsigned char **arg); |
701 |
virtual Item* cache_const_expr_transformer(unsigned char *arg); |
|
702 |
||
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
703 |
virtual Item *equal_fields_propagator(unsigned char * arg); |
704 |
virtual bool set_no_const_sub(unsigned char *arg); |
|
705 |
virtual Item *replace_equal_field(unsigned char * arg); |
|
1
by brian
clean slate |
706 |
|
707 |
// Row emulation
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
708 |
virtual uint32_t cols(); |
709 |
virtual Item* element_index(uint32_t i); |
|
710 |
virtual Item** addr(uint32_t i); |
|
482
by Brian Aker
Remove uint. |
711 |
virtual bool check_cols(uint32_t c); |
1
by brian
clean slate |
712 |
// It is not row => null inside is impossible
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
713 |
virtual bool null_inside(); |
1
by brian
clean slate |
714 |
// used in row subselects to get value of elements
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
715 |
virtual void bring_value(); |
1
by brian
clean slate |
716 |
|
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
717 |
/**
|
718 |
Create a field based on field_type of argument.
|
|
719 |
||
720 |
For now, this is only used to create a field for
|
|
721 |
IFNULL(x,something) and time functions
|
|
722 |
||
723 |
@retval
|
|
724 |
NULL error
|
|
725 |
@retval
|
|
726 |
\# Created field
|
|
727 |
*/
|
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
728 |
Field *tmp_table_field_from_field_type(Table *table, bool fixed_length); |
1
by brian
clean slate |
729 |
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
730 |
virtual Item *neg_transformer(Session *session); |
731 |
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. |
732 |
virtual Item *safe_charset_converter(const CHARSET_INFO * const tocs); |
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
733 |
void delete_self(); |
1
by brian
clean slate |
734 |
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
735 |
/**
|
736 |
* Returns true for Items representing DATE/TIME functions and DATE/TIME table fields.
|
|
737 |
* Those Items have result_type()==STRING_RESULT (and not INT_RESULT), but
|
|
738 |
* their values should be compared as integers (because the integer
|
|
739 |
* representation is more precise than the string one).
|
|
740 |
*/
|
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
741 |
virtual bool result_as_int64_t(); |
1
by brian
clean slate |
742 |
bool is_datetime(); |
743 |
||
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
744 |
/**
|
745 |
* Tests whether an expression is expensive to compute. Used during
|
|
746 |
* optimization to avoid computing expensive expressions during this
|
|
747 |
* phase. Also used to force temp tables when sorting on expensive
|
|
748 |
* functions.
|
|
749 |
*
|
|
750 |
* @todo
|
|
751 |
*
|
|
752 |
* Normally we should have a method:
|
|
753 |
* cost Item::execution_cost(),
|
|
754 |
* where 'cost' is either 'double' or some structure of various cost
|
|
755 |
* parameters.
|
|
1637.5.6
by Prafulla Tekawade
This bug is simillar to mysql bug 36133 |
756 |
*
|
757 |
*NOTE
|
|
758 |
* This function is now used to prevent evaluation of materialized IN
|
|
759 |
* subquery predicates before it is allowed. grep for
|
|
760 |
* DontEvaluateMaterializedSubqueryTooEarly to see the uses.
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
761 |
*/
|
584.4.8
by Monty Taylor
Moved stuff from item.h to item.cc |
762 |
virtual bool is_expensive(); |
763 |
||
1
by brian
clean slate |
764 |
String *check_well_formed_result(String *str, bool send_error= 0); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
765 |
/**
|
766 |
* Compares two items using a given collation
|
|
767 |
*
|
|
768 |
* @details
|
|
769 |
*
|
|
770 |
* This method works exactly as Item::eq if the collation cs coincides with
|
|
771 |
* the collation of the compared objects. Otherwise, first the collations that
|
|
772 |
* differ from cs are replaced for cs and then the items are compared by
|
|
773 |
* Item::eq. After the comparison the original collations of items are
|
|
774 |
* restored.
|
|
775 |
*
|
|
776 |
* @param Pointer to the item to compare with
|
|
777 |
* @param Compare as binary?
|
|
778 |
* @param Pointer to the collation to use when comparing strings
|
|
779 |
*
|
|
780 |
* @retval
|
|
781 |
* true if compared items has been detected as equal
|
|
782 |
* @retval
|
|
783 |
* false otherwise
|
|
784 |
*/
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
785 |
bool eq_by_collation(Item *item, bool binary_cmp, const CHARSET_INFO * const cs); |
2015.1.3
by Brian Aker
Merge in CAST operators for SIGNED/UNSIGNED |
786 |
|
787 |
inline uint32_t char_to_byte_length_safe(uint32_t char_length_arg, uint32_t mbmaxlen_arg) |
|
788 |
{
|
|
789 |
uint64_t tmp= ((uint64_t) char_length_arg) * mbmaxlen_arg; |
|
790 |
return (tmp > UINT32_MAX) ? (uint32_t) UINT32_MAX : (uint32_t) tmp; |
|
791 |
}
|
|
792 |
||
2154.2.4
by Brian Aker
This fixes 716459 |
793 |
uint32_t max_char_length() const; |
794 |
||
795 |
void fix_length_and_charset(uint32_t max_char_length_arg, CHARSET_INFO *cs); |
|
796 |
void fix_char_length(uint32_t max_char_length_arg); |
|
797 |
void fix_char_length_uint64_t(uint64_t max_char_length_arg); |
|
798 |
void fix_length_and_charset_datetime(uint32_t max_char_length_arg); |
|
799 |
||
2137.1.10
by Brian Aker
Fix item so that we have session (ie, it always exists within the context so |
800 |
protected: |
801 |
Session &getSession() |
|
802 |
{
|
|
803 |
return _session; |
|
804 |
}
|
|
805 |
||
806 |
private: |
|
807 |
Session &_session; |
|
1
by brian
clean slate |
808 |
};
|
809 |
||
1992.5.1
by Brian Aker
Additional cerr output bits for a few classes (Item, Field,...) |
810 |
namespace display { |
811 |
const std::string &type(Item::Type type); |
|
812 |
} /* namespace display */ |
|
813 |
||
814 |
std::ostream& operator<<(std::ostream& output, const Item &item); |
|
815 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
816 |
} /* namespace drizzled */ |
817 |
||
818 |
/** @TODO Why is this in the middle? */
|
|
642.1.1
by Lee
move functions from item.cc/item.h to item directory |
819 |
#include <drizzled/item/ident.h> |
820 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
821 |
namespace drizzled |
822 |
{
|
|
823 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
824 |
/**
|
825 |
Mark item and Select_Lexs as dependent if item was resolved in
|
|
826 |
outer SELECT.
|
|
827 |
||
828 |
@param session thread handler
|
|
829 |
@param last select from which current item depend
|
|
830 |
@param current current select
|
|
831 |
@param resolved_item item which was resolved in outer SELECT(for warning)
|
|
832 |
@param mark_item item which should be marked (can be differ in case of
|
|
833 |
substitution)
|
|
834 |
*/
|
|
656.1.6
by Monty Taylor
Merged in Eric's whitespace cleanup. |
835 |
void mark_as_dependent(Session *session, |
846
by Brian Aker
Removing on typedeffed class. |
836 |
Select_Lex *last, |
837 |
Select_Lex *current, |
|
642.1.1
by Lee
move functions from item.cc/item.h to item directory |
838 |
Item_ident *resolved_item, |
839 |
Item_ident *mark_item); |
|
840 |
||
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
841 |
/**
|
842 |
Resolve a column reference in a sub-select.
|
|
843 |
||
844 |
Resolve a column reference (usually inside a HAVING clause) against the
|
|
845 |
SELECT and GROUP BY clauses of the query described by 'select'. The name
|
|
846 |
resolution algorithm searches both the SELECT and GROUP BY clauses, and in
|
|
847 |
case of a name conflict prefers GROUP BY column names over SELECT names. If
|
|
848 |
both clauses contain different fields with the same names, a warning is
|
|
849 |
issued that name of 'ref' is ambiguous. We extend ANSI SQL in that when no
|
|
850 |
GROUP BY column is found, then a HAVING name is resolved as a possibly
|
|
851 |
derived SELECT column. This extension is allowed only if the
|
|
852 |
MODE_ONLY_FULL_GROUP_BY sql mode isn't enabled.
|
|
853 |
||
854 |
@param session current thread
|
|
855 |
@param ref column reference being resolved
|
|
856 |
@param select the select that ref is resolved against
|
|
857 |
||
858 |
@note
|
|
859 |
The resolution procedure is:
|
|
860 |
- Search for a column or derived column named col_ref_i [in table T_j]
|
|
861 |
in the SELECT clause of Q.
|
|
862 |
- Search for a column named col_ref_i [in table T_j]
|
|
863 |
in the GROUP BY clause of Q.
|
|
864 |
- If found different columns with the same name in GROUP BY and SELECT
|
|
865 |
- issue a warning and return the GROUP BY column,
|
|
866 |
- otherwise
|
|
867 |
- if the MODE_ONLY_FULL_GROUP_BY mode is enabled return error
|
|
868 |
- else return the found SELECT column.
|
|
869 |
||
870 |
||
871 |
@return
|
|
872 |
- NULL - there was an error, and the error was already reported
|
|
873 |
- not_found_item - the item was not resolved, no error was reported
|
|
874 |
- resolved item - if the item was resolved
|
|
875 |
*/
|
|
876 |
Item** resolve_ref_in_select_and_group(Session *session, Item_ident *ref, Select_Lex *select); |
|
877 |
||
878 |
/**
|
|
879 |
Mark range of selects and resolved identifier (field/reference)
|
|
880 |
item as dependent.
|
|
881 |
||
882 |
@param session thread handler
|
|
883 |
@param last_select select where resolved_item was resolved
|
|
884 |
@param current_sel current select (select where resolved_item was placed)
|
|
885 |
@param found_field field which was found during resolving
|
|
886 |
@param found_item Item which was found during resolving (if resolved
|
|
887 |
identifier belongs to VIEW)
|
|
888 |
@param resolved_item Identifier which was resolved
|
|
889 |
||
890 |
@note
|
|
891 |
We have to mark all items between current_sel (including) and
|
|
892 |
last_select (excluding) as dependend (select before last_select should
|
|
893 |
be marked with actual table mask used by resolved item, all other with
|
|
894 |
OUTER_REF_TABLE_BIT) and also write dependence information to Item of
|
|
895 |
resolved identifier.
|
|
896 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
897 |
void mark_select_range_as_dependent(Session *session, |
846
by Brian Aker
Removing on typedeffed class. |
898 |
Select_Lex *last_select, |
899 |
Select_Lex *current_sel, |
|
1
by brian
clean slate |
900 |
Field *found_field, Item *found_item, |
901 |
Item_ident *resolved_item); |
|
902 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
903 |
extern void resolve_const_item(Session *session, Item **ref, Item *cmp_item); |
1055.2.12
by Jay Pipes
Documentation and style cleanup on Item class |
904 |
/**
|
905 |
Return true if the value stored in the field is equal to the const
|
|
906 |
item.
|
|
907 |
||
908 |
We need to use this on the range optimizer because in some cases
|
|
909 |
we can't store the value in the field without some precision/character loss.
|
|
910 |
*/
|
|
1
by brian
clean slate |
911 |
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) |
912 |
|
575.4.7
by Monty Taylor
More header cleanup. |
913 |
/**
|
914 |
Create field for temporary table.
|
|
915 |
||
1235.1.11
by Brian Aker
Small cleanups, did in MERGE table only engine flag. |
916 |
@todo:
|
917 |
||
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
918 |
This is here for now because it needs the Item::Type. It should live
|
919 |
in Field or Table once item.h is clean enough to actually include
|
|
920 |
||
575.4.7
by Monty Taylor
More header cleanup. |
921 |
@param session Thread handler
|
922 |
@param table Temporary table
|
|
923 |
@param item Item to create a field for
|
|
924 |
@param type Type of item (normally item->type)
|
|
925 |
@param copy_func If set and item is a function, store copy of item
|
|
926 |
in this array
|
|
927 |
@param from_field if field will be created using other field as example,
|
|
928 |
pointer example field will be written here
|
|
929 |
@param default_field If field has a default value field, store it here
|
|
930 |
@param group 1 if we are going to do a relative group by on result
|
|
931 |
@param modify_item 1 if item->result_field should point to new item.
|
|
932 |
This is relevent for how fill_record() is going to
|
|
933 |
work:
|
|
934 |
If modify_item is 1 then fill_record() will update
|
|
935 |
the record in the original table.
|
|
936 |
If modify_item is 0 then fill_record() will update
|
|
937 |
the temporary table
|
|
938 |
@param convert_blob_length If >0 create a varstring(convert_blob_length)
|
|
939 |
field instead of blob.
|
|
940 |
||
941 |
@retval
|
|
942 |
0 on error
|
|
943 |
@retval
|
|
944 |
new_created field
|
|
945 |
*/
|
|
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
946 |
Field *create_tmp_field(Session *session, |
1235.1.11
by Brian Aker
Small cleanups, did in MERGE table only engine flag. |
947 |
Table *table, |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
948 |
Item *item, |
575.4.7
by Monty Taylor
More header cleanup. |
949 |
Item::Type type, |
1235.1.11
by Brian Aker
Small cleanups, did in MERGE table only engine flag. |
950 |
Item ***copy_func, |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
951 |
Field **from_field, |
575.4.7
by Monty Taylor
More header cleanup. |
952 |
Field **def_field, |
1235.1.11
by Brian Aker
Small cleanups, did in MERGE table only engine flag. |
953 |
bool group, |
1055.2.11
by Jay Pipes
Adds documentation to Item class members and methods. Style and indentation cleanup in item.h |
954 |
bool modify_item, |
575.4.7
by Monty Taylor
More header cleanup. |
955 |
bool make_copy_field, |
956 |
uint32_t convert_blob_length); |
|
957 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
958 |
} /* namespace drizzled */ |
959 |