diff options
author | timour@mysql.com <> | 2004-11-25 11:37:28 +0200 |
---|---|---|
committer | timour@mysql.com <> | 2004-11-25 11:37:28 +0200 |
commit | 38ab93c6befaca29e2fc36f0f24ce2d1e464550b (patch) | |
tree | 29ad0385fdb639f58ab052e5bb498f9429a374d9 /sql/item_strfunc.cc | |
parent | 5eae363c329978a8d87cadc76a1a4967f38a7d70 (diff) | |
parent | cf722bc3f5040d447f657477485e362b967d1f3e (diff) | |
download | mariadb-git-38ab93c6befaca29e2fc36f0f24ce2d1e464550b.tar.gz |
Merge for BUG#3759 which was missing from the main tree for some reason.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 5d017b3a27a..53a9d3fe219 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1135,7 +1135,7 @@ String *Item_func_ltrim::val_str(String *str) { const char *r_ptr=remove_str->ptr(); end-=remove_length; - while (ptr < end && !memcmp(ptr,r_ptr,remove_length)) + while (ptr <= end && !memcmp(ptr, r_ptr, remove_length)) ptr+=remove_length; end+=remove_length; } @@ -1206,8 +1206,8 @@ String *Item_func_rtrim::val_str(String *str) else #endif /* USE_MB */ { - while (ptr + remove_length < end && - !memcmp(end-remove_length,r_ptr,remove_length)) + while (ptr + remove_length <= end && + !memcmp(end-remove_length, r_ptr, remove_length)) end-=remove_length; } } @@ -2142,9 +2142,12 @@ String* Item_func_inet_ntoa::val_str(String* str) This function is very useful when you want to generate SQL statements - RETURN VALUES + NOTE + QUOTE(NULL) returns the string 'NULL' (4 letters, without quotes). + + RETURN VALUES str Quoted string - NULL Argument to QUOTE() was NULL or out of memory. + NULL Out of memory. */ #define get_esc_bit(mask, num) (1 & (*((mask) + ((num) >> 3))) >> ((num) & 7)) @@ -2168,7 +2171,12 @@ String *Item_func_quote::val_str(String *str) String *arg= args[0]->val_str(str); uint arg_length, new_length; if (!arg) // Null argument - goto null; + { + str->copy("NULL", 4); // Return the string 'NULL' + null_value= 0; + return str; + } + arg_length= arg->length(); new_length= arg_length+2; /* for beginning and ending ' signs */ |