diff options
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sql/item.h b/sql/item.h index 7f148a0a3e6..8e8199ecac8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -547,7 +547,7 @@ public: @see Query_arena::free_list */ Item *next; - uint32 max_length; + uint32 max_length; /* Maximum length, in bytes */ uint name_length; /* Length of name */ int8 marker; uint8 decimals; @@ -1221,6 +1221,18 @@ public: max_length= char_to_byte_length_safe(max_char_length_arg, collation.collation->mbmaxlen); } + void fix_char_length_ulonglong(ulonglong max_char_length_arg) + { + ulonglong max_result_length= max_char_length_arg * + collation.collation->mbmaxlen; + if (max_result_length >= MAX_BLOB_WIDTH) + { + max_length= MAX_BLOB_WIDTH; + maybe_null= 1; + } + else + max_length= max_result_length; + } void fix_length_and_charset_datetime(uint32 max_char_length_arg) { collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII); @@ -2825,6 +2837,7 @@ protected: cached_result_type= item->result_type(); unsigned_flag= item->unsigned_flag; fixed= item->fixed; + collation.set(item->collation); } public: @@ -3267,6 +3280,12 @@ public: bool basic_const_item() const { return test(example && example->basic_const_item());} virtual void clear() { null_value= TRUE; value_cached= FALSE; } + Item_result result_type() const + { + if (!example) + return INT_RESULT; + return Field::result_merge_type(example->field_type()); + } }; @@ -3336,7 +3355,9 @@ public: is_varbinary(item->type() == FIELD_ITEM && cached_field_type == MYSQL_TYPE_VARCHAR && !((const Item_field *) item)->field->has_charset()) - {} + { + collation.set(const_cast<DTCollation&>(item->collation)); + } double val_real(); longlong val_int(); String* val_str(String *); |