1 #ifndef ITEM_ROW_INCLUDED
2 #define ITEM_ROW_INCLUDED
3 
4 /* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
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 class Item_row: public Item
20 {
21   Item **items;
22   table_map used_tables_cache, not_null_tables_cache;
23   uint arg_count;
24   bool const_item_cache;
25   bool with_null;
26 public:
27   Item_row(List<Item> &);
Item_row(Item_row * item)28   Item_row(Item_row *item):
29     Item(),
30     items(item->items),
31     used_tables_cache(item->used_tables_cache),
32     not_null_tables_cache(0),
33     arg_count(item->arg_count),
34     const_item_cache(item->const_item_cache),
35     with_null(0)
36   {}
37 
type()38   enum Type type() const { return ROW_ITEM; };
39   void illegal_method_call(const char *);
is_null()40   bool is_null() { return null_value; }
make_field(Send_field *)41   void make_field(Send_field *)
42   {
43     illegal_method_call((const char*)"make_field");
44   };
val_real()45   double val_real()
46   {
47     illegal_method_call((const char*)"val");
48     return 0;
49   };
val_int()50   longlong val_int()
51   {
52     illegal_method_call((const char*)"val_int");
53     return 0;
54   };
val_str(String *)55   String *val_str(String *)
56   {
57     illegal_method_call((const char*)"val_str");
58     return 0;
59   };
val_decimal(my_decimal *)60   my_decimal *val_decimal(my_decimal *)
61   {
62     illegal_method_call((const char*)"val_decimal");
63     return 0;
64   };
65   bool fix_fields(THD *thd, Item **ref);
66   void cleanup();
67   void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
used_tables()68   table_map used_tables() const { return used_tables_cache; };
const_item()69   bool const_item() const { return const_item_cache; };
result_type()70   enum Item_result result_type() const { return ROW_RESULT; }
71   void update_used_tables();
not_null_tables()72   table_map not_null_tables() const { return not_null_tables_cache; }
73   virtual void print(String *str, enum_query_type query_type);
74 
75   bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
76   Item *transform(Item_transformer transformer, uchar *arg);
77 
cols()78   uint cols() { return arg_count; }
element_index(uint i)79   Item* element_index(uint i) { return items[i]; }
addr(uint i)80   Item** addr(uint i) { return items + i; }
81   bool check_cols(uint c);
null_inside()82   bool null_inside() { return with_null; };
83   void bring_value();
84 };
85 
86 #endif /* ITEM_ROW_INCLUDED */
87