summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-11-27 19:50:10 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-12 20:44:41 +0100
commit180065ebb0db78ea5c955b54c9f7997dbcba3121 (patch)
tree849adc822b510535367bdffa1153809091fb64df /sql/item_timefunc.cc
parent1db438c83386e0e58487056d6ea25a0f5e97f4d9 (diff)
downloadmariadb-git-180065ebb0db78ea5c955b54c9f7997dbcba3121.tar.gz
Item::print(): remove redundant parentheses
by introducing new Item::precedence() method and using it to decide whether parentheses are required
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index a9aaf5dd241..27ce83f3f2b 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2199,13 +2199,11 @@ static const char *interval_names[]=
void Item_date_add_interval::print(String *str, enum_query_type query_type)
{
- str->append('(');
- args[0]->print(str, query_type);
+ args[0]->print_parenthesised(str, query_type, ADDINTERVAL_PRECEDENCE);
str->append(date_sub_interval?" - interval ":" + interval ");
- args[1]->print(str, query_type);
+ args[1]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
str->append(' ');
str->append(interval_names[int_type]);
- str->append(')');
}
void Item_extract::print(String *str, enum_query_type query_type)