diff options
author | gshchepa/uchum@gleb.loc <> | 2007-11-10 23:44:48 +0400 |
---|---|---|
committer | gshchepa/uchum@gleb.loc <> | 2007-11-10 23:44:48 +0400 |
commit | 0aabb89ee11a7492a0788470be9a6ba018152c9f (patch) | |
tree | c00c29a8fdf1d323a7fd7c0006137770f89a940d /sql/item.h | |
parent | 00e897ac905a893407939791cb28fa192c91c136 (diff) | |
download | mariadb-git-0aabb89ee11a7492a0788470be9a6ba018152c9f.tar.gz |
Fixed bug #28076: inconsistent binary/varbinary comparison.
After adding an index the <VARBINARY> IN (SELECT <BINARY> ...)
clause returned a wrong result: the VARBINARY value was illegally padded
with zero bytes to the length of the BINARY column for the index search.
(<VARBINARY>, ...) IN (SELECT <BINARY>, ... ) clauses are affected too.
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/item.h b/sql/item.h index 2f504badec0..a1135c2c725 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2469,7 +2469,7 @@ public: }; virtual void store(Item *)= 0; enum Type type() const { return CACHE_ITEM; } - static Item_cache* get_cache(Item_result type); + static Item_cache* get_cache(const Item *item); table_map used_tables() const { return used_table_map; } virtual void keep_array() {} // to prevent drop fixed flag (no need parent cleanup call) @@ -2531,9 +2531,16 @@ class Item_cache_str: public Item_cache { char buffer[STRING_BUFFER_USUAL_SIZE]; String *value, value_buff; + bool is_varbinary; + public: - Item_cache_str(): Item_cache(), value(0) { } - + Item_cache_str(const Item *item) : + Item_cache(), value(0), + is_varbinary(item->type() == FIELD_ITEM && + ((const Item_field *) item)->field->type() == + MYSQL_TYPE_VARCHAR && + !((const Item_field *) item)->field->has_charset()) + {} void store(Item *item); double val_real(); longlong val_int(); @@ -2541,6 +2548,7 @@ public: my_decimal *val_decimal(my_decimal *); enum Item_result result_type() const { return STRING_RESULT; } CHARSET_INFO *charset() const { return value->charset(); }; + int save_in_field(Field *field, bool no_conversions); }; class Item_cache_row: public Item_cache |