mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Made FUNCTIONs work in insert and select queries, as well as nested function invocations.
Had to add a cahing mechanism which is in parts an ugly kludge, but it will be reworked once the real SP caching is implemented. mysql-test/r/sp.result: New function tests. mysql-test/t/sp.test: New function tests. sql/sp.cc: Big rehack of mysql.proc table usage strategy and adding a function cache mechanism, since we need to read used functions from the db before doing anything else when executing a query. (This cache is temporary and will probably be replaced by the real thing later.) sql/sp.h: New (temporary) FUNCTION caching functions. sql/sp_head.cc: Fixed some bugs in the function and procedure execution. Disabled some data collections that's not used at the moment. sql/sp_head.h: Fixed some bugs in the function and procedure execution. Disabled some data collections that's not used at the moment. sql/sql_class.h: Added SP function cache list to thd. sql/sql_lex.cc: Added SP function name list to lex. sql/sql_lex.h: Added SP function name list to lex. sql/sql_parse.cc: Read used FUNCTIONs from db and cache them in thd before doing anything else in a query execution. (This is necessary since we can't open mysql.proc during query execution.) sql/sql_yacc.yy: Collect used function names in lex.
This commit is contained in:
@@ -1583,6 +1583,18 @@ mysql_execute_command(THD *thd)
|
||||
SELECT_LEX_UNIT *unit= &lex->unit;
|
||||
DBUG_ENTER("mysql_execute_command");
|
||||
|
||||
/*
|
||||
Clear the SP function cache before each statement (QQ this is a temporary
|
||||
solution; caching will be rehacked later), and the new ones.
|
||||
*/
|
||||
sp_clear_function_cache(thd);
|
||||
if (lex->sql_command != SQLCOM_CREATE_PROCEDURE &&
|
||||
lex->sql_command != SQLCOM_CREATE_FUNCTION)
|
||||
{
|
||||
if (sp_cache_functions(thd, lex))
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
Reset warning count for each query that uses tables
|
||||
A better approach would be to reset this for any commands
|
||||
|
||||
Reference in New Issue
Block a user