diff options
author | serg@serg.mylan <> | 2003-07-07 19:08:17 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2003-07-07 19:08:17 +0200 |
commit | 5929f2101d35e0c89f3ed0326255e8b76bd0895c (patch) | |
tree | fabf44e1d061e9bf114a6a76ce3f1afd0a7e695b /sql | |
parent | ea8ed30f03fcf99de0578b76310bc970b06ef1ef (diff) | |
parent | bbe08e4a031e3b0fae834e8c2f287231fe6d7e88 (diff) | |
download | mariadb-git-5929f2101d35e0c89f3ed0326255e8b76bd0895c.tar.gz |
Merge bk-internal:/home/bk/mysql-4.0/
into serg.mylan:/usr/home/serg/Abk/mysql-4.0
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7176337dbfd..80e329a7f03 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1655,17 +1655,17 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, { Item_func *arg0=(Item_func *)(func->arguments()[0]), *arg1=(Item_func *)(func->arguments()[1]); - if ((functype == Item_func::GE_FUNC || - functype == Item_func::GT_FUNC) && - arg0->type() == Item::FUNC_ITEM && - arg0->functype() == Item_func::FT_FUNC && - arg1->const_item() && arg1->val()>0) + if (arg1->const_item() && + ((functype == Item_func::GE_FUNC && arg1->val()> 0) || + (functype == Item_func::GT_FUNC && arg1->val()>=0)) && + arg0->type() == Item::FUNC_ITEM && + arg0->functype() == Item_func::FT_FUNC) cond_func=(Item_func_match *) arg0; - else if ((functype == Item_func::LE_FUNC || - functype == Item_func::LT_FUNC) && + else if (arg0->const_item() && + ((functype == Item_func::LE_FUNC && arg0->val()> 0) || + (functype == Item_func::LT_FUNC && arg0->val()>=0)) && arg1->type() == Item::FUNC_ITEM && - arg1->functype() == Item_func::FT_FUNC && - arg0->const_item() && arg0->val()>0) + arg1->functype() == Item_func::FT_FUNC) cond_func=(Item_func_match *) arg1; } } @@ -1676,26 +1676,13 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC) { Item *item; - /* - I'm (Sergei) too lazy to implement proper recursive descent here, - and anyway, nobody will use such a stupid queries - that will require it :-) - May be later... - */ while ((item=li++)) - { - if (item->type() == Item::FUNC_ITEM && - ((Item_func *)item)->functype() == Item_func::FT_FUNC) - { - cond_func=(Item_func_match *)item; - break; - } - } + add_ft_keys(keyuse_array,stat,item,usable_tables); } } - if ((!cond_func || cond_func->key == NO_SUCH_KEY) || - (!(usable_tables & cond_func->table->map))) + if (!cond_func || cond_func->key == NO_SUCH_KEY || + !(usable_tables & cond_func->table->map)) return; KEYUSE keyuse; @@ -1707,7 +1694,6 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, VOID(insert_dynamic(keyuse_array,(gptr) &keyuse)); } - static int sort_keyuse(KEYUSE *a,KEYUSE *b) { |