diff options
author | unknown <monty@donna.mysql.com> | 2000-12-15 16:12:31 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-12-15 16:12:31 +0200 |
commit | 7322a906a860c9aa17ba3bf681f65b2d7f2497ee (patch) | |
tree | 218630fcd3a47db36372c12886c88d38e397f5c3 /sql/item_cmpfunc.cc | |
parent | e7fde22e1a2e8e1eb1ea122a6b5f97786453200a (diff) | |
download | mariadb-git-7322a906a860c9aa17ba3bf681f65b2d7f2497ee.tar.gz |
Fixed <=>
Added mysqltest for <=>
Removed use of TAB in output from mysql-test-run
Docs/manual.texi:
Changelog
client/mysqltest.c:
Added missing argument; Changed to use standard defines
mysql-test/README:
Cleaned up
mysql-test/mysql-test-run.sh:
Removed use of TAB in output
(We are now also depening on sed)
sql/item_cmpfunc.cc:
Fixed <=>
sql/item_cmpfunc.h:
Fixed <=>
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index a2686fd43d9..380ded8943e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -170,15 +170,44 @@ longlong Item_func_eq::val_int() /* Same as Item_func_eq, but NULL = NULL */ +void Item_func_equal::fix_length_and_dec() +{ + Item_bool_func2::fix_length_and_dec(); + result_type=item_cmp_type(args[0]->result_type(),args[1]->result_type()); + maybe_null=null_value=0; +} + longlong Item_func_equal::val_int() { - int value=(this->*cmp_func)(); - if (null_value) + switch (result_type) { + case STRING_RESULT: { - null_value=0; - return (args[0]->null_value && args[1]->null_value) ? 1 : 0; + String *res1,*res2; + res1=args[0]->val_str(&tmp_value1); + res2=args[1]->val_str(&tmp_value2); + if (!res1 || !res2) + return test(res1 == res2); + return (binary ? test(stringcmp(res1,res2) == 0) : + test(sortcmp(res1,res2) == 0)); + } + case REAL_RESULT: + { + double val1=args[0]->val(); + double val2=args[1]->val(); + if (args[0]->null_value || args[1]->null_value) + return test(args[0]->null_value && args[1]->null_value); + return test(val1 == val2); + } + case INT_RESULT: + { + longlong val1=args[0]->val_int(); + longlong val2=args[1]->val_int(); + if (args[0]->null_value || args[1]->null_value) + return test(args[0]->null_value && args[1]->null_value); + return test(val1 == val2); + } } - return value == 0; + return 0; // Impossible } |