summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 64e4db80aa9..9bafe25e431 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -471,16 +471,14 @@ void Item_func::print_args(String *str, uint from, enum_query_type query_type)
void Item_func::print_op(String *str, enum_query_type query_type)
{
- str->append('(');
for (uint i=0 ; i < arg_count-1 ; i++)
{
- args[i]->print(str, query_type);
+ args[i]->print_parenthesised(str, query_type, precedence());
str->append(' ');
str->append(func_name());
str->append(' ');
}
- args[arg_count-1]->print(str, query_type);
- str->append(')');
+ args[arg_count-1]->print_parenthesised(str, query_type, precedence());
}
@@ -5245,11 +5243,10 @@ bool Item_func_set_user_var::is_null_result()
void Item_func_set_user_var::print(String *str, enum_query_type query_type)
{
- str->append(STRING_WITH_LEN("(@"));
+ str->append(STRING_WITH_LEN("@"));
str->append(name.str, name.length);
str->append(STRING_WITH_LEN(":="));
- args[0]->print(str, query_type);
- str->append(')');
+ args[0]->print_parenthesised(str, query_type, precedence());
}
@@ -5259,8 +5256,7 @@ void Item_func_set_user_var::print_as_stmt(String *str,
str->append(STRING_WITH_LEN("set @"));
str->append(name.str, name.length);
str->append(STRING_WITH_LEN(":="));
- args[0]->print(str, query_type);
- str->append(')');
+ args[0]->print_parenthesised(str, query_type, precedence());
}
bool Item_func_set_user_var::send(Protocol *protocol, String *str_arg)
@@ -5629,9 +5625,8 @@ bool Item_func_get_user_var::const_item() const
void Item_func_get_user_var::print(String *str, enum_query_type query_type)
{
- str->append(STRING_WITH_LEN("(@"));
+ str->append(STRING_WITH_LEN("@"));
append_identifier(current_thd, str, name.str, name.length);
- str->append(')');
}