1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for bug#4488: sign-aware equality check

mysql-test/r/range.result:
  Fix for bug#4488: more tests
mysql-test/t/range.test:
  Fix for bug#4488: more tests
This commit is contained in:
unknown
2004-08-17 02:59:24 +04:00
parent b37a736110
commit 5a7dd14edf
4 changed files with 30 additions and 0 deletions

View File

@ -325,6 +325,11 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
else if ((*b)->unsigned_flag)
func= &Arg_comparator::compare_int_signed_unsigned;
}
else if (func== &Arg_comparator::compare_e_int)
{
if ((*a)->unsigned_flag ^ (*b)->unsigned_flag)
func= &Arg_comparator::compare_e_int_diff_signedness;
}
}
return 0;
}
@ -530,6 +535,17 @@ int Arg_comparator::compare_e_int()
return test(val1 == val2);
}
/*
Compare unsigned *a with signed *b or signed *a with unsigned *b.
*/
int Arg_comparator::compare_e_int_diff_signedness()
{
longlong val1= (*a)->val_int();
longlong val2= (*b)->val_int();
if ((*a)->null_value || (*b)->null_value)
return test((*a)->null_value && (*b)->null_value);
return (val1 >= 0) && test(val1 == val2);
}
int Arg_comparator::compare_row()
{