diff options
author | monty@mysql.com <> | 2004-03-25 22:11:22 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2004-03-25 22:11:22 +0200 |
commit | 1448199bd75009ac9b4aa42c9d4fb8d827a4cb12 (patch) | |
tree | 36abf1d40f08cd21cd81f6d5966b89ab4e995ac6 /sql/item.cc | |
parent | eb91f7b478938969b4a182aed5d624c2f8fce38a (diff) | |
download | mariadb-git-1448199bd75009ac9b4aa42c9d4fb8d827a4cb12.tar.gz |
Cleanups & safety fixes
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc index e889bbf1930..36b263f62cf 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -820,6 +820,16 @@ String *Item_copy_string::val_str(String *str) return &str_value; } + +int Item_copy_string::save_in_field(Field *field, bool no_conversions) +{ + if (null_value) + return set_field_to_null(field); + field->set_notnull(); + return field->store(str_value.ptr(),str_value.length(), + collation.collation); +} + /* Functions to convert item to field (for send_fields) */ @@ -1284,8 +1294,8 @@ int Item::save_in_field(Field *field, bool no_conversions) String *result; CHARSET_INFO *cs= collation.collation; char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns - String loc_value(buff, sizeof(buff), cs); - result=val_str(&loc_value); + str_value.set_quick(buff, sizeof(buff), cs); + result=val_str(&str_value); if (null_value) return set_field_to_null_with_conversions(field, no_conversions); field->set_notnull(); |