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