From 76b037dc4288fada1b64efbef422cb8b4bd0d5b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Feb 2003 19:22:29 +0100 Subject: Made stored FUNCTION invokation work almost always. Still buggy and unstable, and various known problems, but good enough for a checkpoint commit. mysql-test/r/sp.result: New tests for invoking simple FUNCTIONs. mysql-test/t/sp.test: New tests for invoking simple FUNCTIONs. sql/item_func.cc: New Item_func_sp for stored FUNCTIONs. sql/item_func.h: New Item_func_sp for stored FUNCTIONs. sql/sp.cc: Close mysql.proc table earlier so recursive find_function calls work. Added temporary sp_function_exists() function for checking without parsing. sql/sp.h: Added temporary sp_function_exists() function for checking without parsing. sql/sp_head.cc: New code for executing a FUNCTION. (And reworked some of the old code in the process.) sql/sp_head.h: New code for executing a FUNCTION. sql/sp_rcontext.h: Added result slot for FUNCTIONs. sql/sql_lex.cc: Added check for stored FUNCTION, analogous to UDFs. sql/sql_parse.cc: sp_head::execute was renamed into execute_procedure. sql/sql_yacc.yy: Added parsing of stored FUNCTION invocation and code generation for RETURN statement. --- sql/sp_rcontext.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sql/sp_rcontext.h') diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index 5ffbb0266e6..78485fdd090 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -26,7 +26,7 @@ class sp_rcontext : public Sql_alloc public: sp_rcontext(uint size) - : m_count(0), m_size(size) + : m_count(0), m_size(size), m_result(NULL) { m_frame = (Item **)sql_alloc(size * sizeof(Item*)); m_outs = (int *)sql_alloc(size * sizeof(int)); @@ -70,12 +70,25 @@ class sp_rcontext : public Sql_alloc return m_outs[idx]; } + inline void + set_result(Item *it) + { + m_result= it; + } + + inline Item * + get_result() + { + return m_result; + } + private: uint m_count; uint m_size; Item **m_frame; int *m_outs; + Item *m_result; // For FUNCTIONs }; // class sp_rcontext : public Sql_alloc -- cgit v1.2.1