diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2009-03-11 16:32:42 +0100 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2009-03-11 16:32:42 +0100 |
commit | b0fcbc84ef609b1147c3624e90fe3dac66ef8c1d (patch) | |
tree | ee09976ab4dd9dee924a4c7e30eb0fc9f5e7d63f /sql/item.cc | |
parent | a15d25f07e56cbd80aecbeadef635d3b55e00e85 (diff) | |
parent | 11570d64fcffa66feaf1fdb8072fdfb9dbd865ca (diff) | |
download | mariadb-git-b0fcbc84ef609b1147c3624e90fe3dac66ef8c1d.tar.gz |
merge of 5.1-main into 5.1-maria; MyISAM changes are also ported to Maria.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc index f74d8df1045..1ecbecf8615 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1272,13 +1272,26 @@ Item::Type Item_name_const::type() const valid_args guarantees value_item->basic_const_item(); if type is FUNC_ITEM, then we have a fudged item_func_neg() on our hands and return the underlying type. + For Item_func_set_collation() + e.g. NAME_CONST('name', 'value' COLLATE collation) we return its + 'value' argument type. */ - return valid_args ? - (((value_item->type() == FUNC_ITEM) && - (((Item_func *) value_item)->functype() == Item_func::NEG_FUNC)) ? - ((Item_func *) value_item)->key_item()->type() : - value_item->type()) : - NULL_ITEM; + if (!valid_args) + return NULL_ITEM; + Item::Type value_type= value_item->type(); + if (value_type == FUNC_ITEM) + { + /* + The second argument of NAME_CONST('name', 'value') must be + a simple constant item or a NEG_FUNC/COLLATE_FUNC. + */ + DBUG_ASSERT(((Item_func *) value_item)->functype() == + Item_func::NEG_FUNC || + ((Item_func *) value_item)->functype() == + Item_func::COLLATE_FUNC); + return ((Item_func *) value_item)->key_item()->type(); + } + return value_type; } |