summaryrefslogtreecommitdiff
path: root/sql/item_row.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-04-24 12:59:21 +0400
committerAlexander Barkov <bar@mariadb.org>2015-04-24 12:59:21 +0400
commit04fb09d7811606e1a1a8f646532e1b379d50b217 (patch)
treeeaff2e4e2123dc8bcd215a46ebed96adebe46891 /sql/item_row.h
parentc2dd88ac85e6b1fe63ac36465f62a784cf6b4d4a (diff)
downloadmariadb-git-04fb09d7811606e1a1a8f646532e1b379d50b217.tar.gz
Deriving Item_row from Item_args and sharing more code
between Item_func, Item_sum, Item_row.
Diffstat (limited to 'sql/item_row.h')
-rw-r--r--sql/item_row.h38
1 files changed, 27 insertions, 11 deletions
diff --git a/sql/item_row.h b/sql/item_row.h
index 31efc015909..1bec6212715 100644
--- a/sql/item_row.h
+++ b/sql/item_row.h
@@ -17,20 +17,31 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-class Item_row: public Item, private Used_tables_and_const_cache
+/**
+ Row items used for comparing rows and IN operations on rows:
+
+ @verbatim
+ (a, b, c) > (10, 10, 30)
+ (a, b, c) = (select c, d, e, from t1 where x=12)
+ (a, b, c) IN ((1,2,2), (3,4,5), (6,7,8)
+ (a, b, c) IN (select c, d, e, from t1)
+ @endverbatim
+*/
+
+class Item_row: public Item,
+ private Item_args,
+ private Used_tables_and_const_cache
{
- Item **items;
table_map not_null_tables_cache;
- uint arg_count;
bool with_null;
public:
- Item_row(List<Item> &);
+ Item_row(List<Item> &list)
+ :Item_args(list), not_null_tables_cache(0), with_null(0)
+ { }
Item_row(Item_row *item):
- Item(),
+ Item_args(item),
Used_tables_and_const_cache(item),
- items(item->items),
not_null_tables_cache(0),
- arg_count(item->arg_count),
with_null(0)
{}
@@ -72,18 +83,23 @@ public:
void update_used_tables()
{
used_tables_and_const_cache_init();
- used_tables_and_const_cache_update_and_join(arg_count, items);
+ used_tables_and_const_cache_update_and_join(arg_count, args);
}
table_map not_null_tables() const { return not_null_tables_cache; }
virtual void print(String *str, enum_query_type query_type);
- bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
+ bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
+ {
+ if (walk_args(processor, walk_subquery, arg))
+ return true;
+ return (this->*processor)(arg);
+ }
Item *transform(Item_transformer transformer, uchar *arg);
bool eval_not_null_tables(uchar *opt_arg);
uint cols() { return arg_count; }
- Item* element_index(uint i) { return items[i]; }
- Item** addr(uint i) { return items + i; }
+ Item* element_index(uint i) { return args[i]; }
+ Item** addr(uint i) { return args + i; }
bool check_cols(uint c);
bool null_inside() { return with_null; };
void bring_value();