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