summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2006-09-12 19:35:44 +0400
committerunknown <kaa@polly.local>2006-09-12 19:35:44 +0400
commit76f18d7ff0b76fd19495fae3b34c98ce33371a1c (patch)
tree87937eb913a46a5ab21071c8d4e2bd3cdf9bbe7f /sql/item_func.cc
parentb597aaf906b4bdda7fb7ccf34943fff4a077df58 (diff)
parentd31a3434650a9991bcc16478e65efd7d2ea23c76 (diff)
downloadmariadb-git-76f18d7ff0b76fd19495fae3b34c98ce33371a1c.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, 26 insertions, 11 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 579e7f88ee6..4d9893e1bbd 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2152,18 +2152,33 @@ 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=args[i]->val_int();
+ {
+ value= tmp;
+ unsigned_flag= arg_unsigned_flag;
+ }
else
{
- longlong tmp=args[i]->val_int();
- if (!args[i]->null_value && (tmp < value ? cmp_sign : -cmp_sign) > 0)
- value=tmp;
+ 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;
+ }
}
- if ((null_value= args[i]->null_value))
- break;
}
return value;
}
@@ -3799,7 +3814,7 @@ 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);
+ REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
break;
}
case INT_RESULT:
@@ -3813,23 +3828,23 @@ 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);
+ DERIVATION_IMPLICIT, 0);
else
res= update_hash((void*) save_result.vstr->ptr(),
save_result.vstr->length(), STRING_RESULT,
save_result.vstr->charset(),
- DERIVATION_IMPLICIT);
+ DERIVATION_IMPLICIT, 0);
break;
}
case DECIMAL_RESULT:
{
if (!save_result.vdec) // Null value
res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
- DERIVATION_IMPLICIT);
+ DERIVATION_IMPLICIT, 0);
else
res= update_hash((void*) save_result.vdec,
sizeof(my_decimal), DECIMAL_RESULT,
- &my_charset_bin, DERIVATION_IMPLICIT);
+ &my_charset_bin, DERIVATION_IMPLICIT, 0);
break;
}
case ROW_RESULT: