summaryrefslogtreecommitdiff
path: root/sql/sql_cte.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2016-08-29 22:45:17 -0700
committerIgor Babaev <igor@askmonty.org>2016-08-29 22:45:17 -0700
commit9ac235ab7ddaefb2191a03d3e9cb025d584e3c36 (patch)
tree1bdf1222108233b1ec1e753328b704cd1b55a041 /sql/sql_cte.cc
parentc8f85bf263a81a625089507d747236852ec87024 (diff)
downloadmariadb-git-9ac235ab7ddaefb2191a03d3e9cb025d584e3c36.tar.gz
mdev-9864: cleanup, re-factoring.
Added comments. Added reaction for exceeding maximum number of elements in with clause. Added a test case to check this reaction. Added a test case where the specification of a recursive table uses two non-recursive with tables.
Diffstat (limited to 'sql/sql_cte.cc')
-rw-r--r--sql/sql_cte.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 82958333f65..fa18de0f49f 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -8,6 +8,38 @@
/**
@brief
+ Add a new element to this with clause
+
+ @param elem The with element to add to this with clause
+
+ @details
+ The method adds the with element 'elem' to the elements
+ in this with clause. The method reports an error if
+ the number of the added element exceeds the value
+ of the constant max_number_of_elements_in_with_clause.
+
+ @retval
+ true if an error is reported
+ false otherwise
+*/
+
+bool With_clause::add_with_element(With_element *elem)
+{
+ if (with_list.elements == max_number_of_elements_in_with_clause)
+ {
+ my_error(ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE, MYF(0));
+ return true;
+ }
+ elem->owner= this;
+ elem->number= with_list.elements;
+ elem->spec->with_element= elem;
+ with_list.link_in_list(elem, &elem->next);
+ return false;
+}
+
+
+/**
+ @brief
Check dependencies between tables defined in a list of with clauses
@param