summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 960e36f63b4..466b23b3f94 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2010, 2019, MariaDB Corporation.
+ Copyright (c) 2010, 2021, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -938,6 +938,10 @@ public:
void init_query();
st_select_lex* outer_select();
+ const st_select_lex* first_select() const
+ {
+ return reinterpret_cast<const st_select_lex*>(slave);
+ }
st_select_lex* first_select()
{
return reinterpret_cast<st_select_lex*>(slave);
@@ -1473,6 +1477,8 @@ public:
bool save_leaf_tables(THD *thd);
bool save_prep_leaf_tables(THD *thd);
+ void set_unique_exclude();
+
bool is_merged_child_of(st_select_lex *ancestor);
/*
@@ -3081,7 +3087,8 @@ public:
struct LEX: public Query_tables_list
{
SELECT_LEX_UNIT unit; /* most upper unit */
- inline SELECT_LEX *first_select_lex() {return unit.first_select();}
+ SELECT_LEX *first_select_lex() { return unit.first_select(); }
+ const SELECT_LEX *first_select_lex() const { return unit.first_select(); }
private:
SELECT_LEX builtin_select;
@@ -4345,6 +4352,25 @@ public:
return false;
}
+ bool create_like() const
+ {
+ DBUG_ASSERT(!create_info.like() ||
+ !first_select_lex()->item_list.elements);
+ return create_info.like();
+ }
+
+ bool create_select() const
+ {
+ DBUG_ASSERT(!create_info.like() ||
+ !first_select_lex()->item_list.elements);
+ return first_select_lex()->item_list.elements;
+ }
+
+ bool create_simple() const
+ {
+ return !create_like() && !create_select();
+ }
+
SELECT_LEX *exclude_last_select();
SELECT_LEX *exclude_not_first_select(SELECT_LEX *exclude);
void check_automatic_up(enum sub_select_type type);