summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-11-28 12:49:00 +0400
committerunknown <bar@mysql.com>2005-11-28 12:49:00 +0400
commit7db51b00fab66256fe8a989460c6976dd4385629 (patch)
treed800e710b25a52b22876cb061c0bc86027ab8aee /sql/item.cc
parent7453e2c21cc9491d68d82567b513bfea72d98872 (diff)
parent3f40093928fdad8bb1189e9b12665211a1306d67 (diff)
downloadmariadb-git-7db51b00fab66256fe8a989460c6976dd4385629.tar.gz
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/bar/mysql-5.0.param sql/item.cc: Auto merged sql/item.h: Auto merged
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc26
1 files changed, 10 insertions, 16 deletions
diff --git a/sql/item.cc b/sql/item.cc
index a091552aa34..68804ca9ac2 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -700,23 +700,15 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
{
if (const_item())
{
- Item_string *conv;
uint cnv_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, &cnv_errors);
- if (cnv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
- cstr.charset(),
- collation.derivation)))
- return NULL;
- conv->str_value.copy();
- conv->str_value.mark_as_const();
- return conv;
+ String *ostr= val_str(&cnvstr);
+ cnvitem->str_value.copy(ostr->ptr(), ostr->length(),
+ ostr->charset(), tocs, &cnv_errors);
+ if (cnv_errors)
+ return NULL;
+ cnvitem->str_value.mark_as_const();
+ cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen;
+ return cnvitem;
}
return NULL;
}
@@ -2104,6 +2096,8 @@ Item_param::Item_param(unsigned pos_in_query_arg) :
value is set.
*/
maybe_null= 1;
+ cnvitem= new Item_string("", 0, &my_charset_bin, DERIVATION_COERCIBLE);
+ cnvstr.set(cnvbuf, sizeof(cnvbuf), &my_charset_bin);
}