1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

WL#1447: Remove the UDF/function lookup in lex.

Moved the UDF and stored procedure lookup from sql_lex.cc to sql_yacc.yy.
This will improve performance (since we don't have to check for stored
functions in the lexer all the time), and make it possible to implement
db qualified SPs.


mysql-test/r/show_check.result:
  mysql.proc is not used in lex anymore (unless stored functions are really used).
mysql-test/r/status.result:
  mysql.proc is not used in lex anymore (unless stored functions are really used).
sql/sql_lex.cc:
  Moved the UDF and stored procedure lookup to sql_yacc.yy.
sql/sql_yacc.yy:
  Moved the UDF and stored procedure lookup from sql_lex.cc.
  As a result, both stored function and UDF function calls get the
  argument list parsed the same way, so the "AS ..." syntax is
  recognized for both, eventhough it has no meaning for stored
  function.
This commit is contained in:
unknown
2004-01-27 17:57:19 +01:00
parent 7e95a257e0
commit 9a6055e695
4 changed files with 77 additions and 105 deletions

View File

@ -166,38 +166,6 @@ static int find_keyword(LEX *lex, uint len, bool function)
lex->yylval->symbol.length=len;
return symbol->tok;
}
LEX_STRING ls;
ls.str = (char *)tok; ls.length= len;
if (function && sp_function_exists(current_thd, &ls)) // QQ temp fix
{
lex->safe_to_cache_query= 0;
lex->yylval->lex_str.str= lex->thd->strmake((char*)lex->tok_start, len);
lex->yylval->lex_str.length= len;
return SP_FUNC;
}
#ifdef HAVE_DLOPEN
udf_func *udf;
if (function && using_udf_functions && (udf=find_udf((char*) tok, len)))
{
lex->safe_to_cache_query=0;
lex->yylval->udf=udf;
switch (udf->returns) {
case STRING_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_CHAR_FUNC : UDA_CHAR_SUM;
case REAL_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_FLOAT_FUNC : UDA_FLOAT_SUM;
case INT_RESULT:
return (udf->type == UDFTYPE_FUNCTION) ? UDF_INT_FUNC : UDA_INT_SUM;
case ROW_RESULT:
default:
// This case should never be choosen
DBUG_ASSERT(0);
return 0;
}
}
#endif
return 0;
}