summaryrefslogtreecommitdiff
path: root/sql/item_buff.cc
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-06-07 03:12:12 -0700
committerunknown <igor@rurik.mysql.com>2005-06-07 03:12:12 -0700
commit571cf5db20cd9c939cc01e76c5eaf7749c0e9042 (patch)
tree9d782c926a29118ee6d92d46c1bddf0108c25223 /sql/item_buff.cc
parent9f1610638b91853af778670da39e8e2d0a1a89c6 (diff)
parent4da133cabf43b4c53f33f5d529b2b7d7b43af3d5 (diff)
downloadmariadb-git-571cf5db20cd9c939cc01e76c5eaf7749c0e9042.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-4.1
into rurik.mysql.com:/home/igor/dev/mysql-4.1-0
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 1559cfe958e..2324205eb65 100644
--- a/sql/item_buff.cc
+++ b/sql/item_buff.cc
@@ -23,13 +23,13 @@
** 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);
if (item->result_type() == STRING_RESULT)
- return new Item_str_buff((Item_field *) item);
+ return new Item_str_buff(thd, (Item_field *) item);
if (item->result_type() == INT_RESULT)
return new Item_int_buff((Item_field *) item);
return new Item_real_buff(item);
@@ -42,12 +42,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))