diff options
author | igor@rurik.mysql.com <> | 2003-11-26 17:23:52 -0800 |
---|---|---|
committer | igor@rurik.mysql.com <> | 2003-11-26 17:23:52 -0800 |
commit | 3938ac543601aee49d3137621293302f2b577640 (patch) | |
tree | ccfdefe3940ac9e8bf4d61df4e3eb671b6a303a4 /sql/sql_list.h | |
parent | 5b355ea6f51a3224650bbaea6d58e9015ac9000a (diff) | |
download | mariadb-git-3938ac543601aee49d3137621293302f2b577640.tar.gz |
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.
Diffstat (limited to 'sql/sql_list.h')
-rw-r--r-- | sql/sql_list.h | 34 |
1 files changed, 32 insertions, 2 deletions
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<T> *list) { return base_list::concat(list); } + inline void disjoin(List<T> *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<T> &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(); } }; |