1 #ifndef ITEM_ROW_INCLUDED
2 #define ITEM_ROW_INCLUDED
3 
4 /* Copyright (c) 2002, 2011, 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, version 2.0,
8    as published by the Free Software Foundation.
9 
10    This program is also distributed with certain software (including
11    but not limited to OpenSSL) that is licensed under separate terms,
12    as designated in a particular file or component or in included license
13    documentation.  The authors of MySQL hereby grant you an additional
14    permission to link the program and your derivative works with the
15    separately licensed software that they have included with MySQL.
16 
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20    GNU General Public License, version 2.0, for more details.
21 
22    You should have received a copy of the GNU General Public License
23    along with this program; if not, write to the Free Software Foundation,
24    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
25 
26 class Item_row: public Item
27 {
28   Item **items;
29   table_map used_tables_cache, not_null_tables_cache;
30   uint arg_count;
31   bool const_item_cache;
32   bool with_null;
33 public:
34   Item_row(List<Item> &);
35   Item_row(Item *head, List<Item> &tail);
Item_row(Item_row * item)36   Item_row(Item_row *item):
37     Item(),
38     items(item->items),
39     used_tables_cache(item->used_tables_cache),
40     not_null_tables_cache(0),
41     arg_count(item->arg_count),
42     const_item_cache(item->const_item_cache),
43     with_null(0)
44   {}
45 
type()46   enum Type type() const { return ROW_ITEM; };
47   void illegal_method_call(const char *);
is_null()48   bool is_null() { return null_value; }
make_field(Send_field *)49   void make_field(Send_field *)
50   {
51     illegal_method_call((const char*)"make_field");
52   };
val_real()53   double val_real()
54   {
55     illegal_method_call((const char*)"val");
56     return 0;
57   };
val_int()58   longlong val_int()
59   {
60     illegal_method_call((const char*)"val_int");
61     return 0;
62   };
val_str(String *)63   String *val_str(String *)
64   {
65     illegal_method_call((const char*)"val_str");
66     return 0;
67   };
val_decimal(my_decimal *)68   my_decimal *val_decimal(my_decimal *)
69   {
70     illegal_method_call((const char*)"val_decimal");
71     return 0;
72   };
get_date(MYSQL_TIME * ltime,uint fuzzydate)73   bool get_date(MYSQL_TIME *ltime, uint fuzzydate)
74   {
75     illegal_method_call((const char *) "get_date");
76     return true;
77   }
get_time(MYSQL_TIME * ltime)78   bool get_time(MYSQL_TIME *ltime)
79   {
80     illegal_method_call((const char *) "get_time");
81     return true;
82   }
83 
84   bool fix_fields(THD *thd, Item **ref);
85   void fix_after_pullout(st_select_lex *parent_select,
86                          st_select_lex *removed_select);
87   void cleanup();
88   void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
89                       List<Item> &fields);
used_tables()90   table_map used_tables() const { return used_tables_cache; };
const_item()91   bool const_item() const { return const_item_cache; };
result_type()92   enum Item_result result_type() const { return ROW_RESULT; }
93   void update_used_tables();
not_null_tables()94   table_map not_null_tables() const { return not_null_tables_cache; }
95   virtual void print(String *str, enum_query_type query_type);
96 
97   bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
98   Item *transform(Item_transformer transformer, uchar *arg);
99 
cols()100   uint cols() { return arg_count; }
element_index(uint i)101   Item* element_index(uint i) { return items[i]; }
addr(uint i)102   Item** addr(uint i) { return items + i; }
103   bool check_cols(uint c);
null_inside()104   bool null_inside() { return with_null; };
105   void bring_value();
106 };
107 
108 #endif /* ITEM_ROW_INCLUDED */
109