Commit d9eb8958 authored by ramil@mysql.com's avatar ramil@mysql.com

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/usr/home/ram/work/5.0.b11553
parents 0d716ef8 6f64f66d
...@@ -4779,27 +4779,48 @@ simple_expr: ...@@ -4779,27 +4779,48 @@ simple_expr:
$$= new Item_func_sp(Lex->current_context(), name); $$= new Item_func_sp(Lex->current_context(), name);
lex->safe_to_cache_query=0; lex->safe_to_cache_query=0;
} }
| IDENT_sys '(' udf_expr_list ')' | IDENT_sys '('
{ {
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
udf_func *udf; udf_func *udf= 0;
if (using_udf_functions &&
(udf= find_udf($1.str, $1.length)) &&
udf->type == UDFTYPE_AGGREGATE)
{
LEX *lex= Lex;
if (lex->current_select->inc_in_sum_expr())
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
}
$<udf>$= udf;
#endif
}
udf_expr_list ')'
{
#ifdef HAVE_DLOPEN
udf_func *udf= $<udf>3;
SELECT_LEX *sel= Select; SELECT_LEX *sel= Select;
if (using_udf_functions && (udf=find_udf($1.str, $1.length))) if (udf)
{ {
if (udf->type == UDFTYPE_AGGREGATE)
Select->in_sum_expr--;
switch (udf->returns) { switch (udf->returns) {
case STRING_RESULT: case STRING_RESULT:
if (udf->type == UDFTYPE_FUNCTION) if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_func_udf_str(udf, *$3); $$ = new Item_func_udf_str(udf, *$4);
else else
$$ = new Item_func_udf_str(udf); $$ = new Item_func_udf_str(udf);
} }
else else
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_sum_udf_str(udf, *$3); $$ = new Item_sum_udf_str(udf, *$4);
else else
$$ = new Item_sum_udf_str(udf); $$ = new Item_sum_udf_str(udf);
} }
...@@ -4807,15 +4828,15 @@ simple_expr: ...@@ -4807,15 +4828,15 @@ simple_expr:
case REAL_RESULT: case REAL_RESULT:
if (udf->type == UDFTYPE_FUNCTION) if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_func_udf_float(udf, *$3); $$ = new Item_func_udf_float(udf, *$4);
else else
$$ = new Item_func_udf_float(udf); $$ = new Item_func_udf_float(udf);
} }
else else
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_sum_udf_float(udf, *$3); $$ = new Item_sum_udf_float(udf, *$4);
else else
$$ = new Item_sum_udf_float(udf); $$ = new Item_sum_udf_float(udf);
} }
...@@ -4823,15 +4844,15 @@ simple_expr: ...@@ -4823,15 +4844,15 @@ simple_expr:
case INT_RESULT: case INT_RESULT:
if (udf->type == UDFTYPE_FUNCTION) if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_func_udf_int(udf, *$3); $$ = new Item_func_udf_int(udf, *$4);
else else
$$ = new Item_func_udf_int(udf); $$ = new Item_func_udf_int(udf);
} }
else else
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_sum_udf_int(udf, *$3); $$ = new Item_sum_udf_int(udf, *$4);
else else
$$ = new Item_sum_udf_int(udf); $$ = new Item_sum_udf_int(udf);
} }
...@@ -4839,15 +4860,15 @@ simple_expr: ...@@ -4839,15 +4860,15 @@ simple_expr:
case DECIMAL_RESULT: case DECIMAL_RESULT:
if (udf->type == UDFTYPE_FUNCTION) if (udf->type == UDFTYPE_FUNCTION)
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_func_udf_decimal(udf, *$3); $$ = new Item_func_udf_decimal(udf, *$4);
else else
$$ = new Item_func_udf_decimal(udf); $$ = new Item_func_udf_decimal(udf);
} }
else else
{ {
if ($3 != NULL) if ($4 != NULL)
$$ = new Item_sum_udf_decimal(udf, *$3); $$ = new Item_sum_udf_decimal(udf, *$4);
else else
$$ = new Item_sum_udf_decimal(udf); $$ = new Item_sum_udf_decimal(udf);
} }
...@@ -4863,8 +4884,8 @@ simple_expr: ...@@ -4863,8 +4884,8 @@ simple_expr:
sp_name *name= sp_name_current_db_new(YYTHD, $1); sp_name *name= sp_name_current_db_new(YYTHD, $1);
sp_add_used_routine(lex, YYTHD, name, TYPE_ENUM_FUNCTION); sp_add_used_routine(lex, YYTHD, name, TYPE_ENUM_FUNCTION);
if ($3) if ($4)
$$= new Item_func_sp(Lex->current_context(), name, *$3); $$= new Item_func_sp(Lex->current_context(), name, *$4);
else else
$$= new Item_func_sp(Lex->current_context(), name); $$= new Item_func_sp(Lex->current_context(), name);
lex->safe_to_cache_query=0; lex->safe_to_cache_query=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment