An error occurred fetching the project authors.
  1. 15 Feb, 2006 1 commit
    • unknown's avatar
      Fixed BUG#16887: Cursor causes server segfault · 7f02b0a0
      unknown authored
        The problem was a code generation bug: cpop instructions were not generated
        when using ITERATE back to an outer block from a context with a declared
        cursor; this would make it push a new cursor without popping in-between,
        eventually overrunning the cursor stack with a crash as the result.
        Fixed the calculation of how many cursors to pop (in sp_pcontext.cc:
        diff_cursors()), and also corrected diff_cursors() and diff_handlers()
        to when doing a "leave"; don't include the last context we're leaving
        (we are then jumping to the appropriate pop instructions).
      
      
      mysql-test/r/sp.result:
        Updated result for new test case (BUG#16887)
      mysql-test/t/sp.test:
        New test case for BUG#16887
      sql/sp_pcontext.cc:
        Added new parameter to sp_pcontext::diff_handlers() and diff_cursors():
        They can either include (for iterate jumps) or exclude (for leave jumps)
        the outer context.
        Fixed bug in diff_cursors(); it was just plain wrong and would return
        zero in some situations when it shouldn't.
      sql/sp_pcontext.h:
        Added new parameter to sp_pcontext::diff_handlers() and diff_cursors():
        They can either include (for iterate jumps) or exclude (for leave jumps)
        the outer context.
      sql/sql_yacc.yy:
        Added parameter to diff_handlers/diff_cursors depending on if it's an
        iterate or leave jump.
        For "leave", we don't have to include the last context we're leaving since
        we will jump to the appropriate pop instructions.
      7f02b0a0
  2. 16 Jan, 2006 1 commit
  3. 07 Dec, 2005 1 commit
    • unknown's avatar
      Patch for WL#2894: Make stored routine variables work · 6b2f1309
      unknown authored
      according to the standard.
      
      The idea is to use Field-classes to implement stored routines
      variables. Also, we should provide facade to Item-hierarchy
      by Item_field class (it is necessary, since SRVs take part
      in expressions).
      
      The patch fixes the following bugs:
        - BUG#8702: Stored Procedures: No Error/Warning shown for inappropriate data 
          type matching; 
       
        - BUG#8768: Functions: For any unsigned data type, -ve values can be passed 
          and returned; 
       
        - BUG#8769: Functions: For Int datatypes, out of range values can be passed 
          and returned; 
       
        - BUG#9078: STORED PROCDURE: Decimal digits are not displayed when we use 
          DECIMAL datatype; 
       
        - BUG#9572: Stored procedures: variable type declarations ignored; 
       
        - BUG#12903: upper function does not work inside a function; 
       
        - BUG#13705: parameters to stored procedures are not verified; 
       
        - BUG#13808: ENUM type stored procedure parameter accepts non-enumerated
          data; 
       
        - BUG#13909: Varchar Stored Procedure Parameter always BINARY string (ignores 
          CHARACTER SET); 
       
        - BUG#14161: Stored procedure cannot retrieve bigint unsigned;
      
        - BUG#14188: BINARY variables have no 0x00 padding;
      
        - BUG#15148: Stored procedure variables accept non-scalar values;
      
      
      mysql-test/r/ctype_ujis.result:
        Explicitly specify correct charset.
      mysql-test/r/schema.result:
        Drop our test database to not affect this test if some test
        left it cause of failure.
      mysql-test/r/show_check.result:
        Drop our test database to not affect this test if some test
        left it cause of failure.
      mysql-test/r/skip_name_resolve.result:
        Ignore columns with unpredictable values.
      mysql-test/r/sp-big.result:
        Add cleanup statement.
      mysql-test/r/sp-dynamic.result:
        Add cleanup statements.
      mysql-test/r/sp.result:
        Update result file.
      mysql-test/r/sum_distinct-big.result:
        Update result file.
      mysql-test/r/type_newdecimal-big.result:
        Update result file.
      mysql-test/t/ctype_ujis.test:
        Explicitly specify correct charset.
      mysql-test/t/schema.test:
        Drop our test database to not affect this test if some test
        left it cause of failure.
      mysql-test/t/show_check.test:
        Drop our test database to not affect this test if some test
        left it cause of failure.
      mysql-test/t/skip_name_resolve.test:
        Ignore columns with unpredictable values.
      mysql-test/t/sp-big.test:
        Add cleanup statement.
      mysql-test/t/sp-dynamic.test:
        Add cleanup statements.
      mysql-test/t/sp.test:
        Non-scalar values prohibited for assignment to SP-vars;
        polishing.
      mysql-test/t/type_newdecimal-big.test:
        Update type specification so that the variables
        can contain the large values used in the test.
      sql/field.cc:
        Extract create_field::init() to initialize an existing
        instance of create_field from new_create_field().
      sql/field.h:
        Extract create_field::init() to initialize an existing
        instance of create_field from new_create_field().
      sql/item.cc:
        - Introduce a new class: Item_sp_variable -- a base class
          of stored-routine-variables classes;
        - Introduce Item_case_expr -- an Item, which is used to access
          to the expression of CASE statement;
      sql/item.h:
        - Introduce a new class: Item_sp_variable -- a base class
          of stored-routine-variables classes;
        - Introduce Item_case_expr -- an Item, which is used to access
          to the expression of CASE statement;
      sql/item_func.cc:
        Pass the Field (instead of Item) for the return value of
        a function to the function execution routine.
      sql/item_func.h:
        Pass the Field (instead of Item) for the return value of
        a function to the function execution routine.
      sql/mysql_priv.h:
        Move create_virtual_tmp_table() out of sql_select.h.
      sql/sp.cc:
        Use create_result_field() instead of make_field().
      sql/sp_head.cc:
        - Add a function to map enum_field_types to Item::Type;
        - Add sp_instr_push_case_expr instruction -- an instruction
          to push CASE expression into the active running context;
        - Add sp_instr_pop_case_expr instruction -- an instruction
          to pop CASE expression from the active running context;
        - Adapt the SP-execution code to using Fields instead of Items
          for SP-vars;
        - Use create_field structure for field description instead of
          a set of members.
      sql/sp_head.h:
        - Add a function to map enum_field_types to Item::Type;
        - Add sp_instr_push_case_expr instruction -- an instruction
          to push CASE expression into the active running context;
        - Add sp_instr_pop_case_expr instruction -- an instruction
          to pop CASE expression from the active running context;
        - Adapt the SP-execution code to using Fields instead of Items
          for SP-vars;
        - Use create_field structure for field description instead of
          a set of members.
      sql/sp_pcontext.cc:
        - Change rules to assign an index of SP-variable: use
          transparent index;
        - Add an operation to retrieve a list of defined SP-vars
          from the processing context recursively.
      sql/sp_pcontext.h:
        - Change rules to assign an index of SP-variable: use
          transparent index;
        - Add an operation to retrieve a list of defined SP-vars
          from the processing context recursively.
      sql/sp_rcontext.cc:
        - Change rules to assign an index of SP-variable: use
          transparent index;
        - Use a tmp virtual table to store SP-vars instead of Items;
        - Provide operations to work with CASE expresion.
      sql/sp_rcontext.h:
        - Change rules to assign an index of SP-variable: use
          transparent index;
        - Use a tmp virtual table to store SP-vars instead of Items;
        - Provide operations to work with CASE expresion.
      sql/sql_class.cc:
        - Reflect Item_splocal ctor changes;
        - Item_splocal::get_offset() has been renamed to get_var_idx().
      sql/sql_class.h:
        Polishing.
      sql/sql_parse.cc:
        Extract create_field::init() to initialize an existing
        instance of create_field from new_create_field().
      sql/sql_select.cc:
        Take care of BLOB columns in create_virtual_tmp_table().
      sql/sql_select.h:
        Move create_virtual_tmp_table() out of sql_select.h.
      sql/sql_trigger.cc:
        Use boolean constants for boolean type instead of numerical ones.
      sql/sql_yacc.yy:
        Provide an instance of create_field for each SP-var.
      mysql-test/include/sp-vars.inc:
        The definitions of common-procedures, which are created
        under different circumstances.
      mysql-test/r/sp-vars.result:
        Result file for the SP-vars test.
      mysql-test/sp-vars.test:
        A new test for checking SP-vars functionality.
      6b2f1309
  4. 02 Dec, 2005 1 commit
  5. 18 Nov, 2005 1 commit
    • unknown's avatar
      Post-review fixes, mainly fixing all print() methods for sp_instr* classes. · 6726a6b8
      unknown authored
      Also added mysql-test files:
       include/is_debug_build.inc
       r/is_debug_build.require
       r/sp-code.result
       t/sp-code.test
      
      
      sql/sp_head.cc:
        Review fixes:
        - Some minor editorial changes
        - Fixed all print() methods for instructions:
          - reserve() enough space
          - check return value from reserve()
          - use qs_append, with length arg, whenever possible
      sql/sp_pcontext.cc:
        Review fixes.
        Also fixed bug in find_cursor().
      sql/sp_pcontext.h:
        Changed parameter names (review fix).
      sql/sql_parse.cc:
        Moved comment. (Review fix)
      mysql-test/include/is_debug_build.inc:
        New BitKeeper file ``mysql-test/include/is_debug_build.inc''
      mysql-test/r/is_debug_build.require:
        New BitKeeper file ``mysql-test/r/is_debug_build.require''
      mysql-test/r/sp-code.result:
        New BitKeeper file ``mysql-test/r/sp-code.result''
      mysql-test/t/sp-code.test:
        New BitKeeper file ``mysql-test/t/sp-code.test''
      6726a6b8
  6. 17 Nov, 2005 1 commit
    • unknown's avatar
      Background: · 91ab7076
      unknown authored
      Since long, the compiled code of stored routines has been printed in the trace file
      when starting mysqld with the "--debug" flag. (At creation time only, and only in
      debug builds of course.) This has been helpful when debugging stored procedure
      execution, but it's a bit awkward to use. Also, the printing of some of the
      instructions is a bit terse, in particular for sp_instr_stmt where only the command
      code was printed.
      
      This improves the printout of several of the instructions, and adds the debugging-
      only commands "show procedure code <name>" and "show function code <name>".
      (In non-debug builds they are not available.)
      
      
      sql/lex.h:
        New symbol for debug-only command (e.g. show procedure code).
      sql/sp_head.cc:
        Fixed some minor debug-mode bugs in show_create_*().
        New method for debugging: sp_head::show_routine_code() - returns the "assembly code"
        for a stored routine as a result set.
        Improved the print() methods for many sp_instr* classes, particularly for
        sp_instr_stmt where the query string is printed as well (up to a max length, just
        to give a hint of which statement it is). Also print the names of variables and
        cursors in some instruction.
      sql/sp_head.h:
        New debugging-only method in sp_head: show_routine_code().
        Added offset member to sp_instr_cpush for improved debug printing.
      sql/sp_pcontext.cc:
        Moved find_pvar(uint i) method from sp_pcontext.h, and made it work for all
        frames, not just the first one. (For debugging purposes)
        Added a similar find_cursor(uint i, ...) method, for debugging.
      sql/sp_pcontext.h:
        Moved find_pvar(uint i) method to sp_pcontext.cc.
        Added a similar find_cursor(uint i, ...) method, for debugging.
      sql/sql_lex.h:
        Added new sql_command codes for debugging.
      sql/sql_parse.cc:
        Added new commands for debugging, e.g. "show procedure code".
      sql/sql_yacc.yy:
        Added new commands for debugging purposes:
        "show procedure code ..." and "show function code ...".
        These are only enabled in debug builds, otherwise they result in a syntax error.
        (I.e. they don't exist)
      91ab7076
  7. 01 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14376: MySQL crash on scoped variable (re)initialization · 2c4c542b
      unknown authored
        Added finer scope control for default clauses of local variable
        declarations.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#14376.
      mysql-test/t/sp.test:
        New test case for BUG#14376.
      sql/sp_pcontext.cc:
        Added boundary variable for local parameters/variables,
        for better scope control of default values.
      sql/sp_pcontext.h:
        Added boundary variable for local parameters/variables,
        for better scope control of default values.
      sql/sql_yacc.yy:
        Make the variables of the current DECLARE "invisible" to its DEFAULT clause.
      2c4c542b
  8. 13 Sep, 2005 1 commit
    • unknown's avatar
      Fixed BUG#13133: Local variables in stored procedures are not initialized correctly. · 902932a1
      unknown authored
        Have to init. all local variables in their frames, not just once at the beginning
        of invocation.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#13133.
      mysql-test/t/sp.test:
        New test case for BUG#13133.
      sql/sp_head.cc:
        Just init. local variable slots in the fram to NULL. (Real init. will be done
        in each block.)
      sql/sp_pcontext.cc:
        Removed isset flag, since it's not used.
      sql/sp_pcontext.h:
        Removed isset flag, since it's not used.
      sql/sql_yacc.yy:
        Initialize local variables in the block to null, or the default value, given.
        (Untabifed block too.)
      902932a1
  9. 25 Aug, 2005 1 commit
    • unknown's avatar
      Fix for BUG#12335 (SP replication) : New binlogging strategy for stored PROCEDUREs/FUNCTIONs. · 8a5e5274
      unknown authored
      "Interleaved SPs execution is now binlogged properly, "SELECT spfunc()" is binlogged too.
      The known remaining issue is binlogging/replication of "a routine is deleted while it is executed" scenario.
      
      
      mysql-test/r/rpl_sp.result:
        Fix for BUG#12335: updated test cases/results
      mysql-test/t/rpl_sp.test:
        Fix for BUG#12335: updated test cases/results
      sql/item.cc:
        Fix for BUG#12335 (SP replication): 
         - Added Item_name_const 'function'
         - Addede 'delete reuse' to call dtor on item reuse
      sql/item.h:
        Fix for BUG#12335 (SP replication) : Added Item_name_const 'function' + code cleanup
      sql/item_create.cc:
         Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
      sql/item_create.h:
         Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
      sql/item_func.cc:
        Fix for BUG#12335 (SP replication) : binary log is now constrolled from within execute_function.
      sql/lex.h:
        Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
      sql/log.cc:
        Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
        one to temporary disable binlogging but collect a 'union' information about binlog write
        calls.
      sql/mysql_priv.h:
        Fix for BUG#12335 (SP replication)
      sql/sp_head.cc:
        Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for 
        StoredRoutinesBinlogging for details
      sql/sp_head.h:
        Comments added
      sql/sp_pcontext.h:
        Comments added
      sql/sp_rcontext.h:
        Comments added
      sql/sql_class.cc:
        Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for 
        StoredRoutinesBinlogging for details
      sql/sql_class.h:
        Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
        one to temporary disable binlogging but collect a 'union' information about binlog write
        calls.
      sql/sql_delete.cc:
        Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
      sql/sql_insert.cc:
        Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
      sql/sql_lex.cc:
        Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
        the tokenizer.
      sql/sql_lex.h:
        Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
        the tokenizer.
      sql/sql_parse.cc:
        Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for 
        StoredRoutinesBinlogging for details
      sql/sql_update.cc:
        Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
      sql/sql_yacc.yy:
        Fix for BUG#12335 (SP replication) : When creating Item_splocal, remember where it is located
        in the query.
      8a5e5274
  10. 27 May, 2005 1 commit
    • unknown's avatar
      Add USE_PRAGMA_INTERFACE and USE_PRAGMA_IMPLEMENTATION to files not existsing in 4.1 · 73b4415c
      unknown authored
      sql/hash_filo.h:
        USE_PRAGMA_INTERFACE
      sql/sp_cache.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_cache.h:
        USE_PRAGMA_INTERFACE
      sql/sp_head.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_head.h:
        USE_PRAGMA_INTERFACE
      sql/sp_pcontext.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_pcontext.h:
        USE_PRAGMA_INTERFACE
      sql/sp_rcontext.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_rcontext.h:
        USE_PRAGMA_INTERFACE
      73b4415c
  11. 13 Apr, 2005 1 commit
  12. 08 Apr, 2005 1 commit
    • unknown's avatar
      Fixed BUG#9073: Able to declare two handlers for same condition in same scope · fc5db935
      unknown authored
      mysql-test/r/sp-error.result:
        Added test case for BUG#9073.
      mysql-test/t/sp-error.test:
        Added test case for BUG#9073.
      sql/share/errmsg.txt:
        New error message for duplicate condition handlers in stored procedures.
      sql/sp_pcontext.cc:
        Keep track on condition handlers in the same block for error checking.
      sql/sp_pcontext.h:
        Keep track on condition handlers in the same block for error checking.
      sql/sql_yacc.yy:
        Keep track on condition handlers in the same block for error checking.
      fc5db935
  13. 28 Feb, 2005 1 commit
    • unknown's avatar
      Fixed BUG#8760: Stored Procedures: Invalid SQLSTATE is allowed in · 110f6abd
      unknown authored
                      a DECLARE ? HANDLER FOR stmt.
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#8776 (check format of sqlstates in handler declarations).
      mysql-test/t/sp-error.test:
        New test case for BUG#8776 (check format of sqlstates in handler declarations).
      sql/share/errmsg.txt:
        New error message for malformed SQLSTATEs.
      sql/sp_pcontext.cc:
        Added function for checking SQLSTATE format.
      sql/sp_pcontext.h:
        Added function for checking SQLSTATE format.
      sql/sql_yacc.yy:
        Check format of SQLSTATE in handler declaration.
      110f6abd
  14. 17 Nov, 2004 1 commit
    • unknown's avatar
      Fix warnings and compilation failures (Windows). · 7cd9cc1b
      unknown authored
      sql/field.cc:
        Fix warning.
      sql/item_func.cc:
        Fix Windows compilation failure.
      sql/opt_range.cc:
        Fix warnings and errors (Windows)
      sql/sp_pcontext.h:
        Fix warning (Windows).
      sql/table.h:
        Fix warning (Windows).
      7cd9cc1b
  15. 02 Sep, 2004 1 commit
    • unknown's avatar
      Fixed BUG#5287: Stored procedure crash if leave outside loop. · 339859d2
      unknown authored
      Bug in diff_handlers and diff_cursors made it attempt to pop
      the wrong number at jumps sometimes.
      
      
      mysql-test/r/sp.result:
        New testcase for BUG#5287.
      mysql-test/t/sp.test:
        New testcase for BUG#5287.
      sql/sp_pcontext.cc:
        Fixed diff_handlers and diff_cursors methods, they miscounted.
      sql/sp_pcontext.h:
        Made m_handlers available for diff_handlers.
      339859d2
  16. 26 Aug, 2004 1 commit
    • unknown's avatar
      Major rehacking and cleanup of sp_pcontext. · 071651ef
      unknown authored
      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.
      071651ef
  17. 17 Aug, 2004 1 commit
    • unknown's avatar
      WL#2002: Implement stored procedure GOTO. · 9b5a6f72
      unknown authored
      Mostly done, it works, but the temporary LABEL syntax still to be fixed.
      
      
      mysql-test/r/sp-error.result:
        New test case for WL#2002 (GOTO).
      mysql-test/r/sp.result:
        New test case for WL#2002 (GOTO).
        (Also corrected another test)
      mysql-test/t/sp-error.test:
        New test case for WL#2002 (GOTO).
      mysql-test/t/sp.test:
        New test case for WL#2002 (GOTO).
        (Also corrected another test)
      sql/lex.h:
        New symbol GOTO.
        Also a temporary symbol LABEL, which hopefully will go away soon.
      sql/sp_head.cc:
        Fixed backpatching to cope with free GOTO labels an hpop and cpop instructions.
        Also optimized away pointless jump instructions.
      sql/sp_head.h:
        Fixed backpatching to cope with free GOTO labels an hpop and cpop instructions.
        We now sometimes generate hpop/cpop 0 instructions but the optimizer removes them.
      sql/sp_pcontext.cc:
        Added free GOTO labels, and support for coping with jumps out of blocks
        with handlers or cursors.
      sql/sp_pcontext.h:
        Added free GOTO labels, and support for coping with jumps out of blocks
        with handlers or cursors.
      sql/sql_yacc.yy:
        Added GOTO and LABEL, and adjusted backpatching accordingly. Also fixed LEAVE
        out of blocks. The LABEL syntax will go away soon, hopefully.
      9b5a6f72
  18. 06 Apr, 2004 1 commit
    • unknown's avatar
      Fixed BUG#2776: Stored procedure crash if variable assigned to default. · c22ccc13
      unknown authored
      Keep track on the default value and use it. (Or NULL, if not declared.)
      
      
      mysql-test/r/sp.result:
        New testcases for BUG#2776.
      mysql-test/t/sp.test:
        New testcases for BUG#2776.
      sql/sp_pcontext.cc:
        Initialize local variable default value.
      sql/sp_pcontext.h:
        New method for saving default value.
      sql/sql_yacc.yy:
        If DEFAULT is use as a value in SET variable = ... in an SP, actually use the default.
      c22ccc13
  19. 13 Nov, 2003 1 commit
    • unknown's avatar
      Various bug fixes: · c9232c60
      unknown authored
        - Duplicate parameters/variables, conditions and cursors (not allowed).
        - ITERATE in labelled BEGIN-END (not allowed).
        - Missing SQLSTATE [VALUE] keywords in CONDITION/HANDLER declaration (added).
        - Empty BEGIN-END (now allowed).
        - End label (now optional).
      
      
      include/mysqld_error.h:
        New error code for duplicate things (vars et al) in SPs.
      mysql-test/r/sp-error.result:
        New error tests for ITERATE in begin-end block and duplicate variables,
        conditions and cursors.
      mysql-test/r/sp.result:
        New tests for empty begin-end blocks, overriding local variables outside scope
        only, leave a begin-end block, and SQLSTATE [VALUE] words for CONDITION/HANDLER
        declarations.
      mysql-test/t/sp-error.test:
        New error tests for ITERATE in begin-end block and duplicate variables,
        conditions and cursors.
      mysql-test/t/sp.test:
        New tests for empty begin-end blocks, overriding local variables outside scope
        only, leave a begin-end block, and SQLSTATE [VALUE] words for CONDITION/HANDLER
        declarations.
      sql/lex.h:
        New SQLSTATE keyword.
      sql/share/czech/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/danish/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/dutch/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/english/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/estonian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/french/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/german/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/greek/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/hungarian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/italian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/japanese/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/korean/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/norwegian-ny/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/norwegian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/polish/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/portuguese/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/romanian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/russian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/serbian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/slovak/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/spanish/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/swedish/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/share/ukrainian/errmsg.txt:
        New error message for duplicate things (vars et al) in SPs.
      sql/sp_pcontext.cc:
        Keep track on scope limits for error checking of duplicate variables,
        conditions and cursors.
      sql/sp_pcontext.h:
        Keep track on scope limits for error checking of duplicate variables,
        conditions and cursors.
        Also need to flag BEGIN labels to check for illegal ITERATEs.
      sql/sql_yacc.yy:
        End-labels in SPs loop and begin-end blocks are now optional.
        SQLSTATE [VALUE] added to syntax for sqlstates.
        Check for duplicate variable, condition and cursor declarations, but
        only in the same scope.
        Empty BEGIN-END statements now allowed.
        Check if ITERATE is referring to a BEGIN label.
      c9232c60
  20. 10 Oct, 2003 1 commit
    • unknown's avatar
      WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the · 04c6b9b8
      unknown authored
      (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).
      04c6b9b8
  21. 16 Sep, 2003 1 commit
    • unknown's avatar
      Implemented SP CONDITIONs and HANDLERs, with the extension of handling · 4deedf62
      unknown authored
      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.
      4deedf62
  22. 02 Apr, 2003 1 commit
  23. 26 Mar, 2003 1 commit
    • unknown's avatar
      Added IF EXISTS to DROP PROCEDURE|FUNCTION. · 3946b823
      unknown authored
      Changed another unecessary use of Item_string into LEX_STRING (in sp_pcontext).
      
      
      Docs/sp-implemented.txt:
        Added IF EXISTS to DROP PROCEDURE|FUNCTION
      mysql-test/r/sp-error.result:
        Added IF EXISTS to DROP PROCEDURE|FUNCTION
      mysql-test/t/sp-error.test:
        Added IF EXISTS to DROP PROCEDURE|FUNCTION
      sql/sp_pcontext.cc:
        Changed another unecessary use of Item_string into LEX_STRING.
      sql/sp_pcontext.h:
        Changed another unecessary use of Item_string into LEX_STRING.
      sql/sql_parse.cc:
        Added IF EXISTS to DROP PROCEDURE|FUNCTION
      sql/sql_yacc.yy:
        Added IF EXISTS to DROP PROCEDURE|FUNCTION
      3946b823
  24. 17 Dec, 2002 1 commit
    • unknown's avatar
      Added parsing of CASE (both generic and "simple"). · b12330b3
      unknown authored
      sql/sp_head.cc:
        Init. the simple_case flag.
      sql/sp_head.h:
        New flag for (simple)case parsing.
      sql/sp_pcontext.cc:
        Removed push_gen_label method (not needed any more).
      sql/sp_pcontext.h:
        Removed push_gen_label method (not needed any more).
        Fixed bug in pop().
      sql/sql_yacc.yy:
        Added CASE parsing.
      b12330b3
  25. 16 Dec, 2002 1 commit
    • unknown's avatar
      Fixed the broken backpatching implementation. · f6611aa0
      unknown authored
      Implemented IF-THEN-ELSE.
      
      
      sql/sp_head.cc:
        Reimplemented the broken backpatching, so it works for nested constructions and
        IF-THEN-ELSE too.
      sql/sp_head.h:
        Reimplemented the broken backpatching, so it works for nested constructions and
        IF-THEN-ELSE too.
      sql/sp_pcontext.cc:
        Return the value from push-methods, for convenience.
      sql/sp_pcontext.h:
        Return the value from push-methods, for convenience.
      sql/sql_yacc.yy:
        Implemented IF-THEN-ELSE.
        Corrected for the new backpatch method.
      f6611aa0
  26. 12 Dec, 2002 1 commit
    • unknown's avatar
      Moved create/find/drop functions to a separate files (sp.cc,sp.h). · b1b62274
      unknown authored
      Fixed backpatching of forward jumps.
      Implemented LOOP, WHILE, REPEAT (temporarily known as SPREPEAT).
      
      Known bug: Expression evaluation still not quite ok (e.g. "x > 0"),
      which is why IF and CASE is not yet implemented.
      
      
      sql/Makefile.am:
        Added new sp.h/sp.cc file.
      sql/item.h:
        New deferred result_type() method in Item_splocal.
      sql/lex.h:
        Temporary fix until REPEAT conflict is solved. Use SPREPEAT for now.
      sql/sp_head.cc:
        Moved create/find/drop functions to sp.cc.
        Fixed the backpatch stuff.
        (Also removed some dead code and updated comments.)
      sql/sp_head.h:
        Moved create/find/drop declarations to sp.h.
        Fixed the backpatch stuff.
      sql/sp_pcontext.h:
        New method: last_label().
      sql/sql_parse.cc:
        Include sp.h.
      sql/sql_yacc.yy:
        Fixed backpatching of forward jumps.
        Implemented LOOP, WHILE, and REPEAT. (Note: SPREPEAT for now.)
      b1b62274
  27. 11 Dec, 2002 1 commit
    • unknown's avatar
      Fixed bugs in the parameter evaluation and modified the execution engine · 37ce17e2
      unknown authored
      for better jump support. Some flow control support added too (but not
      complete).
      
      
      sql/lex.h:
        Added more keywords for embedded SQL.
      sql/sp_head.cc:
        Fixed bugs in the parameter evaluation.
        Modified execute() for better jump support.
        Added jump instruction and backpatch support.
      sql/sp_head.h:
        Fixed bugs in the parameter evaluation.
        Modified execute() for better jump support.
        Added jump instruction and backpatch support.
      sql/sp_pcontext.cc:
        Added label support.
      sql/sp_pcontext.h:
        Added label support.
      sql/sql_yacc.yy:
        Outlined flow control constructs (parses, but nothing generated yet).
      37ce17e2
  28. 08 Dec, 2002 1 commit
    • unknown's avatar
      Simplistic, experimental framework for Stored Procedures (SPs). · 27de9ece
      unknown authored
      Implements creation and dropping of PROCEDUREs, IN, OUT, and INOUT parameters,
      single-statement procedures, rudimentary multi-statement (begin-end) prodedures
      (when the client can handle it), and local variables.
      Missing most of the embedded SQL language, all attributes, FUNCTIONs, error handling,
      reparses procedures at each call (no caching), etc, etc.
      Certainly buggy too, but procedures can actually be created and called....
      
      
      sql/Makefile.am:
        Added SP files.
      sql/item.cc:
        Added this*_item() methods for Item_splocal. (SP local variable)
      sql/item.h:
        Added this*_item() methods for SPs in Item, and the new Item_splocal
        class (SP local variable).
      sql/lex.h:
        Added new symbols for SPs. (Note: SPSET is temporary and will go away later.)
      sql/sql_class.cc:
        Initialize SP runtime context in THD.
      sql/sql_class.h:
        Add SP runtime context to THD.
      sql/sql_lex.cc:
        Init. buf pointer to beginning of command (needed by SPs).
        Also initialize SP head and parse time context.
      sql/sql_lex.h:
        New SQLCOM_ tags for SPs, and added pointer to beginning of command pointer and
        SP head and parse-time context to LEX.
      sql/sql_parse.cc:
        Added SQLCOM_CREATE_PROCEDURE, _CALL, _ALTER_PROCEDURE and _DROP_PROCEDURE cases.
        (Still rudimentary and lacking proper error handling...)
      sql/sql_yacc.yy:
        Lots and lots of additions for SPs...
        (Still even more missing, and no error messages...)
      27de9ece