diff options
author | unknown <paul@frost.snake.net> | 2005-08-29 11:25:12 -0500 |
---|---|---|
committer | unknown <paul@frost.snake.net> | 2005-08-29 11:25:12 -0500 |
commit | d09c4f6e80814a447a136d811623f3f4de9ea235 (patch) | |
tree | c5f4850ce093b72c6e35288acd814f6f72a55592 /sql | |
parent | 4fca19b3ae0fe100d05f3efe01973a0f3d626f73 (diff) | |
parent | c61fa49cbf5187192c84c3198e5216fda1b2d57d (diff) | |
download | mariadb-git-d09c4f6e80814a447a136d811623f3f4de9ea235.tar.gz |
Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1
into frost.snake.net:/Volumes/frost2/MySQL/bk/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 26 | ||||
-rw-r--r-- | sql/item.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 2ae56d17b07..2d4f9138a51 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -284,6 +284,32 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs) } +Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs) +{ + if (const_item()) + { + Item_string *conv; + uint conv_errors; + char buf[MAX_FIELD_WIDTH]; + String tmp(buf, sizeof(buf), &my_charset_bin); + String cstr, *ostr= val_str(&tmp); + /* + As safe_charset_converter is not executed for + a parameter bound to NULL, ostr should never be 0. + */ + cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors); + if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(), + cstr.charset(), + collation.derivation))) + return NULL; + conv->str_value.copy(); + conv->str_value.shrink_to_length(); + return conv; + } + return NULL; +} + + bool Item_string::eq(const Item *item, bool binary_cmp) const { if (type() == item->type() && item->basic_const_item()) diff --git a/sql/item.h b/sql/item.h index 080b804c730..e683cda5786 100644 --- a/sql/item.h +++ b/sql/item.h @@ -618,6 +618,7 @@ public: basic_const_item returned TRUE. */ Item *new_item(); + Item *safe_charset_converter(CHARSET_INFO *tocs); /* Implement by-value equality evaluation if parameter value is set and is a basic constant (integer, real or string). |