~drizzle-trunk/drizzle/development

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