diff options
author | unknown <sergefp@mysql.com> | 2004-08-17 02:59:24 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2004-08-17 02:59:24 +0400 |
commit | 5a7dd14edf990e6b23312ad305a92d05874be04c (patch) | |
tree | c15d08efcfe7345961ad895b97c4a32a10069dda /sql/item_cmpfunc.cc | |
parent | b37a73611024d78de35145c5f6cb394a7c3f225c (diff) | |
download | mariadb-git-5a7dd14edf990e6b23312ad305a92d05874be04c.tar.gz |
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
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index e7531e17d34..45a1918de1c 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -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() { |