~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/insert_value.h

Merged vcol stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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, Inc.
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
 
 */
19
 
 
20
 
#ifndef DRIZZLED_ITEM_INSERT_VALUE_H
21
 
#define DRIZZLED_ITEM_INSERT_VALUE_H
22
 
 
23
 
#include "drizzled/item/field.h"
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
 
/*
29
 
  Item_insert_value -- an implementation of VALUES() function.
30
 
  You can use the VALUES(col_name) function in the UPDATE clause
31
 
  to refer to column values from the INSERT portion of the INSERT
32
 
  ... UPDATE statement. In other words, VALUES(col_name) in the
33
 
  UPDATE clause refers to the value of col_name that would be
34
 
  inserted, had no duplicate-key conflict occurred.
35
 
  In all other places this function returns NULL.
36
 
*/
37
 
 
38
 
class Item_insert_value : public Item_field
39
 
{
40
 
public: 
41
 
  Item *arg;
42
 
  Item_insert_value(Name_resolution_context *context_arg, Item *a)
43
 
    :Item_field(context_arg, (const char *)NULL, (const char *)NULL,
44
 
               (const char *)NULL),
45
 
     arg(a) {}
46
 
  bool eq(const Item *item, bool binary_cmp) const;
47
 
  bool fix_fields(Session *, Item **);
48
 
  virtual void print(String *str, enum_query_type query_type);
49
 
  int save_in_field(Field *field_arg, bool no_conversions)
50
 
  {
51
 
    return Item_field::save_in_field(field_arg, no_conversions);
52
 
  }
53
 
  /*
54
 
   We use RAND_TABLE_BIT to prevent Item_insert_value from
55
 
   being treated as a constant and precalculated before execution
56
 
  */
57
 
  table_map used_tables() const { return RAND_TABLE_BIT; }
58
 
 
59
 
  bool walk(Item_processor processor, bool walk_subquery, unsigned char *args)
60
 
  {
61
 
    return arg->walk(processor, walk_subquery, args) ||
62
 
            (this->*processor)(args);
63
 
  }
64
 
};
65
 
 
66
 
} /* namespace drizzled */
67
 
 
68
 
#endif /* DRIZZLED_ITEM_INSERT_VALUE_H */