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.cc47
1 files changed, 27 insertions, 20 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7b46dd964c1..f35265f9135 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -794,9 +794,9 @@ my_decimal *Item_func_numhybrid::val_decimal(my_decimal *decimal_value)
void Item_func_signed::print(String *str)
{
- str->append("cast(", 5);
+ str->append(STRING_WITH_LEN("cast("));
args[0]->print(str);
- str->append(" as signed)", 11);
+ str->append(STRING_WITH_LEN(" as signed)"));
}
@@ -855,9 +855,9 @@ longlong Item_func_signed::val_int()
void Item_func_unsigned::print(String *str)
{
- str->append("cast(", 5);
+ str->append(STRING_WITH_LEN("cast("));
args[0]->print(str);
- str->append(" as unsigned)", 13);
+ str->append(STRING_WITH_LEN(" as unsigned)"));
}
@@ -927,9 +927,9 @@ my_decimal *Item_decimal_typecast::val_decimal(my_decimal *dec)
void Item_decimal_typecast::print(String *str)
{
- str->append("cast(", 5);
+ str->append(STRING_WITH_LEN("cast("));
args[0]->print(str);
- str->append(" as decimal)", 12);
+ str->append(STRING_WITH_LEN(" as decimal)"));
}
@@ -2234,7 +2234,7 @@ longlong Item_func_locate::val_int()
void Item_func_locate::print(String *str)
{
- str->append("locate(", 7);
+ str->append(STRING_WITH_LEN("locate("));
args[1]->print(str);
str->append(',');
args[0]->print(str);
@@ -3297,7 +3297,7 @@ longlong Item_func_benchmark::val_int()
void Item_func_benchmark::print(String *str)
{
- str->append("benchmark(", 10);
+ str->append(STRING_WITH_LEN("benchmark("));
char buffer[20];
// my_charset_bin is good enough for numbers
String st(buffer, sizeof(buffer), &my_charset_bin);
@@ -3811,9 +3811,9 @@ my_decimal *Item_func_set_user_var::val_decimal(my_decimal *val)
void Item_func_set_user_var::print(String *str)
{
- str->append("(@", 2);
+ str->append(STRING_WITH_LEN("(@"));
str->append(name.str, name.length);
- str->append(":=", 2);
+ str->append(STRING_WITH_LEN(":="));
args[0]->print(str);
str->append(')');
}
@@ -3821,9 +3821,9 @@ void Item_func_set_user_var::print(String *str)
void Item_func_set_user_var::print_as_stmt(String *str)
{
- str->append("set @", 5);
+ str->append(STRING_WITH_LEN("set @"));
str->append(name.str, name.length);
- str->append(":=", 2);
+ str->append(STRING_WITH_LEN(":="));
args[0]->print(str);
str->append(')');
}
@@ -4054,7 +4054,7 @@ enum Item_result Item_func_get_user_var::result_type() const
void Item_func_get_user_var::print(String *str)
{
- str->append("(@", 2);
+ str->append(STRING_WITH_LEN("(@"));
str->append(name.str,name.length);
str->append(')');
}
@@ -4479,15 +4479,15 @@ double Item_func_match::val_real()
void Item_func_match::print(String *str)
{
- str->append("(match ", 7);
+ str->append(STRING_WITH_LEN("(match "));
print_args(str, 1);
- str->append(" against (", 10);
+ str->append(STRING_WITH_LEN(" against ("));
args[0]->print(str);
if (flags & FT_BOOL)
- str->append(" in boolean mode", 16);
+ str->append(STRING_WITH_LEN(" in boolean mode"));
else if (flags & FT_EXPAND)
- str->append(" with query expansion", 21);
- str->append("))", 2);
+ str->append(STRING_WITH_LEN(" with query expansion"));
+ str->append(STRING_WITH_LEN("))"));
}
longlong Item_func_bit_xor::val_int()
@@ -4690,10 +4690,16 @@ Item_func_sp::sp_result_field(void) const
{
Field *field;
DBUG_ENTER("Item_func_sp::sp_result_field");
+ DBUG_PRINT("info", ("sp: %s, flags: %x, level: %lu",
+ (m_sp ? "YES" : "NO"),
+ (m_sp ? m_sp->m_flags : (uint)0),
+ (m_sp ? m_sp->m_recursion_level : (ulong)0)));
if (!m_sp)
{
- if (!(m_sp= sp_find_function(current_thd, m_name, TRUE)))
+ THD *thd= current_thd;
+ if (!(m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
+ &thd->sp_func_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
DBUG_RETURN(0);
@@ -4919,7 +4925,8 @@ Item_func_sp::find_and_check_access(THD *thd, ulong want_access,
bool res= TRUE;
*save= 0; // Safety if error
- if (! m_sp && ! (m_sp= sp_find_function(thd, m_name, TRUE)))
+ if (! m_sp && ! (m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
+ &thd->sp_func_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
goto error;