Skip to content

Commit 9ccd5f1

Browse files
author
Sreeharsha Ramanavarapu
committed
Merge branch 'mysql-5.5' into mysql-5.6
2 parents c00b5ae + 718c787 commit 9ccd5f1

2 files changed

Lines changed: 26 additions & 15 deletions

File tree

sql/item.cc

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,14 +1179,31 @@ Item *Item_param::safe_charset_converter(const CHARSET_INFO *tocs)
11791179
{
11801180
if (const_item())
11811181
{
1182-
uint cnv_errors;
1183-
String *ostr= val_str(&cnvstr);
1184-
cnvitem->str_value.copy(ostr->ptr(), ostr->length(),
1185-
ostr->charset(), tocs, &cnv_errors);
1186-
if (cnv_errors)
1187-
return NULL;
1188-
cnvitem->str_value.mark_as_const();
1189-
cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen;
1182+
Item *cnvitem;
1183+
String tmp, cstr, *ostr= val_str(&tmp);
1184+
1185+
if (null_value)
1186+
{
1187+
cnvitem= new Item_null();
1188+
if (cnvitem == NULL)
1189+
return NULL;
1190+
1191+
cnvitem->collation.set(tocs);
1192+
}
1193+
else
1194+
{
1195+
uint conv_errors;
1196+
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs,
1197+
&conv_errors);
1198+
1199+
if (conv_errors || !(cnvitem= new Item_string(cstr.ptr(), cstr.length(),
1200+
cstr.charset(),
1201+
collation.derivation)))
1202+
return NULL;
1203+
1204+
cnvitem->str_value.copy();
1205+
cnvitem->str_value.mark_as_const();
1206+
}
11901207
return cnvitem;
11911208
}
11921209
return Item::safe_charset_converter(tocs);
@@ -3420,8 +3437,6 @@ Item_param::Item_param(uint pos_in_query_arg) :
34203437
value is set.
34213438
*/
34223439
maybe_null= 1;
3423-
cnvitem= new Item_string("", 0, &my_charset_bin, DERIVATION_COERCIBLE);
3424-
cnvstr.set(cnvbuf, sizeof(cnvbuf), &my_charset_bin);
34253440
}
34263441

34273442

sql/item.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef ITEM_INCLUDED
22
#define ITEM_INCLUDED
33

4-
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
4+
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -2430,10 +2430,6 @@ class Item_null_result :public Item_null
24302430
class Item_param :public Item,
24312431
private Settable_routine_parameter
24322432
{
2433-
char cnvbuf[MAX_FIELD_WIDTH];
2434-
String cnvstr;
2435-
Item *cnvitem;
2436-
24372433
public:
24382434
enum enum_item_param_state
24392435
{

0 commit comments

Comments
 (0)