1/* Copyright (c) 2017, MariaDB
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15
16#ifndef SQL_TVC_INCLUDED
17#define SQL_TVC_INCLUDED
18#include "sql_type.h"
19
20typedef List<Item> List_item;
21class select_result;
22class Explain_select;
23class Explain_query;
24class Item_func_in;
25class st_select_lex_unit;
26typedef class st_select_lex SELECT_LEX;
27
28/**
29 @class table_value_constr
30 @brief Definition of a Table Value Construction(TVC)
31
32 It contains a list of lists of values which this TVC is defined by and
33 reference on SELECT where this TVC is defined.
34*/
35class table_value_constr : public Sql_alloc
36{
37public:
38 List<List_item> lists_of_values;
39 select_result *result;
40 SELECT_LEX *select_lex;
41
42 enum { QEP_NOT_PRESENT_YET, QEP_AVAILABLE} have_query_plan;
43
44 Explain_select *explain;
45 ulonglong select_options;
46
47 table_value_constr(List<List_item> tvc_values, SELECT_LEX *sl,
48 ulonglong select_options_arg) :
49 lists_of_values(tvc_values), result(0), select_lex(sl),
50 have_query_plan(QEP_NOT_PRESENT_YET), explain(0),
51 select_options(select_options_arg)
52 { };
53
54 bool prepare(THD *thd_arg, SELECT_LEX *sl,
55 select_result *tmp_result,
56 st_select_lex_unit *unit_arg);
57
58 int save_explain_data_intern(THD *thd_arg,
59 Explain_query *output);
60 bool optimize(THD *thd_arg);
61 bool exec(SELECT_LEX *sl);
62
63 void print(THD *thd_arg, String *str, enum_query_type query_type);
64};
65#endif /* SQL_TVC_INCLUDED */
66