summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-10-22 20:52:47 +0300
committerunknown <bell@sanja.is.com.ua>2003-10-22 20:52:47 +0300
commit47f3a4fd4aa4ac7f2944c85aa20333fa0259ac77 (patch)
tree094f3d63a932eeaa346520cc5605255beab9debe /sql/item_cmpfunc.cc
parent9a4aa99769b29cb4084b3b16d2bfb7067d817d2c (diff)
parentb7aac7df29e716ab0bfd95e2c7349287912dcbf6 (diff)
downloadmariadb-git-47f3a4fd4aa4ac7f2944c85aa20333fa0259ac77.tar.gz
Merge
mysql-test/t/subselect.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/item_timefunc.h: Auto merged sql/mysql_priv.h: Auto merged sql/sql_derived.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/r/subselect.result: SCCS merged
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc62
1 files changed, 59 insertions, 3 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 4e6301d2626..d183c81b230 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -112,6 +112,14 @@ longlong Item_func_not_all::val_int()
return (!null_value && value == 0) ? 1 : 0;
}
+void Item_func_not_all::print(String *str)
+{
+ if (show)
+ Item_func::print(str);
+ else
+ args[0]->print(str);
+}
+
/*
Convert a constant expression or string to an integer.
This is done when comparing DATE's of different formats and
@@ -704,6 +712,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 +1117,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 +1544,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 +1913,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);