summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorkaa@polly.(none) <>2007-10-21 21:45:31 +0400
committerkaa@polly.(none) <>2007-10-21 21:45:31 +0400
commit349841118f6e209faedc09e59282d6751706a06f (patch)
treed9a0e8a70b282f3cc95eb07c97026d17a8afa4db /sql/item.cc
parent7f67efccef94449ef6c797583a2695b27a9b7376 (diff)
downloadmariadb-git-349841118f6e209faedc09e59282d6751706a06f.tar.gz
Bug #28550 "Potential bugs related to the return type of the CHAR function".
Since, as of MySQL 5.0.15, CHAR() arguments larger than 255 are converted into multiple result bytes, a single CHAR() argument can now take up to 4 bytes. This patch fixes Item_func_char::fix_length_and_dec() to take this into account. This patch also fixes a regression introduced by the patch for bug21513. As now we do not always have the 'name' member of Item set for Item_hex_string and Item_bin_string, an own print() method has been added to Item_hex_string so that it could correctly be printed by Item_func::print_args().
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 3177c0fb1e8..918e6371a2d 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4807,6 +4807,19 @@ warn:
}
+void Item_hex_string::print(String *str)
+{
+ char *end= (char*) str_value.ptr() + str_value.length(),
+ *ptr= end - min(str_value.length(), sizeof(longlong));
+ str->append("0x");
+ for (; ptr != end ; ptr++)
+ {
+ str->append(_dig_vec_lower[((uchar) *ptr) >> 4]);
+ str->append(_dig_vec_lower[((uchar) *ptr) & 0x0F]);
+ }
+}
+
+
bool Item_hex_string::eq(const Item *arg, bool binary_cmp) const
{
if (arg->basic_const_item() && arg->type() == type())