1 /* Copyright (c) 2006, 2021, Oracle and/or its affiliates.
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, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
22 
23 #ifndef SQL_UNION_INCLUDED
24 #define SQL_UNION_INCLUDED
25 
26 #include "my_global.h"          // ulong
27 #include "sql_class.h"          // Query_result_interceptor
28 
29 struct LEX;
30 
31 typedef class st_select_lex_unit SELECT_LEX_UNIT;
32 
33 class Query_result_union :public Query_result_interceptor
34 {
35   Temp_table_param tmp_table_param;
36 public:
37   TABLE *table;
38   bool is_union_mixed_with_union_all; // Mark the mixed operation
39 
Query_result_union()40   Query_result_union() :table(0),
41   is_union_mixed_with_union_all(false){}
42   int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
43   /**
44     Do prepare() and prepare2() if they have been postponed until
45     column type information is computed (used by Query_result_union_direct).
46 
47     @param types Column types
48 
49     @return false on success, true on failure
50   */
postponed_prepare(List<Item> & types)51   virtual bool postponed_prepare(List<Item> &types)
52   { return false; }
53   bool send_data(List<Item> &items);
54   bool send_eof();
55   virtual bool flush();
56   void cleanup();
57   bool create_result_table(THD *thd, List<Item> *column_types,
58                            bool is_distinct, ulonglong options,
59                            const char *alias, bool bit_fields_as_long,
60                            bool create_table);
61   friend bool TABLE_LIST::create_derived(THD *thd);
62 };
63 
64 #endif /* SQL_UNION_INCLUDED */
65