mariadb/sql/sp_head.h

899 lines
18 KiB
C
Raw Normal View History

/* -*- C++ -*- */
/* Copyright (C) 2002 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _SP_HEAD_H_
#define _SP_HEAD_H_
#ifdef __GNUC__
#pragma interface /* gcc class implementation */
#endif
#include <stddef.h>
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
// Values for the type enum. This reflects the order of the enum declaration
// in the CREATE TABLE command.
#define TYPE_ENUM_FUNCTION 1
#define TYPE_ENUM_PROCEDURE 2
WL#1218 "Triggers". Some very preliminary version of patch. Mostly needed for Monty for him getting notion what needed for triggers from new .FRM format. Things to be done: - Right placement of trigger's invocations - Right handling of errors in triggers (including transaction rollback) - Support for priviliges - Right handling of DROP/RENAME table (hope that it will be handled automatically with merging of .TRG into .FRM file) - Saving/restoring some information critical for trigger creation and replication with their definitions (e.g. sql_mode, creator, ...) - Replication Already has some known bugs so probably not for general review. include/mysqld_error.h: Added trigger related error codes. sql/Makefile.am: Added sql_trigger.* files to list of sources from which mysqld is built. sql/item.cc: Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item.h: Added enums for describing trigger properties. (Here because of dependencies). Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item_func.cc: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. Added comment clarifying why we don't need set no_send_ok when calling stored functions. sql/item_func.h: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. sql/lex.h: Symbols used in statements defining triggers were added. sql/mysql_priv.h: Exported some functions needed for triggers implementation. sql/parse_file.cc: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/parse_file.h: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/share/czech/errmsg.txt: Added trigger related error messages. sql/share/danish/errmsg.txt: Added trigger related error messages. sql/share/dutch/errmsg.txt: Added trigger related error messages. sql/share/english/errmsg.txt: Added trigger related error messages. sql/share/estonian/errmsg.txt: Added trigger related error messages. sql/share/french/errmsg.txt: Added trigger related error messages. sql/share/german/errmsg.txt: Added trigger related error messages. sql/share/greek/errmsg.txt: Added trigger related error messages. sql/share/hungarian/errmsg.txt: Added trigger related error messages. sql/share/italian/errmsg.txt: Added trigger related error messages. sql/share/japanese/errmsg.txt: Added trigger related error messages. sql/share/korean/errmsg.txt: Added trigger related error messages. sql/share/norwegian-ny/errmsg.txt: Added trigger related error messages. sql/share/norwegian/errmsg.txt: Added trigger related error messages. sql/share/polish/errmsg.txt: Added trigger related error messages. sql/share/portuguese/errmsg.txt: Added trigger related error messages. sql/share/romanian/errmsg.txt: Added trigger related error messages. sql/share/russian/errmsg.txt: Added trigger related error messages. sql/share/serbian/errmsg.txt: Added trigger related error messages. sql/share/slovak/errmsg.txt: Added trigger related error messages. sql/share/spanish/errmsg.txt: Added trigger related error messages. sql/share/swedish/errmsg.txt: Added trigger related error messages. sql/share/ukrainian/errmsg.txt: Added trigger related error messages. sql/sp_head.cc: sp_head::init_strings(): added support for triggers (we don't have most of strings for them) sp_head::execute_function(): triggers don't require RETURN sp_head::reset_lex(): added propagation of trigger properties to LEX used for parsing of statements composing trigger body. Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sp_head.h: Added new type of sp_head object - TYPE_ENUM_TRIGGER Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sql_base.cc: Now freeing memory occupied by trigger related structures when closing tables. open_unireg_entry(): added loading of triggers for table. find_field_in_real_table() is now public since it required by Item_trigger_field in item.cc sql/sql_delete.cc: Added triggers invocation for DELETE (should be fixed for sure :)) sql/sql_insert.cc: Added triggers invocation for INSERT (should be fixed for sure :)) sql/sql_lex.cc: Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added initialization of LEX->trg_table to lex_start(). (When triggers are parsed during opening of table it points to table object.) sql/sql_lex.h: Added trigger related commands. Added st_trg_chistics structure describing properties of trigger being created (as struct and as LEX member). Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added LEX::trg_table which points to table being opened when we are parsing trigger definition while opening table. sql/sql_parse.cc: Added support for CREATE/DROP TRIGGER commands. sql/sql_table.cc: Cleanup. close_cached_table() always returns 0 and its result is not analyzed in most places so chenged its return type to void. sql/sql_update.cc: Added triggers invocation for UPDATE (should be fixed for sure :)) sql/sql_yacc.yy: Added support for CREATE/DROP TRIGGER statements. Added support for OLD/NEW row identifiers in trigger. Made assignment to user variables not to break execution of stored function or trigger. sql/table.h: Added TABLE::triggers member representing triggers for this table.
2004-09-07 14:29:46 +02:00
#define TYPE_ENUM_TRIGGER 3
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
Item_result
sp_map_result_type(enum enum_field_types type);
bool
sp_multi_results_command(enum enum_sql_command cmd);
struct sp_label;
class sp_instr;
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
struct sp_cond_type;
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
struct sp_pvar;
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
class sp_name : public Sql_alloc
{
public:
LEX_STRING m_db;
LEX_STRING m_name;
LEX_STRING m_qname;
sp_name(LEX_STRING name)
: m_name(name)
{
m_db.str= m_qname.str= 0;
m_db.length= m_qname.length= 0;
}
sp_name(LEX_STRING db, LEX_STRING name)
: m_db(db), m_name(name)
{
m_qname.str= 0;
m_qname.length= 0;
}
// Init. the qualified name from the db and name.
void init_qname(THD *thd); // thd for memroot allocation
~sp_name()
{}
};
WL#1366: Use the schema (db) associated with an SP. Phase 2: Make SPs belong to a DB, and use qualified names. As a side effect, using USE in an SP is no longer allowed. (It just doesn't work otherwise.) include/mysqld_error.h: New error code (USE is no longer allowed in a stored procedure). include/sql_state.h: New error state (USE is no longer allowed in a stored procedure). mysql-test/r/sp-error.result: Updated result for test of USE in SP (not allowed now). mysql-test/r/sp-security.result: Updated test results for new db column and qualified procedured names. mysql-test/r/sp.result: Updated results for USE in SP (as it's no longer allowed), and for new db column in status result. mysql-test/t/sp-error.test: Moved test of USE in SP from sp.test (as it's no longer allowed). mysql-test/t/sp-security.test: Ajusted tests for new db column and qualified procedured names. mysql-test/t/sp.test: Moved test of USE in SP to sp-error.test (as it's no longer allowed). Adjusted tests for new db column in status result. sql/mysql_priv.h: mysql_change_db() now has optional arguments for use by SP with qualified names. sql/share/czech/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/danish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/dutch/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/english/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/estonian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/french/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/german/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/greek/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/hungarian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/italian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/japanese/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/korean/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/norwegian-ny/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/norwegian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/polish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/portuguese/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/romanian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/russian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/serbian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/slovak/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/spanish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/swedish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/ukrainian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/sp.cc: SPs are now "belong" to a DB and may have qualified names. New functions for changing DB ("use") when parsing and invoking SPs. sql/sp.h: New functions for changing DB ("use") when parsing and invoking SPs. sql/sp_cache.cc: Use the qualified name in the SP cache. sql/sp_head.cc: New function for allocating a qualified SP name (used in sql_yacc.yy). Change DB when executing an SP (if needed). Moved thd_mem_root swap functions from sp_head.h. sql/sp_head.h: New function for allocating a qualified SP name (used in sql_yacc.yy). Moved thd_mem_root swap functions to sp_head.cc. sql/sql_db.cc: mysql_change_db() now has optional arguments for use by SP with qualified names (for use when reading an SP from database and executing it); also allow "unusing" a database, i.e. setting thd->thd to "". sql/sql_yacc.yy: Initialize qualfied SP names correctly. USE is no longer allowed in an SP.
2004-03-11 17:18:59 +01:00
sp_name *
sp_name_current_db_new(THD *thd, LEX_STRING name);
PS and SP made compatible in mechanism used for preparing query for rexecutions (Bug #2266) mysql-test/r/sp.result: test suite for Bug #2266 mysql-test/t/sp.test: test suite for Bug #2266 sql/item_subselect.cc: made ancestor for Statement (Item_arena) sql/item_subselect.h: made ancestor for Statement (Item_arena) sql/item_sum.cc: made ancestor for Statement (Item_arena) sql/item_sum.h: made ancestor for Statement (Item_arena) sql/mysql_priv.h: reset_stmt_for_execute use PS and SP sql/sp_head.cc: sp_head use Item_arena as ancestor to be PS cleunup compatible SP use PS storing/restoring/cleanup mechanisms cleanup() of SP Items added Items created in temporary memory pool during SP execution saved for normal freeing after SP execution sql/sp_head.h: sp_head use Item_arena sql/sql_base.cc: made ancestor for Statement (Item_arena) results of wild_setup made permanent setup_conds make natural joins expanding only once and store results in PS/SP memory sql/sql_class.cc: made ancestor for Statement (Item_arena) sql/sql_class.h: made ancestor for Statement (Item_arena) method to detect PS preparation added sql/sql_delete.cc: storing where for DELETE and mark first execution sql/sql_derived.cc: use method sql/sql_insert.cc: mark first execution for INSERT sql/sql_lex.cc: flags to correctly make transformations of query and storing them in memory of PS/SP made ancestor for Statement (Item_arena) sql/sql_lex.h: reved variable od SP ol saving data flags to correctly make transformations of query and storing them in memory of PS/SP sql/sql_parse.cc: cleunup unit for any query sql/sql_prepare.cc: made ancestor for Statement (Item_arena) storing where moved to preparation changed interface of reset_stmt_for_execute to use it is SP do not restore where/order by/group by before first execution (but tables and unit can be chenged without execution and should be prepared (subqueries executes on demand)) sql/sql_select.cc: storing where for SELECT/multi-DELETE/... and mark first execution sql/sql_union.cc: made ancestor for Statement (Item_arena) sql/sql_update.cc: storing where for UPDATE and mark first execution
2004-05-20 01:02:49 +02:00
class sp_head :private Item_arena
{
sp_head(const sp_head &); /* Prevent use of these */
void operator=(sp_head &);
public:
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
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
enum enum_field_types m_returns; // For FUNCTIONs only
CHARSET_INFO *m_returns_cs; // For FUNCTIONs only
Check that a FUNCTION contains RETURN and that we actually get a return value. include/mysqld_error.h: New error codes/messages for missing RETURNs in FUNCTIONs. mysql-test/r/sp-error.result: New error tests for missing RETURNs in FUNCTIONs. mysql-test/t/sp-error.test: New error tests for missing RETURNs in FUNCTIONs. sql/share/czech/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/danish/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/dutch/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/english/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/estonian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/french/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/german/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/greek/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/hungarian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/italian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/japanese/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/korean/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/norwegian-ny/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/norwegian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/polish/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/portuguese/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/romanian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/russian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/serbian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/slovak/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/spanish/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/swedish/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/share/ukrainian/errmsg.txt: New error codes/messages for missing RETURNs in FUNCTIONs. sql/sp_head.h: Check that a FUNCTION contains RETURN. sql/sql_parse.cc: Check that a FUNCTION contains RETURN. sql/sql_yacc.yy: Check that a FUNCTION contains RETURN.
2003-10-03 17:38:12 +02:00
my_bool m_has_return; // For FUNCTIONs only
my_bool m_simple_case; // TRUE if parsing simple case, FALSE otherwise
my_bool m_multi_results; // TRUE if a procedure with SELECT(s)
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
my_bool m_in_handler; // TRUE if parser in a handler body
uint m_old_cmq; // Old CLIENT_MULTI_QUERIES value
st_sp_chistics *m_chistics;
ulong m_sql_mode; // For SHOW CREATE
#if NOT_USED_NOW
// QQ We're not using this at the moment.
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
List<char *> m_calls; // Called procedures.
List<char *> m_tables; // Used tables.
#endif
LEX_STRING m_qname; // db.name
LEX_STRING m_db;
In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to make characteristics (and SHOW) work right, we had to separate the old definition blob in the mysql.proc table into separate fields for parameters, return type, and body, and handle the characteristics (like SQL SECURITY) separately... and then reassemble the CREATE string for parsing, of course. This is rather ugly, mostly the parser bit. (Hopefully that will be better with the new parser.) Docs/sp-imp-spec.txt: Separated the definitions string of the procedure into different columns in the mysql.proc schema. mysql-test/r/sp.result: New characteristics tests. mysql-test/t/sp.test: New characteristics tests. scripts/mysql_create_system_tables.sh: Separated the definitions string of the procedure into different columns in the mysql.proc schema. scripts/mysql_fix_privilege_tables.sql: Separated the definitions string of the procedure into different columns in the mysql.proc schema. sql/sp.cc: Separated the definitions string of the procedure into different columns. Rewrote much of the code related this (have a assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp.h: Changed prototypes. sql/sp_head.cc: Rewrote much of the code related to the new mysql.proc schema with separate definition fields (have to assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp_head.h: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. sql/sql_yacc.yy: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. This is ugly and messy; hopefully there's a more elegant way to do this when the new parser is installed.
2003-12-12 14:05:29 +01:00
LEX_STRING m_name;
LEX_STRING m_params;
LEX_STRING m_retstr; // For FUNCTIONs only
LEX_STRING m_body;
LEX_STRING m_defstr;
WL#1365: Implement definer's rights execution of stored procedures. (Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo.
2003-12-13 16:40:52 +01:00
LEX_STRING m_definer_user;
LEX_STRING m_definer_host;
In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to make characteristics (and SHOW) work right, we had to separate the old definition blob in the mysql.proc table into separate fields for parameters, return type, and body, and handle the characteristics (like SQL SECURITY) separately... and then reassemble the CREATE string for parsing, of course. This is rather ugly, mostly the parser bit. (Hopefully that will be better with the new parser.) Docs/sp-imp-spec.txt: Separated the definitions string of the procedure into different columns in the mysql.proc schema. mysql-test/r/sp.result: New characteristics tests. mysql-test/t/sp.test: New characteristics tests. scripts/mysql_create_system_tables.sh: Separated the definitions string of the procedure into different columns in the mysql.proc schema. scripts/mysql_fix_privilege_tables.sql: Separated the definitions string of the procedure into different columns in the mysql.proc schema. sql/sp.cc: Separated the definitions string of the procedure into different columns. Rewrote much of the code related this (have a assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp.h: Changed prototypes. sql/sp_head.cc: Rewrote much of the code related to the new mysql.proc schema with separate definition fields (have to assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp_head.h: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. sql/sql_yacc.yy: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. This is ugly and messy; hopefully there's a more elegant way to do this when the new parser is installed.
2003-12-12 14:05:29 +01:00
longlong m_created;
longlong m_modified;
// Pointers set during parsing
uchar *m_param_begin, *m_param_end, *m_returns_begin, *m_returns_end,
*m_body_begin;
static void *
operator new(size_t size);
static void
operator delete(void *ptr, size_t size);
sp_head();
// Initialize after we have reset mem_root
void
In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to make characteristics (and SHOW) work right, we had to separate the old definition blob in the mysql.proc table into separate fields for parameters, return type, and body, and handle the characteristics (like SQL SECURITY) separately... and then reassemble the CREATE string for parsing, of course. This is rather ugly, mostly the parser bit. (Hopefully that will be better with the new parser.) Docs/sp-imp-spec.txt: Separated the definitions string of the procedure into different columns in the mysql.proc schema. mysql-test/r/sp.result: New characteristics tests. mysql-test/t/sp.test: New characteristics tests. scripts/mysql_create_system_tables.sh: Separated the definitions string of the procedure into different columns in the mysql.proc schema. scripts/mysql_fix_privilege_tables.sql: Separated the definitions string of the procedure into different columns in the mysql.proc schema. sql/sp.cc: Separated the definitions string of the procedure into different columns. Rewrote much of the code related this (have a assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp.h: Changed prototypes. sql/sp_head.cc: Rewrote much of the code related to the new mysql.proc schema with separate definition fields (have to assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp_head.h: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. sql/sql_yacc.yy: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. This is ugly and messy; hopefully there's a more elegant way to do this when the new parser is installed.
2003-12-12 14:05:29 +01:00
init(LEX *lex);
// Initialize strings after parsing header
void
init_strings(THD *thd, LEX *lex, sp_name *name);
WL#1241: SHOW PROCEDURE/FUNCTION WL#1263: Support for the attributes COMMENT and SUID in CREATE/ALTER PROCEDURE/FUNCTION include/mysqld_error.h: Error code for 'alter procedure' mysql-test/r/sp-error.result: Test for WL#1241&WL#1263 mysql-test/r/sp.result: Test for WL#1241&WL#1263 mysql-test/t/sp-error.test: Test for WL#1241&WL#1263 mysql-test/t/sp.test: Test for WL#1241&WL#1263 sql/share/czech/errmsg.txt: Error massage for 'alter procedure' sql/share/danish/errmsg.txt: Error massage for 'alter procedure' sql/share/dutch/errmsg.txt: Error massage for 'alter procedure' sql/share/english/errmsg.txt: Error massage for 'alter procedure' sql/share/estonian/errmsg.txt: Error massage for 'alter procedure' sql/share/french/errmsg.txt: Error massage for 'alter procedure' sql/share/german/errmsg.txt: Error massage for 'alter procedure' sql/share/greek/errmsg.txt: Error massage for 'alter procedure' sql/share/hungarian/errmsg.txt: Error massage for 'alter procedure' sql/share/italian/errmsg.txt: Error massage for 'alter procedure' sql/share/japanese/errmsg.txt: Error massage for 'alter procedure' sql/share/korean/errmsg.txt: Error massage for 'alter procedure' sql/share/norwegian-ny/errmsg.txt: Error massage for 'alter procedure' sql/share/norwegian/errmsg.txt: Error massage for 'alter procedure' sql/share/polish/errmsg.txt: Error massage for 'alter procedure' sql/share/portuguese/errmsg.txt: Error massage for 'alter procedure' sql/share/romanian/errmsg.txt: Error massage for 'alter procedure' sql/share/russian/errmsg.txt: Error massage for 'alter procedure' sql/share/serbian/errmsg.txt: Error massage for 'alter procedure' sql/share/slovak/errmsg.txt: Error massage for 'alter procedure' sql/share/spanish/errmsg.txt: Error massage for 'alter procedure' sql/share/swedish/errmsg.txt: Error massage for 'alter procedure' sql/share/ukrainian/errmsg.txt: Error massage for 'alter procedure'
2003-11-17 18:21:36 +01:00
int
create(THD *thd);
virtual ~sp_head();
// Free memory
void
destroy();
int
execute_function(THD *thd, Item **args, uint argcount, Item **resp);
int
execute_procedure(THD *thd, List<Item> *args);
WL#1241: SHOW PROCEDURE/FUNCTION WL#1263: Support for the attributes COMMENT and SUID in CREATE/ALTER PROCEDURE/FUNCTION include/mysqld_error.h: Error code for 'alter procedure' mysql-test/r/sp-error.result: Test for WL#1241&WL#1263 mysql-test/r/sp.result: Test for WL#1241&WL#1263 mysql-test/t/sp-error.test: Test for WL#1241&WL#1263 mysql-test/t/sp.test: Test for WL#1241&WL#1263 sql/share/czech/errmsg.txt: Error massage for 'alter procedure' sql/share/danish/errmsg.txt: Error massage for 'alter procedure' sql/share/dutch/errmsg.txt: Error massage for 'alter procedure' sql/share/english/errmsg.txt: Error massage for 'alter procedure' sql/share/estonian/errmsg.txt: Error massage for 'alter procedure' sql/share/french/errmsg.txt: Error massage for 'alter procedure' sql/share/german/errmsg.txt: Error massage for 'alter procedure' sql/share/greek/errmsg.txt: Error massage for 'alter procedure' sql/share/hungarian/errmsg.txt: Error massage for 'alter procedure' sql/share/italian/errmsg.txt: Error massage for 'alter procedure' sql/share/japanese/errmsg.txt: Error massage for 'alter procedure' sql/share/korean/errmsg.txt: Error massage for 'alter procedure' sql/share/norwegian-ny/errmsg.txt: Error massage for 'alter procedure' sql/share/norwegian/errmsg.txt: Error massage for 'alter procedure' sql/share/polish/errmsg.txt: Error massage for 'alter procedure' sql/share/portuguese/errmsg.txt: Error massage for 'alter procedure' sql/share/romanian/errmsg.txt: Error massage for 'alter procedure' sql/share/russian/errmsg.txt: Error massage for 'alter procedure' sql/share/serbian/errmsg.txt: Error massage for 'alter procedure' sql/share/slovak/errmsg.txt: Error massage for 'alter procedure' sql/share/spanish/errmsg.txt: Error massage for 'alter procedure' sql/share/swedish/errmsg.txt: Error massage for 'alter procedure' sql/share/ukrainian/errmsg.txt: Error massage for 'alter procedure'
2003-11-17 18:21:36 +01:00
int
show_create_procedure(THD *thd);
int
show_create_function(THD *thd);
void
add_instr(sp_instr *instr);
inline uint
instructions()
{
return m_instr.elements;
}
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
inline sp_instr *
last_instruction()
{
sp_instr *i;
get_dynamic(&m_instr, (gptr)&i, m_instr.elements-1);
return i;
}
// Resets lex in 'thd' and keeps a copy of the old one.
void
reset_lex(THD *thd);
// Restores lex in 'thd' from our copy, but keeps some status from the
// one in 'thd', like ptr, tables, fields, etc.
void
restore_lex(THD *thd);
// Put the instruction on the backpatch list, associated with the label.
void
push_backpatch(sp_instr *, struct sp_label *);
// Update all instruction with this label in the backpatch list to
// the current position.
void
backpatch(struct sp_label *);
// Check that no unresolved references exist.
// If none found, 0 is returned, otherwise errors have been issued
// and -1 is returned.
// This is called by the parser at the end of a create procedure/function.
int
check_backpatch(THD *thd);
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
char *name(uint *lenp = 0) const
{
if (lenp)
*lenp= m_name.length;
return m_name.str;
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
}
In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to make characteristics (and SHOW) work right, we had to separate the old definition blob in the mysql.proc table into separate fields for parameters, return type, and body, and handle the characteristics (like SQL SECURITY) separately... and then reassemble the CREATE string for parsing, of course. This is rather ugly, mostly the parser bit. (Hopefully that will be better with the new parser.) Docs/sp-imp-spec.txt: Separated the definitions string of the procedure into different columns in the mysql.proc schema. mysql-test/r/sp.result: New characteristics tests. mysql-test/t/sp.test: New characteristics tests. scripts/mysql_create_system_tables.sh: Separated the definitions string of the procedure into different columns in the mysql.proc schema. scripts/mysql_fix_privilege_tables.sql: Separated the definitions string of the procedure into different columns in the mysql.proc schema. sql/sp.cc: Separated the definitions string of the procedure into different columns. Rewrote much of the code related this (have a assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp.h: Changed prototypes. sql/sp_head.cc: Rewrote much of the code related to the new mysql.proc schema with separate definition fields (have to assemble the definition string from its different parts now) and the way characteristics are now handled, in order to make ALTER actually work. sql/sp_head.h: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. sql/sql_yacc.yy: Separated the different parts of the definition strings: name, parameters, return type (for functions) and body. This is ugly and messy; hopefully there's a more elegant way to do this when the new parser is installed.
2003-12-12 14:05:29 +01:00
char *create_string(THD *thd, ulong *lenp);
inline Item_result result()
{
return sp_map_result_type(m_returns);
}
WL#1365: Implement definer's rights execution of stored procedures. (Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo.
2003-12-13 16:40:52 +01:00
void set_info(char *definer, uint definerlen,
longlong created, longlong modified,
st_sp_chistics *chistics, ulong sql_mode);
WL#1366: Use the schema (db) associated with an SP. Phase 2: Make SPs belong to a DB, and use qualified names. As a side effect, using USE in an SP is no longer allowed. (It just doesn't work otherwise.) include/mysqld_error.h: New error code (USE is no longer allowed in a stored procedure). include/sql_state.h: New error state (USE is no longer allowed in a stored procedure). mysql-test/r/sp-error.result: Updated result for test of USE in SP (not allowed now). mysql-test/r/sp-security.result: Updated test results for new db column and qualified procedured names. mysql-test/r/sp.result: Updated results for USE in SP (as it's no longer allowed), and for new db column in status result. mysql-test/t/sp-error.test: Moved test of USE in SP from sp.test (as it's no longer allowed). mysql-test/t/sp-security.test: Ajusted tests for new db column and qualified procedured names. mysql-test/t/sp.test: Moved test of USE in SP to sp-error.test (as it's no longer allowed). Adjusted tests for new db column in status result. sql/mysql_priv.h: mysql_change_db() now has optional arguments for use by SP with qualified names. sql/share/czech/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/danish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/dutch/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/english/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/estonian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/french/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/german/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/greek/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/hungarian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/italian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/japanese/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/korean/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/norwegian-ny/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/norwegian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/polish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/portuguese/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/romanian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/russian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/serbian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/slovak/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/spanish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/swedish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/ukrainian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/sp.cc: SPs are now "belong" to a DB and may have qualified names. New functions for changing DB ("use") when parsing and invoking SPs. sql/sp.h: New functions for changing DB ("use") when parsing and invoking SPs. sql/sp_cache.cc: Use the qualified name in the SP cache. sql/sp_head.cc: New function for allocating a qualified SP name (used in sql_yacc.yy). Change DB when executing an SP (if needed). Moved thd_mem_root swap functions from sp_head.h. sql/sp_head.h: New function for allocating a qualified SP name (used in sql_yacc.yy). Moved thd_mem_root swap functions to sp_head.cc. sql/sql_db.cc: mysql_change_db() now has optional arguments for use by SP with qualified names (for use when reading an SP from database and executing it); also allow "unusing" a database, i.e. setting thd->thd to "". sql/sql_yacc.yy: Initialize qualfied SP names correctly. USE is no longer allowed in an SP.
2004-03-11 17:18:59 +01:00
void reset_thd_mem_root(THD *thd);
void restore_thd_mem_root(THD *thd);
void optimize();
void opt_mark(uint ip);
inline sp_instr *
get_instr(uint i)
{
sp_instr *ip;
if (i < m_instr.elements)
get_dynamic(&m_instr, (gptr)&ip, i);
else
ip= NULL;
return ip;
}
2003-05-06 18:09:20 +02:00
private:
MEM_ROOT m_thd_root; // Temp. store for thd's mem_root
THD *m_thd; // Set if we have reset mem_root
WL#1366: Use the schema (db) associated with an SP. Phase 2: Make SPs belong to a DB, and use qualified names. As a side effect, using USE in an SP is no longer allowed. (It just doesn't work otherwise.) include/mysqld_error.h: New error code (USE is no longer allowed in a stored procedure). include/sql_state.h: New error state (USE is no longer allowed in a stored procedure). mysql-test/r/sp-error.result: Updated result for test of USE in SP (not allowed now). mysql-test/r/sp-security.result: Updated test results for new db column and qualified procedured names. mysql-test/r/sp.result: Updated results for USE in SP (as it's no longer allowed), and for new db column in status result. mysql-test/t/sp-error.test: Moved test of USE in SP from sp.test (as it's no longer allowed). mysql-test/t/sp-security.test: Ajusted tests for new db column and qualified procedured names. mysql-test/t/sp.test: Moved test of USE in SP to sp-error.test (as it's no longer allowed). Adjusted tests for new db column in status result. sql/mysql_priv.h: mysql_change_db() now has optional arguments for use by SP with qualified names. sql/share/czech/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/danish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/dutch/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/english/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/estonian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/french/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/german/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/greek/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/hungarian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/italian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/japanese/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/korean/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/norwegian-ny/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/norwegian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/polish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/portuguese/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/romanian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/russian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/serbian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/slovak/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/spanish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/swedish/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/share/ukrainian/errmsg.txt: New error message: USE is not allowed in a stored procedure. sql/sp.cc: SPs are now "belong" to a DB and may have qualified names. New functions for changing DB ("use") when parsing and invoking SPs. sql/sp.h: New functions for changing DB ("use") when parsing and invoking SPs. sql/sp_cache.cc: Use the qualified name in the SP cache. sql/sp_head.cc: New function for allocating a qualified SP name (used in sql_yacc.yy). Change DB when executing an SP (if needed). Moved thd_mem_root swap functions from sp_head.h. sql/sp_head.h: New function for allocating a qualified SP name (used in sql_yacc.yy). Moved thd_mem_root swap functions to sp_head.cc. sql/sql_db.cc: mysql_change_db() now has optional arguments for use by SP with qualified names (for use when reading an SP from database and executing it); also allow "unusing" a database, i.e. setting thd->thd to "". sql/sql_yacc.yy: Initialize qualfied SP names correctly. USE is no longer allowed in an SP.
2004-03-11 17:18:59 +01:00
char *m_thd_db; // Original thd->db pointer
sp_pcontext *m_pcont; // Parse context
List<LEX> m_lex; // Temp. store for the other lex
DYNAMIC_ARRAY m_instr; // The "instructions"
typedef struct
{
struct sp_label *lab;
sp_instr *instr;
} bp_t;
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
List<bp_t> m_backpatch; // Instructions needing backpatching
int
execute(THD *thd);
}; // class sp_head : public Sql_alloc
//
// "Instructions"...
//
class sp_instr : public Sql_alloc
{
sp_instr(const sp_instr &); /* Prevent use of these */
void operator=(sp_instr &);
public:
uint marked;
Item *free_list; // My Items
uint m_ip; // My index
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_pcontext *m_ctx; // My parse context
// Should give each a name or type code for debugging purposes?
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr(uint ip, sp_pcontext *ctx)
:Sql_alloc(), marked(0), free_list(0), m_ip(ip), m_ctx(ctx)
{}
virtual ~sp_instr()
{ free_items(free_list); }
// Execute this instrution. '*nextp' will be set to the index of the next
// instruction to execute. (For most instruction this will be the
// instruction following this one.)
// Returns 0 on success, non-zero if some error occured.
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual int execute(THD *thd, uint *nextp) = 0;
virtual void print(String *str) = 0;
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual void backpatch(uint dest, sp_pcontext *dst_ctx)
{}
virtual uint opt_mark(sp_head *sp)
{
marked= 1;
return m_ip+1;
}
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start)
{
return m_ip;
}
virtual void opt_move(uint dst, List<sp_instr> *ibp)
{
m_ip= dst;
}
}; // class sp_instr : public Sql_alloc
//
// Call out to some prepared SQL statement.
//
class sp_instr_stmt : public sp_instr
{
sp_instr_stmt(const sp_instr_stmt &); /* Prevent use of these */
void operator=(sp_instr_stmt &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_stmt(uint ip, sp_pcontext *ctx)
: sp_instr(ip, ctx), m_lex(NULL)
{}
virtual ~sp_instr_stmt();
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
inline void
set_lex(LEX *lex)
{
m_lex= lex;
}
inline LEX *
get_lex()
{
return m_lex;
}
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
protected:
int exec_stmt(THD *thd, LEX *lex); // Execute a statement
private:
LEX *m_lex; // My own lex
}; // class sp_instr_stmt : public sp_instr
class sp_instr_set : public sp_instr
{
sp_instr_set(const sp_instr_set &); /* Prevent use of these */
void operator=(sp_instr_set &);
public:
TABLE_LIST *tables;
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_set(uint ip, sp_pcontext *ctx,
uint offset, Item *val, enum enum_field_types type)
: sp_instr(ip, ctx),
tables(NULL), m_offset(offset), m_value(val), m_type(type)
{}
virtual ~sp_instr_set()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
private:
uint m_offset; // Frame offset
Item *m_value;
enum enum_field_types m_type; // The declared type
}; // class sp_instr_set : public sp_instr
WL#1218 "Triggers". Some very preliminary version of patch. Mostly needed for Monty for him getting notion what needed for triggers from new .FRM format. Things to be done: - Right placement of trigger's invocations - Right handling of errors in triggers (including transaction rollback) - Support for priviliges - Right handling of DROP/RENAME table (hope that it will be handled automatically with merging of .TRG into .FRM file) - Saving/restoring some information critical for trigger creation and replication with their definitions (e.g. sql_mode, creator, ...) - Replication Already has some known bugs so probably not for general review. include/mysqld_error.h: Added trigger related error codes. sql/Makefile.am: Added sql_trigger.* files to list of sources from which mysqld is built. sql/item.cc: Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item.h: Added enums for describing trigger properties. (Here because of dependencies). Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item_func.cc: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. Added comment clarifying why we don't need set no_send_ok when calling stored functions. sql/item_func.h: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. sql/lex.h: Symbols used in statements defining triggers were added. sql/mysql_priv.h: Exported some functions needed for triggers implementation. sql/parse_file.cc: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/parse_file.h: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/share/czech/errmsg.txt: Added trigger related error messages. sql/share/danish/errmsg.txt: Added trigger related error messages. sql/share/dutch/errmsg.txt: Added trigger related error messages. sql/share/english/errmsg.txt: Added trigger related error messages. sql/share/estonian/errmsg.txt: Added trigger related error messages. sql/share/french/errmsg.txt: Added trigger related error messages. sql/share/german/errmsg.txt: Added trigger related error messages. sql/share/greek/errmsg.txt: Added trigger related error messages. sql/share/hungarian/errmsg.txt: Added trigger related error messages. sql/share/italian/errmsg.txt: Added trigger related error messages. sql/share/japanese/errmsg.txt: Added trigger related error messages. sql/share/korean/errmsg.txt: Added trigger related error messages. sql/share/norwegian-ny/errmsg.txt: Added trigger related error messages. sql/share/norwegian/errmsg.txt: Added trigger related error messages. sql/share/polish/errmsg.txt: Added trigger related error messages. sql/share/portuguese/errmsg.txt: Added trigger related error messages. sql/share/romanian/errmsg.txt: Added trigger related error messages. sql/share/russian/errmsg.txt: Added trigger related error messages. sql/share/serbian/errmsg.txt: Added trigger related error messages. sql/share/slovak/errmsg.txt: Added trigger related error messages. sql/share/spanish/errmsg.txt: Added trigger related error messages. sql/share/swedish/errmsg.txt: Added trigger related error messages. sql/share/ukrainian/errmsg.txt: Added trigger related error messages. sql/sp_head.cc: sp_head::init_strings(): added support for triggers (we don't have most of strings for them) sp_head::execute_function(): triggers don't require RETURN sp_head::reset_lex(): added propagation of trigger properties to LEX used for parsing of statements composing trigger body. Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sp_head.h: Added new type of sp_head object - TYPE_ENUM_TRIGGER Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sql_base.cc: Now freeing memory occupied by trigger related structures when closing tables. open_unireg_entry(): added loading of triggers for table. find_field_in_real_table() is now public since it required by Item_trigger_field in item.cc sql/sql_delete.cc: Added triggers invocation for DELETE (should be fixed for sure :)) sql/sql_insert.cc: Added triggers invocation for INSERT (should be fixed for sure :)) sql/sql_lex.cc: Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added initialization of LEX->trg_table to lex_start(). (When triggers are parsed during opening of table it points to table object.) sql/sql_lex.h: Added trigger related commands. Added st_trg_chistics structure describing properties of trigger being created (as struct and as LEX member). Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added LEX::trg_table which points to table being opened when we are parsing trigger definition while opening table. sql/sql_parse.cc: Added support for CREATE/DROP TRIGGER commands. sql/sql_table.cc: Cleanup. close_cached_table() always returns 0 and its result is not analyzed in most places so chenged its return type to void. sql/sql_update.cc: Added triggers invocation for UPDATE (should be fixed for sure :)) sql/sql_yacc.yy: Added support for CREATE/DROP TRIGGER statements. Added support for OLD/NEW row identifiers in trigger. Made assignment to user variables not to break execution of stored function or trigger. sql/table.h: Added TABLE::triggers member representing triggers for this table.
2004-09-07 14:29:46 +02:00
/*
Set user variable instruction.
Used in functions and triggers to set user variables because we don't
want use sp_instr_stmt + "SET @a:=..." statement in this case since
latter will close all tables and thus will ruin execution of statement
calling/invoking this function/trigger.
*/
class sp_instr_set_user_var : public sp_instr
{
sp_instr_set_user_var(const sp_instr_set_user_var &);
void operator=(sp_instr_set_user_var &);
public:
sp_instr_set_user_var(uint ip, sp_pcontext *ctx, LEX_STRING var, Item *val)
: sp_instr(ip, ctx), m_set_var_item(var, val)
WL#1218 "Triggers". Some very preliminary version of patch. Mostly needed for Monty for him getting notion what needed for triggers from new .FRM format. Things to be done: - Right placement of trigger's invocations - Right handling of errors in triggers (including transaction rollback) - Support for priviliges - Right handling of DROP/RENAME table (hope that it will be handled automatically with merging of .TRG into .FRM file) - Saving/restoring some information critical for trigger creation and replication with their definitions (e.g. sql_mode, creator, ...) - Replication Already has some known bugs so probably not for general review. include/mysqld_error.h: Added trigger related error codes. sql/Makefile.am: Added sql_trigger.* files to list of sources from which mysqld is built. sql/item.cc: Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item.h: Added enums for describing trigger properties. (Here because of dependencies). Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item_func.cc: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. Added comment clarifying why we don't need set no_send_ok when calling stored functions. sql/item_func.h: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. sql/lex.h: Symbols used in statements defining triggers were added. sql/mysql_priv.h: Exported some functions needed for triggers implementation. sql/parse_file.cc: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/parse_file.h: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/share/czech/errmsg.txt: Added trigger related error messages. sql/share/danish/errmsg.txt: Added trigger related error messages. sql/share/dutch/errmsg.txt: Added trigger related error messages. sql/share/english/errmsg.txt: Added trigger related error messages. sql/share/estonian/errmsg.txt: Added trigger related error messages. sql/share/french/errmsg.txt: Added trigger related error messages. sql/share/german/errmsg.txt: Added trigger related error messages. sql/share/greek/errmsg.txt: Added trigger related error messages. sql/share/hungarian/errmsg.txt: Added trigger related error messages. sql/share/italian/errmsg.txt: Added trigger related error messages. sql/share/japanese/errmsg.txt: Added trigger related error messages. sql/share/korean/errmsg.txt: Added trigger related error messages. sql/share/norwegian-ny/errmsg.txt: Added trigger related error messages. sql/share/norwegian/errmsg.txt: Added trigger related error messages. sql/share/polish/errmsg.txt: Added trigger related error messages. sql/share/portuguese/errmsg.txt: Added trigger related error messages. sql/share/romanian/errmsg.txt: Added trigger related error messages. sql/share/russian/errmsg.txt: Added trigger related error messages. sql/share/serbian/errmsg.txt: Added trigger related error messages. sql/share/slovak/errmsg.txt: Added trigger related error messages. sql/share/spanish/errmsg.txt: Added trigger related error messages. sql/share/swedish/errmsg.txt: Added trigger related error messages. sql/share/ukrainian/errmsg.txt: Added trigger related error messages. sql/sp_head.cc: sp_head::init_strings(): added support for triggers (we don't have most of strings for them) sp_head::execute_function(): triggers don't require RETURN sp_head::reset_lex(): added propagation of trigger properties to LEX used for parsing of statements composing trigger body. Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sp_head.h: Added new type of sp_head object - TYPE_ENUM_TRIGGER Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sql_base.cc: Now freeing memory occupied by trigger related structures when closing tables. open_unireg_entry(): added loading of triggers for table. find_field_in_real_table() is now public since it required by Item_trigger_field in item.cc sql/sql_delete.cc: Added triggers invocation for DELETE (should be fixed for sure :)) sql/sql_insert.cc: Added triggers invocation for INSERT (should be fixed for sure :)) sql/sql_lex.cc: Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added initialization of LEX->trg_table to lex_start(). (When triggers are parsed during opening of table it points to table object.) sql/sql_lex.h: Added trigger related commands. Added st_trg_chistics structure describing properties of trigger being created (as struct and as LEX member). Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added LEX::trg_table which points to table being opened when we are parsing trigger definition while opening table. sql/sql_parse.cc: Added support for CREATE/DROP TRIGGER commands. sql/sql_table.cc: Cleanup. close_cached_table() always returns 0 and its result is not analyzed in most places so chenged its return type to void. sql/sql_update.cc: Added triggers invocation for UPDATE (should be fixed for sure :)) sql/sql_yacc.yy: Added support for CREATE/DROP TRIGGER statements. Added support for OLD/NEW row identifiers in trigger. Made assignment to user variables not to break execution of stored function or trigger. sql/table.h: Added TABLE::triggers member representing triggers for this table.
2004-09-07 14:29:46 +02:00
{}
virtual ~sp_instr_set_user_var()
{}
virtual int execute(THD *thd, uint *nextp);
virtual void print(String *str);
private:
Item_func_set_user_var m_set_var_item;
}; // class sp_instr_set_user_var : public sp_instr
/*
Set NEW/OLD row field value instruction. Used in triggers.
*/
class sp_instr_set_trigger_field : public sp_instr
{
sp_instr_set_trigger_field(const sp_instr_set_trigger_field &);
void operator=(sp_instr_set_trigger_field &);
public:
sp_instr_set_trigger_field(uint ip, sp_pcontext *ctx,
LEX_STRING field_name, Item *val)
: sp_instr(ip, ctx),
WL#1218 "Triggers". Some very preliminary version of patch. Mostly needed for Monty for him getting notion what needed for triggers from new .FRM format. Things to be done: - Right placement of trigger's invocations - Right handling of errors in triggers (including transaction rollback) - Support for priviliges - Right handling of DROP/RENAME table (hope that it will be handled automatically with merging of .TRG into .FRM file) - Saving/restoring some information critical for trigger creation and replication with their definitions (e.g. sql_mode, creator, ...) - Replication Already has some known bugs so probably not for general review. include/mysqld_error.h: Added trigger related error codes. sql/Makefile.am: Added sql_trigger.* files to list of sources from which mysqld is built. sql/item.cc: Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item.h: Added enums for describing trigger properties. (Here because of dependencies). Added Item_trigger_field class representing field of new/old version of row which is inserted/updated/deleted and for which trigger is invoked. sql/item_func.cc: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. Added comment clarifying why we don't need set no_send_ok when calling stored functions. sql/item_func.h: Added Item_func_set_user_var::print_as_stmt() for printing of assignment to ser variable from stored procedures. sql/lex.h: Symbols used in statements defining triggers were added. sql/mysql_priv.h: Exported some functions needed for triggers implementation. sql/parse_file.cc: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/parse_file.h: Cleaned up FILE_OPTIONS_STRLIST handling (needed for triggers). sql/share/czech/errmsg.txt: Added trigger related error messages. sql/share/danish/errmsg.txt: Added trigger related error messages. sql/share/dutch/errmsg.txt: Added trigger related error messages. sql/share/english/errmsg.txt: Added trigger related error messages. sql/share/estonian/errmsg.txt: Added trigger related error messages. sql/share/french/errmsg.txt: Added trigger related error messages. sql/share/german/errmsg.txt: Added trigger related error messages. sql/share/greek/errmsg.txt: Added trigger related error messages. sql/share/hungarian/errmsg.txt: Added trigger related error messages. sql/share/italian/errmsg.txt: Added trigger related error messages. sql/share/japanese/errmsg.txt: Added trigger related error messages. sql/share/korean/errmsg.txt: Added trigger related error messages. sql/share/norwegian-ny/errmsg.txt: Added trigger related error messages. sql/share/norwegian/errmsg.txt: Added trigger related error messages. sql/share/polish/errmsg.txt: Added trigger related error messages. sql/share/portuguese/errmsg.txt: Added trigger related error messages. sql/share/romanian/errmsg.txt: Added trigger related error messages. sql/share/russian/errmsg.txt: Added trigger related error messages. sql/share/serbian/errmsg.txt: Added trigger related error messages. sql/share/slovak/errmsg.txt: Added trigger related error messages. sql/share/spanish/errmsg.txt: Added trigger related error messages. sql/share/swedish/errmsg.txt: Added trigger related error messages. sql/share/ukrainian/errmsg.txt: Added trigger related error messages. sql/sp_head.cc: sp_head::init_strings(): added support for triggers (we don't have most of strings for them) sp_head::execute_function(): triggers don't require RETURN sp_head::reset_lex(): added propagation of trigger properties to LEX used for parsing of statements composing trigger body. Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sp_head.h: Added new type of sp_head object - TYPE_ENUM_TRIGGER Added two more SP instructions: - sp_instr_set_user_var for setting user variables in stored functions and triggers (we can't use sp_instr_stmt and "SET @a:=..." statement since it will close open tables and thus break execution of calling statement. - sp_instr_set_trigger_field for assignment to fields of row being updated/inserted in triggers sql/sql_base.cc: Now freeing memory occupied by trigger related structures when closing tables. open_unireg_entry(): added loading of triggers for table. find_field_in_real_table() is now public since it required by Item_trigger_field in item.cc sql/sql_delete.cc: Added triggers invocation for DELETE (should be fixed for sure :)) sql/sql_insert.cc: Added triggers invocation for INSERT (should be fixed for sure :)) sql/sql_lex.cc: Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added initialization of LEX->trg_table to lex_start(). (When triggers are parsed during opening of table it points to table object.) sql/sql_lex.h: Added trigger related commands. Added st_trg_chistics structure describing properties of trigger being created (as struct and as LEX member). Added trg_new_row_fake_var variable pointer to which is used for distinguishing between assignment to NEW row field (when parsing trigger definition) and structured variable. Added LEX::trg_table which points to table being opened when we are parsing trigger definition while opening table. sql/sql_parse.cc: Added support for CREATE/DROP TRIGGER commands. sql/sql_table.cc: Cleanup. close_cached_table() always returns 0 and its result is not analyzed in most places so chenged its return type to void. sql/sql_update.cc: Added triggers invocation for UPDATE (should be fixed for sure :)) sql/sql_yacc.yy: Added support for CREATE/DROP TRIGGER statements. Added support for OLD/NEW row identifiers in trigger. Made assignment to user variables not to break execution of stored function or trigger. sql/table.h: Added TABLE::triggers member representing triggers for this table.
2004-09-07 14:29:46 +02:00
trigger_field(Item_trigger_field::NEW_ROW, field_name.str),
value(val)
{}
virtual ~sp_instr_set_trigger_field()
{}
virtual int execute(THD *thd, uint *nextp);
virtual void print(String *str);
bool setup_field(THD *thd, TABLE *table, enum trg_event_type event)
{
return trigger_field.setup_field(thd, table, event);
}
private:
Item_trigger_field trigger_field;
Item *value;
}; // class sp_instr_trigger_field : public sp_instr
class sp_instr_jump : public sp_instr
{
sp_instr_jump(const sp_instr_jump &); /* Prevent use of these */
void operator=(sp_instr_jump &);
public:
uint m_dest; // Where we will go
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_jump(uint ip, sp_pcontext *ctx)
: sp_instr(ip, ctx), m_dest(0), m_optdest(0)
{}
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_jump(uint ip, sp_pcontext *ctx, uint dest)
: sp_instr(ip, ctx), m_dest(dest), m_optdest(0)
{}
virtual ~sp_instr_jump()
{}
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
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start);
virtual void opt_move(uint dst, List<sp_instr> *ibp);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual void backpatch(uint dest, sp_pcontext *dst_ctx)
{
if (m_dest == 0) // Don't reset
m_dest= dest;
}
protected:
sp_instr *m_optdest; // Used during optimization
}; // class sp_instr_jump : public sp_instr
class sp_instr_jump_if : public sp_instr_jump
{
sp_instr_jump_if(const sp_instr_jump_if &); /* Prevent use of these */
void operator=(sp_instr_jump_if &);
public:
TABLE_LIST *tables;
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_jump_if(uint ip, sp_pcontext *ctx, Item *i)
: sp_instr_jump(ip, ctx), tables(NULL), m_expr(i)
{}
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_jump_if(uint ip, sp_pcontext *ctx, Item *i, uint dest)
: sp_instr_jump(ip, ctx, dest), tables(NULL), m_expr(i)
{}
virtual ~sp_instr_jump_if()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start)
{
return m_ip;
}
private:
Item *m_expr; // The condition
}; // class sp_instr_jump_if : public sp_instr_jump
class sp_instr_jump_if_not : public sp_instr_jump
{
sp_instr_jump_if_not(const sp_instr_jump_if_not &); /* Prevent use of these */
void operator=(sp_instr_jump_if_not &);
public:
TABLE_LIST *tables;
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i)
: sp_instr_jump(ip, ctx), tables(NULL), m_expr(i)
{}
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_jump_if_not(uint ip, sp_pcontext *ctx, Item *i, uint dest)
: sp_instr_jump(ip, ctx, dest), tables(NULL), m_expr(i)
{}
virtual ~sp_instr_jump_if_not()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start)
{
return m_ip;
}
private:
Item *m_expr; // The condition
}; // class sp_instr_jump_if_not : public sp_instr_jump
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
class sp_instr_freturn : public sp_instr
{
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
sp_instr_freturn(const sp_instr_freturn &); /* Prevent use of these */
void operator=(sp_instr_freturn &);
public:
TABLE_LIST *tables;
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_freturn(uint ip, sp_pcontext *ctx,
Item *val, enum enum_field_types type)
: sp_instr(ip, ctx), tables(NULL), m_value(val), m_type(type)
{}
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
virtual ~sp_instr_freturn()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp)
{
marked= 1;
return UINT_MAX;
}
protected:
Item *m_value;
enum enum_field_types m_type;
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
}; // class sp_instr_freturn : public sp_instr
class sp_instr_hpush_jump : public sp_instr_jump
{
sp_instr_hpush_jump(const sp_instr_hpush_jump &); /* Prevent use of these */
void operator=(sp_instr_hpush_jump &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_hpush_jump(uint ip, sp_pcontext *ctx, int htype, uint fp)
: sp_instr_jump(ip, ctx), m_type(htype), m_frame(fp)
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
{
m_handler= ip+1;
m_cond.empty();
}
virtual ~sp_instr_hpush_jump()
{
m_cond.empty();
}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start)
{
return m_ip;
}
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
inline void add_condition(struct sp_cond_type *cond)
{
m_cond.push_front(cond);
}
private:
int m_type; // Handler type
uint m_frame;
uint m_handler; // Location of handler
List<struct sp_cond_type> m_cond;
}; // class sp_instr_hpush_jump : public sp_instr_jump
class sp_instr_hpop : public sp_instr
{
sp_instr_hpop(const sp_instr_hpop &); /* Prevent use of these */
void operator=(sp_instr_hpop &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_hpop(uint ip, sp_pcontext *ctx, uint count)
: sp_instr(ip, ctx), m_count(count)
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
{}
virtual ~sp_instr_hpop()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual void backpatch(uint dest, sp_pcontext *dst_ctx);
virtual uint opt_mark(sp_head *sp)
{
if (m_count)
marked= 1;
return m_ip+1;
}
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
private:
uint m_count;
}; // class sp_instr_hpop : public sp_instr
class sp_instr_hreturn : public sp_instr_jump
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
{
sp_instr_hreturn(const sp_instr_hreturn &); /* Prevent use of these */
void operator=(sp_instr_hreturn &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_hreturn(uint ip, sp_pcontext *ctx, uint fp)
: sp_instr_jump(ip, ctx), m_frame(fp)
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
{}
virtual ~sp_instr_hreturn()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp);
Implemented SP CONDITIONs and HANDLERs, with the extension of handling MySQL error codes as well. (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.) WL#850 Docs/sp-imp-spec.txt: Spec of CONDITIONs and HANDLERs (and updated some old stuff too). Docs/sp-implemented.txt: Updated info about caching, CONDITIONs and HANDLERs. include/mysqld_error.h: New error for undeclared CONDITION. libmysqld/Makefile.am: New file: sp_rcontext.cc. mysql-test/r/sp-error.result: New tests for CONDITIONs and HANDLERs. mysql-test/r/sp.result: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp-error.test: New tests for CONDITIONs and HANDLERs. mysql-test/t/sp.test: New tests for CONDITIONs and HANDLERs. sql/Makefile.am: New file: sp_rcontext.cc. sql/lex.h: New symbols for CONDITIONs, HANDLERs and CURSORs. sql/mysqld.cc: Catch error if we have a handler for it. sql/protocol.cc: Catch error if we have a handler for it. sql/share/czech/errmsg.txt: New error for undeclared CONDITION. sql/share/danish/errmsg.txt: New error for undeclared CONDITION. sql/share/dutch/errmsg.txt: New error for undeclared CONDITION. sql/share/english/errmsg.txt: New error for undeclared CONDITION. sql/share/estonian/errmsg.txt: New error for undeclared CONDITION. sql/share/french/errmsg.txt: New error for undeclared CONDITION. sql/share/german/errmsg.txt: New error for undeclared CONDITION. sql/share/greek/errmsg.txt: New error for undeclared CONDITION. sql/share/hungarian/errmsg.txt: New error for undeclared CONDITION. sql/share/italian/errmsg.txt: New error for undeclared CONDITION. sql/share/japanese/errmsg.txt: New error for undeclared CONDITION. sql/share/korean/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian-ny/errmsg.txt: New error for undeclared CONDITION. sql/share/norwegian/errmsg.txt: New error for undeclared CONDITION. sql/share/polish/errmsg.txt: New error for undeclared CONDITION. sql/share/portuguese/errmsg.txt: New error for undeclared CONDITION. sql/share/romanian/errmsg.txt: New error for undeclared CONDITION. sql/share/russian/errmsg.txt: New error for undeclared CONDITION. sql/share/serbian/errmsg.txt: New error for undeclared CONDITION. sql/share/slovak/errmsg.txt: New error for undeclared CONDITION. sql/share/spanish/errmsg.txt: New error for undeclared CONDITION. sql/share/swedish/errmsg.txt: New error for undeclared CONDITION. sql/share/ukrainian/errmsg.txt: New error for undeclared CONDITION. sql/sp_head.cc: New HANDLER code. sql/sp_head.h: New HANDLER code. sql/sp_pcontext.cc: New CONDITION and HANDLER code. sql/sp_pcontext.h: New CONDITION and HANDLER code. sql/sp_rcontext.h: New CONDITION and HANDLER code. sql/sql_yacc.yy: New CONDITION and HANDLER code.
2003-09-16 14:26:08 +02:00
private:
uint m_frame;
}; // class sp_instr_hreturn : public sp_instr
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
class sp_instr_cpush : public sp_instr
{
sp_instr_cpush(const sp_instr_cpush &); /* Prevent use of these */
void operator=(sp_instr_cpush &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_cpush(uint ip, sp_pcontext *ctx, LEX *lex)
: sp_instr(ip, ctx), m_lex(lex)
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
{}
virtual ~sp_instr_cpush();
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
private:
LEX *m_lex;
}; // class sp_instr_cpush : public sp_instr
class sp_instr_cpop : public sp_instr
{
sp_instr_cpop(const sp_instr_cpop &); /* Prevent use of these */
void operator=(sp_instr_cpop &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_cpop(uint ip, sp_pcontext *ctx, uint count)
: sp_instr(ip, ctx), m_count(count)
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
{}
virtual ~sp_instr_cpop()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
virtual void backpatch(uint dest, sp_pcontext *dst_ctx);
virtual uint opt_mark(sp_head *sp)
{
if (m_count)
marked= 1;
return m_ip+1;
}
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
private:
uint m_count;
}; // class sp_instr_cpop : public sp_instr
class sp_instr_copen : public sp_instr_stmt
{
sp_instr_copen(const sp_instr_copen &); /* Prevent use of these */
void operator=(sp_instr_copen &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_copen(uint ip, sp_pcontext *ctx, uint c)
: sp_instr_stmt(ip, ctx), m_cursor(c)
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
{}
virtual ~sp_instr_copen()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
private:
uint m_cursor; // Stack index
}; // class sp_instr_copen : public sp_instr_stmt
class sp_instr_cclose : public sp_instr
{
sp_instr_cclose(const sp_instr_cclose &); /* Prevent use of these */
void operator=(sp_instr_cclose &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_cclose(uint ip, sp_pcontext *ctx, uint c)
: sp_instr(ip, ctx), m_cursor(c)
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
{}
virtual ~sp_instr_cclose()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
private:
uint m_cursor;
}; // class sp_instr_cclose : public sp_instr
class sp_instr_cfetch : public sp_instr
{
sp_instr_cfetch(const sp_instr_cfetch &); /* Prevent use of these */
void operator=(sp_instr_cfetch &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_cfetch(uint ip, sp_pcontext *ctx, uint c)
: sp_instr(ip, ctx), m_cursor(c)
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
{
m_varlist.empty();
}
virtual ~sp_instr_cfetch()
{}
virtual int execute(THD *thd, uint *nextp);
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
virtual void print(String *str);
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the (updated) Protocol_cursor class. Also did some bug fixes. Docs/sp-imp-spec.txt: Added CURSOR docs (and fixed typos) Docs/sp-implemented.txt: Updated for CURSORs include/mysqld_error.h: New error codes/messages for CURSORs libmysqld/Makefile.am: SP cursors now needs this. mysql-test/r/sp-error.result: New tests for cursors. mysql-test/r/sp.result: New tests for cursors. mysql-test/t/sp-error.test: New tests for cursors. mysql-test/t/sp.test: New tests for cursors. sql/protocol.cc: We now always have Protocol_cursor (SPs use it) sql/protocol.h: Fixed bugs in Protocol_cursor (for SPs) sql/protocol_cursor.cc: Fixed bugs in Protocol_cursor (for SPs) sql/share/czech/errmsg.txt: New error codes/messages for CURSORs sql/share/danish/errmsg.txt: New error codes/messages for CURSORs sql/share/dutch/errmsg.txt: New error codes/messages for CURSORs sql/share/english/errmsg.txt: New error codes/messages for CURSORs sql/share/estonian/errmsg.txt: New error codes/messages for CURSORs sql/share/french/errmsg.txt: New error codes/messages for CURSORs sql/share/german/errmsg.txt: New error codes/messages for CURSORs sql/share/greek/errmsg.txt: New error codes/messages for CURSORs sql/share/hungarian/errmsg.txt: New error codes/messages for CURSORs sql/share/italian/errmsg.txt: New error codes/messages for CURSORs sql/share/japanese/errmsg.txt: New error codes/messages for CURSORs sql/share/korean/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian-ny/errmsg.txt: New error codes/messages for CURSORs sql/share/norwegian/errmsg.txt: New error codes/messages for CURSORs sql/share/polish/errmsg.txt: New error codes/messages for CURSORs sql/share/portuguese/errmsg.txt: New error codes/messages for CURSORs sql/share/romanian/errmsg.txt: New error codes/messages for CURSORs sql/share/russian/errmsg.txt: New error codes/messages for CURSORs sql/share/serbian/errmsg.txt: New error codes/messages for CURSORs sql/share/slovak/errmsg.txt: New error codes/messages for CURSORs sql/share/spanish/errmsg.txt: New error codes/messages for CURSORs sql/share/swedish/errmsg.txt: New error codes/messages for CURSORs sql/share/ukrainian/errmsg.txt: New error codes/messages for CURSORs sql/sp_head.cc: Added cursor support. Also fixed problems with item_lists, where pointers and ref_pointer_arrays. sql/sp_head.h: Added cursor support sql/sp_pcontext.cc: Added cursor support sql/sp_pcontext.h: Added cursor support sql/sp_rcontext.cc: Added cursor support, in particular the new sp_cursor class. sql/sp_rcontext.h: Added cursor support, in particular the new sp_cursor class. sql/sql_lex.h: We sometimes need to copy item_lists in LEX when executing substatements in SPs sql/sql_yacc.yy: Added minimal cursor support (not the full syntax yet).
2003-10-10 16:57:21 +02:00
void add_to_varlist(struct sp_pvar *var)
{
m_varlist.push_back(var);
}
private:
uint m_cursor;
List<struct sp_pvar> m_varlist;
}; // class sp_instr_cfetch : public sp_instr
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
class sp_instr_error : public sp_instr
{
sp_instr_error(const sp_instr_error &); /* Prevent use of these */
void operator=(sp_instr_error &);
public:
Major rehacking and cleanup of sp_pcontext. This finishes (almost) WL#2002: Implement stored procedure GOTO. Only the syntax issue for free labels remains ("label L;" vs "L:"). include/mysqld_error.h: New error code for GOTO in SP handler. mysql-test/r/sp-error.result: New error test cases for GOTO. mysql-test/r/sp.result: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. mysql-test/t/sp-error.test: New error test cases for GOTO. mysql-test/t/sp.test: New test cases for GOTO. Also removed some things that made it impossible to run the test in an external (debugged) mysqld. sql/share/czech/errmsg.txt: New error message for GOTO in SP handler. sql/share/danish/errmsg.txt: New error message for GOTO in SP handler. sql/share/dutch/errmsg.txt: New error message for GOTO in SP handler. sql/share/english/errmsg.txt: New error message for GOTO in SP handler. sql/share/estonian/errmsg.txt: New error message for GOTO in SP handler. sql/share/french/errmsg.txt: New error message for GOTO in SP handler. sql/share/german/errmsg.txt: New error message for GOTO in SP handler. sql/share/greek/errmsg.txt: New error message for GOTO in SP handler. sql/share/hungarian/errmsg.txt: New error message for GOTO in SP handler. sql/share/italian/errmsg.txt: New error message for GOTO in SP handler. sql/share/japanese/errmsg.txt: New error message for GOTO in SP handler. sql/share/korean/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian-ny/errmsg.txt: New error message for GOTO in SP handler. sql/share/norwegian/errmsg.txt: New error message for GOTO in SP handler. sql/share/polish/errmsg.txt: New error message for GOTO in SP handler. sql/share/portuguese/errmsg.txt: New error message for GOTO in SP handler. sql/share/romanian/errmsg.txt: New error message for GOTO in SP handler. sql/share/russian/errmsg.txt: New error message for GOTO in SP handler. sql/share/serbian/errmsg.txt: New error message for GOTO in SP handler. sql/share/slovak/errmsg.txt: New error message for GOTO in SP handler. sql/share/spanish/errmsg.txt: New error message for GOTO in SP handler. sql/share/swedish/errmsg.txt: New error message for GOTO in SP handler. sql/share/ukrainian/errmsg.txt: New error message for GOTO in SP handler. sql/sp_head.cc: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_head.h: Code cleanup (renaming of pcontext methods), support goto, and fixed bug in jump shortcutting in the optimizer (detect infinite loops). sql/sp_pcontext.cc: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sp_pcontext.h: Major rehack and cleanup: - We now push and pop a chain of contexts during parsing (instead of having a single one). - Makes error detection for GOTO easier and enables some optmizations and debugger support. - Makes it a little trickier to keep track on variable and cursor indexes instead. - Renamed things to get a more consistent naming scheme too. sql/sql_yacc.yy: Changes to reflect the rework and renamings in sp_pcontext, and fixed some GOTO error checking.
2004-08-26 12:54:30 +02:00
sp_instr_error(uint ip, sp_pcontext *ctx, int errcode)
: sp_instr(ip, ctx), m_errcode(errcode)
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
{}
virtual ~sp_instr_error()
{}
virtual int execute(THD *thd, uint *nextp);
virtual void print(String *str);
virtual uint opt_mark(sp_head *sp)
{
marked= 1;
return UINT_MAX;
}
Enforce standard declaration order in SPs. Added new test cases for this, and adjusted old tests accordingly, and new error codes and messages. Fixed bugs in some tests (bug2673 and use test). Added debug printing of instructions in SPs. include/mysqld_error.h: New error codes for non-standard declaration order in SPs. include/sql_state.h: New error codes for non-standard declaration order in SPs. mysql-test/r/sp-error.result: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/r/sp.result: Enforce strict declaration order. Fixed platform dependent bug2673 test. mysql-test/t/sp-error.test: Enforce standard declaration order. Fixed syntax error in use-test. New test cases for wrong order. mysql-test/t/sp.test: Enforce strict declaration order. Fixed platform dependent bug2673 test. sql/share/czech/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/danish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/dutch/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/english/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/estonian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/french/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/german/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/greek/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/hungarian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/italian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/japanese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/korean/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian-ny/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/norwegian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/polish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/portuguese/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/romanian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/russian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/serbian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/slovak/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/spanish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/swedish/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/share/ukrainian/errmsg.txt: New error messages for strict (standard) declaration order in SPs. sql/sp_head.cc: Debug printing of instructions in procedures. New error instruction for future use. sql/sp_head.h: Debug printing of instructions in procedures. New error instruction for future use. sql/sql_string.cc: New methods needed by debug printing of instruction in SPs. sql/sql_string.h: New methods needed by debug printing of instruction in SPs. sql/sql_yacc.yy: Check for standard order of declarations in SPs.
2004-03-29 11:16:45 +02:00
private:
int m_errcode;
}; // class sp_instr_error : public sp_instr
WL#1365: Implement definer's rights execution of stored procedures. (Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo.
2003-12-13 16:40:52 +01:00
struct st_sp_security_context
{
bool changed;
uint master_access;
uint db_access;
char *priv_user;
char priv_host[MAX_HOSTNAME];
char *user;
char *host;
char *ip;
};
#ifndef NO_EMBEDDED_ACCESS_CHECKS
WL#1365: Implement definer's rights execution of stored procedures. (Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo.
2003-12-13 16:40:52 +01:00
void
sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp);
void
sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp);
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
WL#1365: Implement definer's rights execution of stored procedures. (Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo.
2003-12-13 16:40:52 +01:00
#endif /* _SP_HEAD_H_ */