From da566c16c0c03f56caa8bd6bfd9452b73ad1a456 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Nov 2003 17:23:52 -0800 Subject: This ChangeSet Introdices Item_equal. The objects of this class represent multiple conjunctive equalities in where conditions: =(f1,f2,...fn) <=> f1=f2 and f2= ... and =fn. The objects are used to generate new possibale paths to access the tables when executing a query. They are also used to optimize the execution plan chosen by the optimizer for the query. sql/item.cc: Introduced Item_equal sql/item.h: Introduced Item_equal. Added traverse method. sql/item_cmpfunc.cc: Introduced Item_equal. Added traverse mehtod. sql/item_cmpfunc.h: Itroduced Item_equal and Item_equal_iterator. sql/item_func.cc: Added traverse method. Introduced Item_equal. sql/item_func.h: Introduced Item_equal. Added traverse method. sql/item_row.cc: Added traverse method. sql/item_row.h: Added traverse method. sql/item_strfunc.h: Added traverse method. sql/opt_range.cc: Used Item_equal in range analysis. sql/opt_sum.cc: Introduced Item_equal. sql/sql_list.h: Added concat and disjoin methods to lists. Fixed remove method for lists. sql/sql_select.cc: Introdiced Item_equal: created Item_equal; used Item_equal objects to generate new paths to access tables. used Item_equal objects to optimize the execution plan chosen by optimizer. sql/sql_select.h: Introduced Item_equal. --- sql/sql_list.h | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'sql/sql_list.h') diff --git a/sql/sql_list.h b/sql/sql_list.h index 7200046e6c5..d7a62b7fd7d 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -121,10 +121,12 @@ public: void remove(list_node **prev) { list_node *node=(*prev)->next; - delete *prev; - *prev=node; if (!--elements) last= &first; + else if (last == &(*prev)->next) + last= prev; + delete *prev; + *prev=node; } inline void *pop(void) { @@ -135,6 +137,30 @@ public: last= &first; return tmp->info; } + inline void concat(base_list *list) + { + if (!list->is_empty()) + { + *last= list->first; + last= list->last; + elements+= list->elements; + } + } + inline void disjoin(base_list *list) + { + list_node **prev= &first; + list_node *node= first; + list_node *list_first= list->first; + elements=0; + while (node && node != list_first) + { + prev= &node->next; + node= node->next; + elements++; + } + *prev= *last; + last= prev; + } inline list_node* last_node() { return *last; } inline list_node* first_node() { return first;} inline void *head() { return first->info; } @@ -245,6 +271,8 @@ public: inline T* head() {return (T*) base_list::head(); } inline T** head_ref() {return (T**) base_list::head_ref(); } inline T* pop() {return (T*) base_list::pop(); } + inline void concat(List *list) { return base_list::concat(list); } + inline void disjoin(List *list) { return base_list::disjoin(list); } void delete_elements(void) { list_node *element,*next; @@ -265,6 +293,8 @@ public: inline T* operator++(int) { return (T*) base_list_iterator::next(); } inline T *replace(T *a) { return (T*) base_list_iterator::replace(a); } inline T *replace(List &a) { return (T*) base_list_iterator::replace(a); } + inline void rewind(void) { base_list_iterator::rewind(); } + inline void remove() { base_list_iterator::remove(); } inline void after(T *a) { base_list_iterator::after(a); } inline T** ref(void) { return (T**) base_list_iterator::ref(); } }; -- cgit v1.2.1