diff options
author | unknown <serg@serg.mysql.com> | 2003-03-02 14:07:32 +0100 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2003-03-02 14:07:32 +0100 |
commit | c5cd20fe8f37b4ff693bdb9cb24e8cf7d1b59194 (patch) | |
tree | 3bbe3ed618acb5ea8d0a6fbfde522de0a4b5efc1 /sql/item_cmpfunc.cc | |
parent | a2cc82182bbebb24a75e2d54d5361b3932416b9c (diff) | |
download | mariadb-git-c5cd20fe8f37b4ff693bdb9cb24e8cf7d1b59194.tar.gz |
optimizer should check for "field LIKE const" not "field like STRING"
BitKeeper/etc/ignore:
Added configure.lineno innobase/configure.lineno to the ignore list
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 55e8ef7c4b5..d96069a17aa 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1409,12 +1409,16 @@ longlong Item_func_like::val_int() Item_func::optimize_type Item_func_like::select_optimize() const { - if (args[1]->type() == STRING_ITEM) + if (args[1]->const_item()) { - if (((Item_string *) args[1])->str_value[0] != wild_many) + String* res2= args[1]->val_str((String *)&tmp_value2); + + if (!res2) + return OPTIMIZE_NONE; + + if (*res2->ptr() != wild_many) { - if ((args[0]->result_type() != STRING_RESULT) || - ((Item_string *) args[1])->str_value[0] != wild_one) + if (args[0]->result_type() != STRING_RESULT || *res2->ptr() != wild_one) return OPTIMIZE_OP; } } |