summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2006-09-13 16:06:59 +0400
committerunknown <kaa@polly.local>2006-09-13 16:06:59 +0400
commita5a9b980545c64c998295e649346de3afd544f73 (patch)
tree81fa1790787c1929f8f84c662007e725a71524c5 /sql/item_func.cc
parent9f80b604a339db6f66e28b2c6a6f847231739624 (diff)
parentb419501e0df3201cb9d188ffd56fe84c468b3d17 (diff)
downloadmariadb-git-a5a9b980545c64c998295e649346de3afd544f73.tar.gz
Merge polly.local:/tmp/20924/bug20294/my50-bug20294
into polly.local:/home/kaa/src/maint/m50-maint--07OGt sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/sql_class.h: Auto merged mysql-test/r/user_var.result: Manual merge mysql-test/t/user_var.test: Manual merge sql/item_func.cc: Manual merge sql/item_func.h: Manual merge
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc37
1 files changed, 10 insertions, 27 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4d9893e1bbd..18322bcf757 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2152,33 +2152,18 @@ longlong Item_func_min_max::val_int()
{
DBUG_ASSERT(fixed == 1);
longlong value=0;
- my_bool arg_unsigned_flag;
- my_bool cmp;
for (uint i=0; i < arg_count ; i++)
{
- longlong tmp= args[i]->val_int();
- if ((null_value= args[i]->null_value))
- break;
- arg_unsigned_flag= args[i]->unsigned_flag;
if (i == 0)
- {
- value= tmp;
- unsigned_flag= arg_unsigned_flag;
- }
+ value=args[i]->val_int();
else
{
- if (unsigned_flag == arg_unsigned_flag)
- cmp= tmp < value;
- else if (unsigned_flag)
- cmp= compare_int_signed_unsigned(tmp, value) < 0;
- else
- cmp= compare_int_unsigned_signed(tmp, value) < 0;
- if ((cmp ? cmp_sign : -cmp_sign) > 0)
- {
- value= tmp;
- unsigned_flag= arg_unsigned_flag;
- }
+ longlong tmp=args[i]->val_int();
+ if (!args[i]->null_value && (tmp < value ? cmp_sign : -cmp_sign) > 0)
+ value=tmp;
}
+ if ((null_value= args[i]->null_value))
+ break;
}
return value;
}
@@ -3437,7 +3422,6 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->length=0;
entry->update_query_id=0;
entry->collation.set(NULL, DERIVATION_IMPLICIT);
- entry->unsigned_flag= 0;
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -3581,7 +3565,6 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
entry->collation.set(cs, dv);
- entry->unsigned_flag= unsigned_arg;
}
entry->type=type;
return 0;
@@ -3814,13 +3797,13 @@ Item_func_set_user_var::update()
case REAL_RESULT:
{
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
- REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
+ REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
break;
}
case INT_RESULT:
{
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
- INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
+ INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
unsigned_flag);
break;
}
@@ -3828,12 +3811,12 @@ Item_func_set_user_var::update()
{
if (!save_result.vstr) // Null value
res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
- DERIVATION_IMPLICIT, 0);
+ DERIVATION_IMPLICIT);
else
res= update_hash((void*) save_result.vstr->ptr(),
save_result.vstr->length(), STRING_RESULT,
save_result.vstr->charset(),
- DERIVATION_IMPLICIT, 0);
+ DERIVATION_IMPLICIT);
break;
}
case DECIMAL_RESULT: