Commit graph

20 commits

Author SHA1 Message Date
unknown
e22976638d Check for thd->killed in execution loop. (Makes more graceful behaviour in
certain interrupt cases.)
2003-03-28 17:02:31 +01:00
unknown
e9cc965afd Replaced a couple of strcasecmps. 2003-03-27 17:35:27 +01:00
unknown
2c9ef84cc3 Fixed save/restore of current database when calling a procedure. 2003-03-26 15:02:48 +01:00
unknown
fa870804d3 Post post merge fix. Made the broken ip test work again.
sql/sp_head.cc:
  Added some more DBUG output.
sql/sp_pcontext.cc:
  Post post merge fix.
2003-03-20 11:57:05 +01:00
unknown
f74b36a242 Improved error handling regarding SPs (with info like names etc in the output).
Disabled queries in FUNCTIONs.


include/mysqld_error.h:
  New error message for queries in FUNCTIONs.
mysql-test/t/sp.test:
  Moved error tests to sp-error.test.
sql/share/czech/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/danish/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/dutch/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/english/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/estonian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/french/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/german/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/greek/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/hungarian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/italian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/japanese/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/korean/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/norwegian-ny/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/norwegian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/polish/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/portuguese/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/romanian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/russian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/serbian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/slovak/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/spanish/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/swedish/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/share/ukrainian/errmsg.txt:
  New error message for queries in FUNCTIONs.
  Improved most of the SP error messages with added info.
sql/sp_head.cc:
  Added debug output to sp_instr_jump::execute(). (Moved from sp_head.h)
sql/sp_head.h:
  Moved sp_instr_jump::execute() to sp_head.cc.
sql/sql_lex.h:
  Added SQLCOM_CREATE_SPFUNCTION (for improved error handling).
sql/sql_parse.cc:
  Improved error handling regarding SPs (adding info like names etc in output).
sql/sql_yacc.yy:
  Improved error handling regarding SPs (adding info like names etc in output).
  Disabled queries in FUNCTIONS (since it can't work anyway).
2003-03-05 19:45:17 +01:00
unknown
8a9422bd2a 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.
2003-03-02 19:17:41 +01:00
unknown
1ff79b61a0 Closing tables during SP execution the proper way.
mysql-test/r/show_check.result:
  proc table now shows up in different places.
mysql-test/r/status.result:
  proc table now shows up in different places.
sql/sp.cc:
  Fixed closing of tables.
sql/sp_head.cc:
  Close tables after each sub statement.
sql/sql_class.cc:
  Removed closing of tables in various send_eof() methods again.
2003-02-28 15:07:14 +01:00
unknown
aecc6a21bd A small step forward. Fixed a few bugs and made string type functions work,
but still strange interferences between multiple function invocations...


mysql-test/r/sp.result:
  New FUNCTION tests.
mysql-test/t/sp.test:
  New FUNCTION tests.
sql/item_func.cc:
  Fixed field_type bug; now string functions work too.
  Removed unecessary function which was added in a state of confusion.
sql/item_func.h:
  Fixed field_type bug; now string functions work too.
  Removed unecessary function which was added in a state of confusion.
sql/sp_head.cc:
  Fixed string type bug, and set the right charset.
2003-02-27 19:08:52 +01:00
unknown
76b037dc42 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.
2003-02-26 19:22:29 +01:00
unknown
0521fb5444 Most of the groundwork for sprint task 729 (implement FUNCTIONs).
Expanded the mysql.proc table, reworked the find/create/drop functions
completely, added new functions for FUNCTIONs (lotta functions here :),
got rid of some unnecessary use of Item_strings while at it. Extended
the parser correspondingly, and fiddled around a bit to make SP FUNCTIONs
coexist with UDFs.
Can now CREATE and DROP FUNCTIONs. Invoking yet to come...


Docs/sp-implemented.txt:
  Updated with info about CASCADE/RESTICT and METHOD, and some answers to questions.
include/mysqld_error.h:
  New error message for misuse of RETURN.
mysql-test/install_test_db.sh:
  Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
mysql-test/r/sp.result:
  New test for creating and dropping FUNCTIONS.
mysql-test/t/sp.test:
  New test for creating and dropping FUNCTIONS.
scripts/mysql_install_db.sh:
  Added enum field to mysql.proc to distinguish between FUNCTION and PROCEDURE.
sql/lex.h:
  De-UDFed some symbol names, as they are now used for SPs as well.
  Added RETURN_SYM.
sql/share/czech/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/danish/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/dutch/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/english/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/estonian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/french/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/german/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/greek/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/hungarian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/italian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/japanese/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/korean/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/norwegian-ny/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/norwegian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/polish/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/portuguese/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/romanian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/russian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/serbian/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/slovak/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/spanish/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/swedish/errmsg.txt:
  New error message for misuse of RETURN.
sql/share/ukrainian/errmsg.txt:
  New error message for misuse of RETURN.
sql/sp.cc:
  Major rehack to accomodate FUNCTIONs, and to make it easier to add
  future in-memory cache of prepared SPs.
sql/sp.h:
  Major rehack to accomodate FUNCTIONs, and to make it easier to add
  future in-memory cache of prepared SPs.
sql/sp_head.cc:
  Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sp_head.h:
  Now creates FUNCTIONs too. (And got rid of some unnecessary Item_string use.)
sql/sql_lex.h:
  New stored FUNCTION commands.
sql/sql_parse.cc:
  Added FUNCTION support ("drop" merged with the old UDF code), and made some
  additional changes for better error handling (following the sp.cc rehacking).
sql/sql_yacc.yy:
  Some former UDF specific symbols renamed.
  Added CREATE FUNCTION parsing.
  DROP FUNCTION had to be partly merged with the old UDF code, because of the similar
  syntax.
  RETURN statement added, but still a no-op.
2003-02-21 17:37:05 +01:00
unknown
6cfaf04e4d Fixed some DBUGing, and optimized SET slightly.
sql/sp.cc:
  Added DBUG statements.
sql/sp_head.cc:
  Added DBUG statements.
sql/sql_parse.cc:
  Changed returns into DBUG_RETURNs in mysql_execute_command().
sql/sql_yacc.yy:
  Small optimization: Don't generate sp_instr_stmt instructions for empty
  SET_OPTIONs. (Which happened if there were only local variables in the SET
  statement.)
2003-02-12 16:17:03 +01:00
unknown
a3111ad09b Fixed crash bug when certain procedures are called from the top level.
sql/sp_head.cc:
  Fixed crash bug when certain procedures are called from the top level.
  Attempted to support global user vars as OUT/INOUT parameters too, but
  unfortunately we can't quite manage that yet.
2003-02-02 17:44:39 +01:00
unknown
79993565a9 Fixed some basic error handling for SP functions in mysql_execute_command().
include/mysqld_error.h:
  Added error codes for SPs
sql/mysql_priv.h:
  Changed return value of mysql_execute_command() from void to int; need to be able
  to detect if executions of substatements in SPs failed.
sql/share/czech/errmsg.txt:
  Added error messages for SPs.
sql/share/danish/errmsg.txt:
  Added error messages for SPs.
sql/share/dutch/errmsg.txt:
  Added error messages for SPs.
sql/share/english/errmsg.txt:
  Added error messages for SPs.
sql/share/estonian/errmsg.txt:
  Added error messages for SPs.
sql/share/french/errmsg.txt:
  Added error messages for SPs.
sql/share/german/errmsg.txt:
  Added error messages for SPs.
sql/share/greek/errmsg.txt:
  Added error messages for SPs.
sql/share/hungarian/errmsg.txt:
  Added error messages for SPs.
sql/share/italian/errmsg.txt:
  Added error messages for SPs.
sql/share/japanese/errmsg.txt:
  Added error messages for SPs.
sql/share/korean/errmsg.txt:
  Added error messages for SPs.
sql/share/norwegian-ny/errmsg.txt:
  Added error messages for SPs.
sql/share/norwegian/errmsg.txt:
  Added error messages for SPs.
sql/share/polish/errmsg.txt:
  Added error messages for SPs.
sql/share/portuguese/errmsg.txt:
  Added error messages for SPs.
sql/share/romanian/errmsg.txt:
  Added error messages for SPs.
sql/share/russian/errmsg.txt:
  Added error messages for SPs.
sql/share/serbian/errmsg.txt:
  Added error messages for SPs.
sql/share/slovak/errmsg.txt:
  Added error messages for SPs.
sql/share/spanish/errmsg.txt:
  Added error messages for SPs.
sql/share/swedish/errmsg.txt:
  Added error messages for SPs.
sql/share/ukrainian/errmsg.txt:
  Added error messages for SPs.
sql/sp_head.cc:
  Moved net.no_send_ok fiddling to sql_parse.cc.
  Check if mysql_execute_command() failed.
sql/sql_parse.cc:
  Changed return value of mysql_execute_command() from void to int; need to be able
  to detect if executions of substatements in SPs failed. Fixed all returns
  accordingly.
  Added error checks for SQLCOM_CREATE_PROCEDURE, CALL, ALTER_PROCEDURE, and
  DROP_PROCEDURE.
2003-01-15 15:39:36 +01:00
unknown
a3fe4223e8 Fixed some of the data collection during parsing.
sql/sp_head.cc:
  Renamed m_mylex into m_call_lex.
  Fixed some data collection.
sql/sp_head.h:
  Renamed m_mylex into m_call_lex.
  Put called procedures and used tables in class member vars (for now at least).
2002-12-19 18:43:25 +01:00
unknown
b12330b3d9 Added parsing of CASE (both generic and "simple").
sql/sp_head.cc:
  Init. the simple_case flag.
sql/sp_head.h:
  New flag for (simple)case parsing.
sql/sp_pcontext.cc:
  Removed push_gen_label method (not needed any more).
sql/sp_pcontext.h:
  Removed push_gen_label method (not needed any more).
  Fixed bug in pop().
sql/sql_yacc.yy:
  Added CASE parsing.
2002-12-17 10:01:52 +01:00
unknown
f6611aa0ab Fixed the broken backpatching implementation.
Implemented IF-THEN-ELSE.


sql/sp_head.cc:
  Reimplemented the broken backpatching, so it works for nested constructions and
  IF-THEN-ELSE too.
sql/sp_head.h:
  Reimplemented the broken backpatching, so it works for nested constructions and
  IF-THEN-ELSE too.
sql/sp_pcontext.cc:
  Return the value from push-methods, for convenience.
sql/sp_pcontext.h:
  Return the value from push-methods, for convenience.
sql/sql_yacc.yy:
  Implemented IF-THEN-ELSE.
  Corrected for the new backpatch method.
2002-12-16 15:40:44 +01:00
unknown
390b3e745c Added collection of called procedures in a list.
Fixed eval bug; now conditions with local variables work in WHILE et al.
Made mysql_install_db.sh create proc table.


scripts/mysql_install_db.sh:
  Added creation of the mysql.proc table.
  Note: The table format will change later, right now it's rather minimalistic,
  just so things can be tested (and the database can easily be recreated when
  I break it :-/ ).
sql/item.h:
  Removed unused method.
sql/sp_head.cc:
  Added collection of called procedures in a list.
  Fixed eval bug; now conditions with local variables work in WHILE et al.
2002-12-13 18:25:36 +01:00
unknown
b1b6227485 Moved create/find/drop functions to a separate files (sp.cc,sp.h).
Fixed backpatching of forward jumps.
Implemented LOOP, WHILE, REPEAT (temporarily known as SPREPEAT).

Known bug: Expression evaluation still not quite ok (e.g. "x > 0"),
which is why IF and CASE is not yet implemented.


sql/Makefile.am:
  Added new sp.h/sp.cc file.
sql/item.h:
  New deferred result_type() method in Item_splocal.
sql/lex.h:
  Temporary fix until REPEAT conflict is solved. Use SPREPEAT for now.
sql/sp_head.cc:
  Moved create/find/drop functions to sp.cc.
  Fixed the backpatch stuff.
  (Also removed some dead code and updated comments.)
sql/sp_head.h:
  Moved create/find/drop declarations to sp.h.
  Fixed the backpatch stuff.
sql/sp_pcontext.h:
  New method: last_label().
sql/sql_parse.cc:
  Include sp.h.
sql/sql_yacc.yy:
  Fixed backpatching of forward jumps.
  Implemented LOOP, WHILE, and REPEAT. (Note: SPREPEAT for now.)
2002-12-12 13:14:23 +01:00
unknown
37ce17e2cd Fixed bugs in the parameter evaluation and modified the execution engine
for better jump support. Some flow control support added too (but not
complete).


sql/lex.h:
  Added more keywords for embedded SQL.
sql/sp_head.cc:
  Fixed bugs in the parameter evaluation.
  Modified execute() for better jump support.
  Added jump instruction and backpatch support.
sql/sp_head.h:
  Fixed bugs in the parameter evaluation.
  Modified execute() for better jump support.
  Added jump instruction and backpatch support.
sql/sp_pcontext.cc:
  Added label support.
sql/sp_pcontext.h:
  Added label support.
sql/sql_yacc.yy:
  Outlined flow control constructs (parses, but nothing generated yet).
2002-12-11 14:24:29 +01:00
unknown
27de9ece81 Simplistic, experimental framework for Stored Procedures (SPs).
Implements creation and dropping of PROCEDUREs, IN, OUT, and INOUT parameters,
single-statement procedures, rudimentary multi-statement (begin-end) prodedures
(when the client can handle it), and local variables.
Missing most of the embedded SQL language, all attributes, FUNCTIONs, error handling,
reparses procedures at each call (no caching), etc, etc.
Certainly buggy too, but procedures can actually be created and called....


sql/Makefile.am:
  Added SP files.
sql/item.cc:
  Added this*_item() methods for Item_splocal. (SP local variable)
sql/item.h:
  Added this*_item() methods for SPs in Item, and the new Item_splocal
  class (SP local variable).
sql/lex.h:
  Added new symbols for SPs. (Note: SPSET is temporary and will go away later.)
sql/sql_class.cc:
  Initialize SP runtime context in THD.
sql/sql_class.h:
  Add SP runtime context to THD.
sql/sql_lex.cc:
  Init. buf pointer to beginning of command (needed by SPs).
  Also initialize SP head and parse time context.
sql/sql_lex.h:
  New SQLCOM_ tags for SPs, and added pointer to beginning of command pointer and
  SP head and parse-time context to LEX.
sql/sql_parse.cc:
  Added SQLCOM_CREATE_PROCEDURE, _CALL, _ALTER_PROCEDURE and _DROP_PROCEDURE cases.
  (Still rudimentary and lacking proper error handling...)
sql/sql_yacc.yy:
  Lots and lots of additions for SPs...
  (Still even more missing, and no error messages...)
2002-12-08 19:59:22 +01:00