diff options
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 4e6301d2626..23b322ebd01 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -704,6 +704,18 @@ longlong Item_func_between::val_int() return 0; } + +void Item_func_between::print(String *str) +{ + str->append('('); + args[0]->print(str); + str->append(" between "); + args[1]->print(str); + str->append(" and "); + args[2]->print(str); + str->append(')'); +} + void Item_func_ifnull::fix_length_and_dec() { @@ -1097,7 +1109,27 @@ void Item_func_case::fix_length_and_dec() void Item_func_case::print(String *str) { - str->append("case "); // Not yet complete + str->append("(case "); + if (first_expr_num != -1) + { + args[first_expr_num]->print(str); + str->append(' '); + } + for (uint i=0 ; i < ncases ; i+=2) + { + str->append("when "); + args[i]->print(str); + str->append(" then "); + args[i+1]->print(str); + str->append(' '); + } + if (else_expr_num != -1) + { + str->append("else "); + args[else_expr_num]->print(str); + str->append(' '); + } + str->append("end)"); } /* @@ -1504,8 +1536,15 @@ void Item_func_in::fix_length_and_dec() void Item_func_in::print(String *str) { str->append('('); - Item_func::print(str); - str->append(')'); + args[0]->print(str); + str->append(" IN ("); + for (uint i=1 ; i < arg_count ; i++) + { + if (i > 1) + str->append(','); + args[i]->print(str); + } + str->append("))"); } @@ -1866,12 +1905,21 @@ void Item_is_not_null_test::update_used_tables() } } + longlong Item_func_isnotnull::val_int() { return args[0]->is_null() ? 0 : 1; } +void Item_func_isnotnull::print(String *str) +{ + str->append('('); + args[0]->print(str); + str->append(" is not null)"); +} + + longlong Item_func_like::val_int() { String* res = args[0]->val_str(&tmp_value1); |