summaryrefslogtreecommitdiff
path: root/sql/item_buff.cc
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-06-07 03:07:42 -0700
committerunknown <igor@rurik.mysql.com>2005-06-07 03:07:42 -0700
commitecd32735e25aa1c19453c3b9fdd0f9938f9251ac (patch)
tree98d7636a0eb542a33f4d1eff8e7f2c33b1ecc368 /sql/item_buff.cc
parent7a6c62a107b961d2713cbd3ec56e11652920f45b (diff)
parent4da133cabf43b4c53f33f5d529b2b7d7b43af3d5 (diff)
downloadmariadb-git-ecd32735e25aa1c19453c3b9fdd0f9938f9251ac.tar.gz
Merge rurik.mysql.com:/home/igor/dev/mysql-4.1-0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0 mysql-test/r/group_by.result: Auto merged sql/item.h: Auto merged sql/item_buff.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/item_buff.cc')
-rw-r--r--sql/item_buff.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_buff.cc b/sql/item_buff.cc
index af17d377e31..9e0fc096304 100644
--- a/sql/item_buff.cc
+++ b/sql/item_buff.cc
@@ -23,14 +23,14 @@
** Create right type of item_buffer for an item
*/
-Item_buff *new_Item_buff(Item *item)
+Item_buff *new_Item_buff(THD *thd, Item *item)
{
if (item->type() == Item::FIELD_ITEM &&
!(((Item_field *) item)->field->flags & BLOB_FLAG))
return new Item_field_buff((Item_field *) item);
switch (item->result_type()) {
case STRING_RESULT:
- return new Item_str_buff((Item_field *) item);
+ return new Item_str_buff(thd, (Item_field *) item);
case INT_RESULT:
return new Item_int_buff((Item_field *) item);
case REAL_RESULT:
@@ -51,12 +51,17 @@ Item_buff::~Item_buff() {}
** Return true if values have changed
*/
+Item_str_buff::Item_str_buff(THD *thd, Item *arg)
+ :item(arg), value(min(arg->max_length, thd->variables. max_sort_length))
+{}
+
bool Item_str_buff::cmp(void)
{
String *res;
bool tmp;
res=item->val_str(&tmp_value);
+ res->length(min(res->length(), value.alloced_length()));
if (null_value != item->null_value)
{
if ((null_value= item->null_value))