diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-01-29 15:10:47 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-01-29 15:10:47 +0100 |
commit | 0af4b6c6ee2b8a61823478c0a56ebdfa52cae3cc (patch) | |
tree | 7b24eb150b9cca718c88edaabbfc6c8bb16fd015 /sql/item.cc | |
parent | cf20de000bdff07a34a373079991d24837423896 (diff) | |
parent | 52fbe44fbbe60ecaba6453884ec1ad32755d7a04 (diff) | |
download | mariadb-git-0af4b6c6ee2b8a61823478c0a56ebdfa52cae3cc.tar.gz |
5.5 merge
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/item.cc b/sql/item.cc index 966b5392b13..96f61c08982 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5579,7 +5579,7 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs) /** Create a field to hold a string value from an item. - If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob @n + If too_big_for_varchar() create a blob @n If max_length > 0 create a varchar @n If max_length == 0 create a CHAR(0) @@ -5594,7 +5594,7 @@ Field *Item::make_string_field(TABLE *table) Note: the following check is repeated in subquery_types_allow_materialization(): */ - if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB) + if (too_big_for_varchar()) field= new Field_blob(max_length, maybe_null, name, collation.collation, TRUE); /* Item_type_holder holds the exact type, do not change it */ @@ -5699,7 +5699,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) DBUG_ASSERT(0); /* If something goes awfully wrong, it's better to get a string than die */ case MYSQL_TYPE_STRING: - if (fixed_length && max_length < CONVERT_IF_BIGGER_TO_BLOB) + if (fixed_length && !too_big_for_varchar()) { field= new Field_string(max_length, maybe_null, name, collation.collation); @@ -8851,9 +8851,10 @@ int Item_cache_temporal::save_in_field(Field *field, bool no_conversions) } -void Item_cache_temporal::store_packed(longlong val_arg) +void Item_cache_temporal::store_packed(longlong val_arg, Item *example) { /* An explicit values is given, save it. */ + store(example); value_cached= true; value= val_arg; null_value= false; @@ -9599,11 +9600,18 @@ table_map Item_ref::used_tables() const void Item_ref::update_used_tables() -{ +{ if (!get_depended_from()) - (*ref)->update_used_tables(); + (*ref)->update_used_tables(); + maybe_null|= (*ref)->maybe_null; } +void Item_direct_view_ref::update_used_tables() +{ + Item_ref::update_used_tables(); + if (view->table && view->table->maybe_null) + maybe_null= TRUE; +} table_map Item_direct_view_ref::used_tables() const { |