An error occurred fetching the project authors.
  1. 26 Jan, 2006 1 commit
    • unknown's avatar
      Fixed on BUG#16568: Continue handler with simple CASE not working correctly · 0e573af3
      unknown authored
        After trying multiple inheritance (to messy and hard make it work) and
        sublassing jump_if_not (worked, but ugly), decided to on this solution
        instead:
        Inserting an abstract sp_instr_opt_meta class as parent for all instructions
        with destinations makes it possible to handle a continuation pointer for
        sp_instr_set_case_expr too.
        Note: No special test case; the fix is captured by the changed behaviour of
        bug14643_2, and bug14498_4 (formerly disabled), in sp.test.
      
      
      mysql-test/r/sp.result:
        Updated results for BUG#16568 (affects results for bug14643_2 and bug14498_4)
      mysql-test/t/sp.test:
        Enabled test bug14498_4 for BUG#16568.
      sql/sp_head.cc:
        Changed type of some parameters and variables (sp_instr_opt_meta instead of sp_instr_jump*).
        Added consistency check of m_ip member in instructions in sp_head::show_routine_code().
        Updated print() method of, and added opt_mark() and opt_move() methods to
        sp_instr_set_case_expr, to handle the new continuation destination.
      sql/sp_head.h:
        New abstract class between sp_instr and instructions with destinations, in particular
        sp_instr_set_case_expr, for continuation destination handling.
        Changed type of some parameters and variables (sp_instr_opt_meta instead of sp_instr_jump*).
        Added opt_mark(), opt_move() and set_destination() methods to
        sp_instr_set_case_expr.
      sql/sql_parse.cc:
        Fixed small bug at show_routine_code() call (tested return value the wrong way).
      sql/sql_yacc.yy:
        sp_instr_set_case_expr is now added to backpatch list (for the new cont. destination).
      0e573af3
  2. 25 Jan, 2006 1 commit
    • unknown's avatar
      Fixed BUGS#15011: error handler for mysql errno in nested block not activated · bc59226d
      unknown authored
        For nested sql errno handlers (unlike sqlexception and other), we didn't stop
        searching when the innermost handler was found - now make sure we do.
      
      
      mysql-test/r/sp.result:
        Updated result for BUG#15011.
      mysql-test/t/sp.test:
        New testcase for BUG#15011.
      sql/sp_rcontext.cc:
        Make sure we stop at the innermost sql_errno handler.
      bc59226d
  3. 20 Jan, 2006 1 commit
  4. 19 Jan, 2006 1 commit
    • unknown's avatar
      Fixed BUG#15866: Thread stack limit insufficient for recursive call "fib(20)" · 32a8ab2f
      unknown authored
        Lowered the parameter to 10, and also renamed non-standard table names to t3.
      
      
      mysql-test/r/sp.result:
        Updated results.
      mysql-test/r/sp_trans.result:
        Updated results.
      mysql-test/t/sp.test:
        Renamed fac, primes and fib tables to t3.
        Lowered fib() test parameter to 10 (20 hit the stack overrun check on some machines).
      mysql-test/t/sp_trans.test:
        Added drop of t3 for safety. (Might be left from sp.test after certain test failures.)
      32a8ab2f
  5. 16 Jan, 2006 1 commit
    • unknown's avatar
      Post-merge fixes (BUG#14498) · 6dcd4a0f
      unknown authored
      mysql-test/r/sp-code.result:
        Post-merge fix; updated result.
      mysql-test/t/sp.test:
        Post-merge fix; added comment (still can't call bug14498_4 test)
      6dcd4a0f
  6. 12 Jan, 2006 1 commit
    • unknown's avatar
      Fix for bug #12198 "Temporary table aliasing does not work inside stored · 24fe8535
      unknown authored
      functions".
      
      We should ignore alias when we check if table was already marked as temporary
      when we calculate set of tables to be prelocked. Otherwise we will erroneously
      treat tables which are used in same routine and have same name but different
      alias as non-temporary.
      
      
      mysql-test/r/sp.result:
        Added test for bug #12198 "Temporary table aliasing does not work inside stored
        functions" and other tests which cover handling of temporary tables in prelocked
        mode.
      mysql-test/t/sp.test:
        Added test for bug #12198 "Temporary table aliasing does not work inside stored
        functions" and other tests which cover handling of temporary tables in prelocked
        mode.
      sql/sp_head.cc:
        sp_head::merge_table_list():
          We should ignore alias when we check if table was already marked as temporary
          when we calculate set of tables to be prelocked. Otherwise we will erroneously
          treat tables which are used in same routine and have same name but different
          alias as non-temporary.
      24fe8535
  7. 13 Dec, 2005 2 commits
    • unknown's avatar
      Added bug synopsis in comment for sp.test case BUG#15231. · 31ee5d9d
      unknown authored
      mysql-test/t/sp.test:
        Added bug synopsis in comment for test case BUG#15231.
      31ee5d9d
    • unknown's avatar
      Fixed BUG#15231: Stored procedure bug with not found condition handler · 93244290
      unknown authored
        Make the distinction between "exception conditions" and "completion
        conditions" (warning and "no data") as defined by the standard. The latter
        should not terminate a routine if no handler is found in the lexical scope.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#15231.
        Moved part of the test for BUG#7049 to the new testcase (since it was actually
        an example of 15231).
      mysql-test/t/sp.test:
        New test case for BUG#15231.
        Moved part of the test for BUG#7049 to the new testcase (since it was actually
        an example of 15231).
      sql/sp_rcontext.cc:
        Only search for matching condition handlers in caller's contexts if it's
        an exception conditition.
      93244290
  8. 08 Dec, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#15441 "Running SP causes Server · 48a6232a
      unknown authored
      to Crash": the bug was that due to non-standard name
      resolution precedence in stored procedures (See Bug#5967)
      a stored procedure variable took precedence over a table column
      when the arguments for VALUES() function were resolved.
      The implementation of VALUES() function was not designed to work
      with Item_splocal and crashed.
      VALUES() function is non-standard. It can refer to, and
      is meaningful for, table columns only. The patch disables SP 
      variables as possible arguments of VALUES() function.
      
      
      mysql-test/r/sp.result:
        Test results fixed (Bug#15441).
        Also make sure that the recently added test cases follow sp.test
        internal tests standard.
      mysql-test/t/sp.test:
        Add a test case for Bug#15441 "Running SP causes Server to Crash".
      sql/item.cc:
        Cleanup Item_insert_value::fix_fields().
      sql/item.h:
        Add a comment for Item_insert_value.
      sql/sql_yacc.yy:
        Actual fix for Bug#15441 "Running SP causes Server to Crash":
        we should not allow VALUES() function to reference SP variables.
      48a6232a
  9. 07 Dec, 2005 1 commit
    • unknown's avatar
      Patch for WL#2894: Make stored routine variables work · 66ce27ca
      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.
      66ce27ca
  10. 06 Dec, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#15392 "Server crashes during · 5bb5f523
      unknown authored
       prepared statement execute
      
      
      mysql-test/r/sp.result:
        Test results fixed: a fix for Bug#15392
      mysql-test/t/sp.test:
        A test case for Bug#15392 "Server crashes during prepared
        statement execute". No test case for error in
        Item_func_set_user_var::update as the only possible one is OOM.
      sql/sp_head.cc:
        A fix for Bug#15392 "Server crashes during prepared statement
        execute": the bug was caused by mysql_change_db() call
        which was overwriting the error state of 'ret'.
        Later in the code, suv->fix_fields() would discover
        thd->net.report_error and return it without completing
        its work. As the return value of fix_fields() was ignored,
        the server would afterwards crash in suv->update().
        The fix makes sure that a possible internal error
        is raised in reset_lex_and_exec_core and then is
        handled in sp_head::execute_procedure.
      5bb5f523
  11. 03 Dec, 2005 1 commit
    • unknown's avatar
      this has nothing to do with the bug#13012. · 6506ce3b
      unknown authored
      it's about mysql_admin_commands not being reexecution-safe
      (and CHECK still isn't)
      
      
      mysql-test/r/sp-error.result:
        optimize is now allowed in SP
      mysql-test/r/sp.result:
        test repair/optimize/analyze in SP
      mysql-test/t/backup.test:
        clean up after itself
      mysql-test/t/sp-error.test:
        optimize is now allowed in SP
      mysql-test/t/sp.test:
        test repair/optimize/analyze in SP
      sql/sp_head.cc:
        all mysql_admin commands return result set
      sql/sql_parse.cc:
        all mysql_admin commands modify table list and we should restore it for SP
      sql/sql_table.cc:
        optimization - don't execute views when no view is expected/allowed
      sql/sql_yacc.yy:
        optimize is now allowed in SP
      6506ce3b
  12. 02 Dec, 2005 2 commits
  13. 01 Dec, 2005 1 commit
    • unknown's avatar
      Fix for bug #14304: auto_increment field incorrect set from within stored... · 506a2b6b
      unknown authored
      Fix for bug #14304: auto_increment field incorrect set from within stored procedure (insert select).
      
      
      sql/sp_head.cc:
        Fix for bug #14304: auto_increment field incorrect set from within stored procedure (insert select).
        - call thd->cleanup_after_query() to clean next_insert_id.
      sql/sql_class.cc:
        Fix for bug #14304: auto_increment field incorrect set from within stored procedure (insert select).
        - save/restore clear_next_insert_id
      sql/sql_class.h:
        Fix for bug #14304: auto_increment field incorrect set from within stored procedure (insert select).
        - clear_next_insert_id added
      506a2b6b
  14. 26 Nov, 2005 1 commit
    • unknown's avatar
      Enabled back bunch of tests for stored routines which were disabled · ef64e212
      unknown authored
      earlier because of various features/checks missing (these features/checks
      are now implemented).
      
      
      mysql-test/r/sp.result:
        Enabled back bunch of tests which were previously disabled because of various
        features/checks missing (since these features/checks are now implemented).
      mysql-test/t/sp.test:
        Enabled back bunch of tests which were previously disabled because of various
        features/checks missing (since these features/checks are now implemented).
      ef64e212
  15. 24 Nov, 2005 1 commit
  16. 23 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#13729 Stored procedures: packet error after exception handled · 4fa4d384
      unknown authored
        Don't set thd->is_fatal_error in sql_update for duplicate key errors.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#13729.
      mysql-test/r/sp_trans.result:
        New test case for BUG#14840.
      mysql-test/t/sp.test:
        New test case for BUG#13729.
      mysql-test/t/sp_trans.test:
        New test case for BUG#14840.
      sql/sql_update.cc:
        Don't set thd->is_fatal_error if it's a duplicate key error.
      4fa4d384
  17. 22 Nov, 2005 2 commits
    • unknown's avatar
      Recursion support made for SP (BUG#10100). · d0645e35
      unknown authored
      client/mysqltest.c:
        An expected error messages hiding from the log if disable_result_log is in force.
      mysql-test/r/sp-dynamic.result:
        The test expanded for case of allowed/disalowed recursion.
      mysql-test/r/sp-error.result:
        Error messages changed.
        Test of bug11394() made with allowed recursion.
      mysql-test/r/sp.result:
        Tests for recursion.
      mysql-test/r/trigger.result:
        Check that triggers are not affected by this patch.
      mysql-test/r/variables.result:
        Test of max_sp_recursion_depth variable.
      mysql-test/t/sp-dynamic.test:
        The test expanded for case of allowed/disalowed recursion.
      mysql-test/t/sp-error.test:
        Error messages changed.
        Test of bug11394() made with allowed recursion.
      mysql-test/t/sp.test:
        Tests for recursion.
      mysql-test/t/trigger.test:
        Check that triggers are not affected by this patch.
      mysql-test/t/variables.test:
        Test of max_sp_recursion_depth variable.
      sql/item_func.cc:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
      sql/mysqld.cc:
        max_sp_recursion_depth variable added.
      sql/set_var.cc:
        max_sp_recursion_depth variable added.
      sql/share/errmsg.txt:
        An error message changed.
        An error message added.
      sql/sp.cc:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
        Temory LEX is allocated on a stack, not on a heap.
        Recursion support added for stored procedures.
      sql/sp.h:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
      sql/sp_head.cc:
        Initialization of new sp_head fields to get correct list of instances
          contained one instance only.
        Stack requirement for SP instruction is increased.
        Stack free space is checked before mem root initialisation to avoid
          memory leak.
        Pointer to the free instance management added before and after
          SP execution.
      sql/sp_head.h:
        New sp_head variables added to support inst of instances of SP
          for recursion and pointer on ths first free to use instance.
      sql/sql_base.cc:
        open_table() consume a lot of stack space so we check free stack space before it.
      sql/sql_class.h:
        max_sp_recursion_depth variable added.
      sql/sql_parse.cc:
        sp_find_function() and sp_find_procedure() joined to sp_find_routine()
          function as it was mentioned in TODO.
      d0645e35
    • unknown's avatar
      Fix for BUG#13549 "Server crash with nested stored procedures · 8152a78f
      unknown authored
      if inner routine has more local variables than outer one, and
      one of its last variables was used as argument to NOT operator".
      
      THD::spcont was non-0 when we were parsing stored routine/trigger
      definition during execution of another stored routine. This confused
      methods of Item_splocal and forced them use wrong runtime context.
      Fix ensures that we always have THD::spcont equal to zero during
      routine/trigger body parsing. This also allows to avoid problems
      with errors which occur during parsing and SQL exception handlers.
      
      
      mysql-test/r/sp.result:
        Test suite for bug#13549.
      mysql-test/r/trigger.result:
        Test suite for bug#13549.
      mysql-test/t/sp.test:
        Test suite for bug#13549.
      mysql-test/t/trigger.test:
        Test suite for bug#13549.
      sql/item.cc:
        Protection against using wrong context by SP local variable.
      sql/item.h:
        Protection against using wrong context by SP local variable.
      sql/protocol.cc:
        An incorrect macro name fixed.
      sql/protocol.h:
        An incorrect macro name fixed.
      sql/sp.cc:
        Do not allow SP which we are parsing to use other SP
        context (BUG#13549).
      sql/sp_head.cc:
        Protection against using wrong context by SP local variable.
      sql/sp_rcontext.h:
        Protection against using wrong context by SP local variable.
      sql/sql_cache.h:
        An incorrect macro name fixed.
      sql/sql_class.cc:
        Protection against using wrong context by SP local variable.
      sql/sql_class.h:
        Protection against using wrong context by SP local variable.
      sql/sql_trigger.cc:
        Do not allow Trigger which we are parsing to use
        other SP context (BUG#13549).
      sql/sql_yacc.yy:
        Protection against using wrong context by SP local variable.
      8152a78f
  18. 18 Nov, 2005 1 commit
  19. 15 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14723: Dumping of stored functions seems to cause corruption · 7f39ba7d
      unknown authored
                       in the function body
        Changed the way the end of query was found from the lex state.
        The routine body was not extracted correctly when using the
        /*!version ... */ wrapper (in dump files); for some types of routines
        (e.g. with a label at the first begin), the trailing "*/" was not skipped.
        This is a recommit for the 5.0.16-release tree.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#14723.
      mysql-test/t/sp.test:
        New test case for BUG#14723.
      sql/sp_head.cc:
        Changed the way the end of the definition and body is found from the lex state.
        In the case of /*!version */ wrappers we must take the trailing " */" into account.
      7f39ba7d
  20. 11 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14723: Dumping of stored functions seems to cause corruption · 14e74e4a
      unknown authored
                       in the function body
        Changed the way the end of query was found from the lex state.
        The routine body was not extracted correctly when using the
        /*!version ... */ wrapper (in dump files); for some types of routines
        (e.g. with a label at the first begin), the trailing "*/" was not skipped.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#14723.
      mysql-test/t/sp.test:
        New test case for BUG#14723.
      sql/sp_head.cc:
        Changed the way the end of the definition and body is found from the lex state.
        In the case of /*!version */ wrappers we must take the trailing " */" into account.
      14e74e4a
  21. 08 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14643: Stored Procedure: Continuing after failed var. · fa2be8d6
      unknown authored
                       initialization crashes server.
        Make sure variables are initialized to something (like null) when
        the default initialization fails and a continue handler is in effect.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#14643.
      mysql-test/t/sp.test:
        New test case for BUG#14643.
      sql/sp_head.cc:
        Make sure variables are initialized to something (like null) when
        the default initialization fails and a continue handler is in effect.
        If this also fails (out of memory), we have to abort without letting
        the handler catch.
      fa2be8d6
  22. 04 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14498: Stored procedures: hang if undefined variable and exception · 84ac5c13
      unknown authored
        The problem was to continue at the right place in the code after the
        test expression in a flow control statement fails with an exception
        (internally, the test in sp_instr_jump_if_not), and the exception is
        caught by a continue handler. Execution must then be resumed after the
        the entire flow control statement (END IF, END WHILE, etc).
      
      
      mysql-test/r/sp.result:
        New test case for BUG#14498.
      mysql-test/t/sp.test:
        New test case for BUG#14498.
        (Note that one call is disabled at the moment. Depends on BUG#14643.)
      sql/sp_head.cc:
        Added a continuation destination for sp_instr_jump_if_not, for the case when
        an error in the test expression causes a continue handler to catch.
        This includes new members in sp_instr_jump_if_not, adjustment of the optmizer
        (mark and move methods), and separate backpatching code (since we can't use
        the normal one for this).
        
        Also removed the class sp_instr_jump, since it's never used.
        
        ...and added some comments to the optimizer.
      sql/sp_head.h:
        Added a continuation destination for sp_instr_jump_if_not, for the case when
        an error in the test expression causes a continue handler to catch.
        This includes new members in sp_instr_jump_if_not, adjustment of the optmizer
        (mark and move methods), and separate backpatching code (since we can't use
        the normal one for this).
        
        Also removed the class sp_instr_jump, since it's never used.
      sql/sql_yacc.yy:
        Added backpatching of the continue destination for all conditional statements
        (using sp_instr_jump_if_not).
      84ac5c13
  23. 03 Nov, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#14210 "Simple query with > operator on · e76aef36
      unknown authored
      large table gives server crash": make sure that when a MyISAM temporary
      table is created for a cursor, it's created in its memory root,
      not the memory root of the current query.
      
      
      mysql-test/r/sp.result:
        Test results fixed: a test case for Bug#14210
      mysql-test/t/sp.test:
        A test case for Bug#14210 "Simple query with > operator on large table 
        gives server crash"
      sql/handler.cc:
        - rewrite get_new_handler to accept a memory root and use it for
      sql/handler.h:
        - get_new_handler declaration changed
      sql/opt_range.cc:
        - get_new_handler declaration changed
      sql/sql_base.cc:
        - get_new_handler declaration changed
      sql/sql_select.cc:
        - the actual fix for Bug#14210. In create_myisam_from_heap we should
        create the new table handler in TABLE::mem_root, not in THD::mem_root:
        the latter is freed shortly after cursor is open.
        - adjust create_tmp_table to explicitly supply &table->mem_root
        to get_new_handler when creating a handler for a new temporary table
      sql/sql_table.cc:
        - get_new_handler declaration changed
      sql/table.cc:
        - get_new_handler declaration changed
      sql/unireg.cc:
        - get_new_handler declaration changed
      tests/mysql_client_test.c:
        A test case for Bug#14210 "Simple query with > operator on large table
         gives server crash": a C API test case is worth adding because of different
        memory allocation/freeing patterns in handling of C API and SP cursors
      e76aef36
  24. 01 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14376: MySQL crash on scoped variable (re)initialization · 12d4ff2a
      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.
      12d4ff2a
  25. 26 Oct, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14233: Crash after tampering with the mysql.proc table · 470ab9db
      unknown authored
        Added error checking for errors when attempting to use stored procedures
        after the mysql.proc table has been dropped, corrupted, or tampered with.
        Test cases were put in a separate file (sp-destruct.test).
      
      
      mysql-test/t/sp.test:
        Added comment.
      sql/share/errmsg.txt:
        New error message for corrupted mysql.proc table.
      sql/sp.cc:
        Check and return error code when caching stored routines.
        In the case when no error message has been set, set one.
      sql/sp.h:
        Return error code from stored routine cache function.
      sql/sql_base.cc:
        Check for error from sp_cache_routines_* calls.
      sql/sql_trigger.h:
        Updated friend declaration for sp_cache_routines*.
      mysql-test/r/sp-destruct.result:
        New test file for destruction of the mysql.proc table.
      mysql-test/t/sp-destruct.test:
        New result file for destruction of the mysql.proc table.
      470ab9db
  26. 24 Oct, 2005 1 commit
    • unknown's avatar
      Fix for BUG#13095: Cannot create VIEWs in prepared statements · b73a5f75
      unknown authored
        - allow CREATE VIEW as well as DROP VIEW to use in prepared statements;
        - fix CREATE VIEW implementation to make it work in prepared statements.
      
      
      mysql-test/r/sp.result:
        Results file for the test case for BUG#13095.
      mysql-test/t/sp.test:
        Test case for BUG#13095.
      sql/sql_lex.h:
        Added a variable to remember start of whole CREATE VIEW statement
        as well as start of its SELECT part.
      sql/sql_prepare.cc:
        Allow CREATE VIEW and DROP VIEW to use in prepared statements.
      sql/sql_view.cc:
        Use stored start of whole CREATE VIEW statement instead of thd->query,
        which differs from the original when prepared statement is executing.
      sql/sql_yacc.yy:
        Remember start of whole CREATE VIEW statement as well as start of its
        SELECT part.
      b73a5f75
  27. 19 Oct, 2005 1 commit
    • unknown's avatar
      Fixed BUG#13941: replace() string fuction behaves badly inside stored · 2e5d668d
      unknown authored
                       procedure
        For some functions returning strings (like "replace" and "ifnull" - where
        val_str() is returning a pointer into one of the parameters) - we ended
        up with a dangling pointer after the new operator destroyed the reuse item
        in the eval function.
        A working, if not very elegant, solution is to simply copy the string in
        such cases.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#13941.
      mysql-test/t/sp.test:
        New test case for BUG#13941.
      sql/sp_head.cc:
        Copy the string when evaluating some string functions (e.g. "replace" and "ifnull")
        to avoid using a dangling pointer.
      2e5d668d
  28. 16 Oct, 2005 1 commit
    • unknown's avatar
      sp-security.result, sp.result, sp-security.test, sp.test: · 6eddd561
      unknown authored
        Test for bug#12812 moved from sp.test to sp-security.test
      
      
      mysql-test/t/sp.test:
        Test for bug#12812 moved from sp.test to sp-security.test
      mysql-test/t/sp-security.test:
        Test for bug#12812 moved from sp.test to sp-security.test
      mysql-test/r/sp.result:
        Test for bug#12812 moved from sp.test to sp-security.test
      mysql-test/r/sp-security.result:
        Test for bug#12812 moved from sp.test to sp-security.test
      6eddd561
  29. 13 Oct, 2005 1 commit
    • unknown's avatar
      type_binary.result, type_binary.test: · af6b3562
      unknown authored
        new file
      mysql_fix_privilege_tables.sql, mysql_create_system_tables.sh:
        Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
      Many files:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
        Adding true BINARY/VARBINARY: new pad_char structure member.
      ctype-bin.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
        New strnxfrm, with two trailing length bytes.
      field.cc:
        Adding true BINARY/VARBINARY.
      
      
      sql/field.cc:
        Adding true BINARY/VARBINARY.
      strings/ctype-big5.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-bin.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
        New strnxfrm, with two trailing length bytes.
      strings/ctype-cp932.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-czech.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-euc_kr.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-eucjpms.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-extra.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-gb2312.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-gbk.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-latin1.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-simple.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-sjis.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-tis620.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-uca.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-ucs2.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-ujis.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-utf8.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      strings/ctype-win1250ch.c:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      include/m_ctype.h:
        Adding true BINARY/VARBINARY: new pad_char structure member.
      mysql-test/t/alter_table.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/binary.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/cast.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/ctype_cp1251.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/ctype_many.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/federated.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/func_in.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/ndb_condition_pushdown.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/ndb_types.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/sp.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/t/type_blob.test:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/alter_table.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/binary.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/cast.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/ctype_cp1251.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/ctype_many.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/federated.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/func_in.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/ndb_condition_pushdown.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/ndb_types.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/sp.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/system_mysql_db.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      mysql-test/r/type_blob.result:
        Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes.
      scripts/mysql_create_system_tables.sh:
        Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
      scripts/mysql_fix_privilege_tables.sql:
        Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
      af6b3562
  30. 27 Sep, 2005 1 commit
    • unknown's avatar
      Fixed BUG#12589: Assert when creating temp. table from decimal stored · afbcfd5b
      unknown authored
                       procedure variable
        Second version, after review.
        Keep the unsigned_flag in Item_decimal updated. Note that this also changed
        the result of several old test results - creating tables from decimal
        templates now gives unsigned columns and different sizes. (Several tests
        had Length > Max_length before.)
      
      
      mysql-test/r/case.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/metadata.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/ps_2myisam.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/ps_3innodb.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/ps_4heap.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/ps_5merge.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/ps_6bdb.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/ps_7ndb.result:
        Updated result (after fixing BUG#12589).
      mysql-test/r/sp.result:
        New test case for BUG#12589.
      mysql-test/r/type_newdecimal.result:
        Updated result (after fixing BUG#12589).
      mysql-test/t/sp.test:
        New test case for BUG#12589.
      sql/item.cc:
        Keep the unsigned_flag updated in Item_splocal and Item_decimal.
      afbcfd5b
  31. 26 Sep, 2005 2 commits
    • unknown's avatar
      Fixed BUG#7049: Stored procedure CALL errors are ignored · 9d7870a1
      unknown authored
        Search the chain of sp_rcontexts recursively for handlers. If one is found,
        it will be detected in the sp_head::execute() method at the corresponding
        level.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#7049.
        Note that the spurious warnings in the BUG#12379 test now are gone (as expected).
      mysql-test/t/sp.test:
        New test case for BUG#7049.
      sql/sp_head.cc:
        Link sp_rcontexts to allow catching errors across invokation boundaries.
        (Also fixed print method for the hreturn instruction.)
      sql/sp_rcontext.cc:
        Link sp_rcontexts to allow catching errors across invokation boundaries.
        If a handler is not found in the current sp_rcontext, recurse into the previous ones (if any).
      sql/sp_rcontext.h:
        Link sp_rcontexts to allow catching errors across invokation boundaries.
      9d7870a1
    • unknown's avatar
      Fixed BUG#6127: Stored procedure handlers within handlers don't work · 10a92d85
      unknown authored
          Replaced the dumb in-handler/not-in-handler check with a proper recursion
          check of handlers being executed.
          (Re-commit in a different tree, to make push possible.)
      
      
      mysql-test/r/sp.result:
        New test case for BUG#6127.
      mysql-test/t/sp.test:
        New test case for BUG#6127.
      sql/sp_head.cc:
        Replaced the setting of ctx->in_handler with a enter/exit handler methods.
      sql/sp_rcontext.cc:
        Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
      sql/sp_rcontext.h:
        Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
        (And added some comments in the sp_rcontext class.)
      10a92d85
  32. 19 Sep, 2005 1 commit
    • unknown's avatar
      Fix bug #12812 create view calling a function works without execute right on function · 3652f2f1
      unknown authored
      Execution rigths on function was checked just before function execution,
      thus it was unknown on prepare stage whether user have right to execute 
      particular function.
      
      Added access rights checking function which is called right after fixing
      Item_func_sp.
      This have additional effect that if user don't have rights for execution
      query will fail on earlier stage and will not waste resources on optimizing
      with failing on execution stage.
      
      
      sql/item_func.h:
        Fix bug#12812 create view calling a function works without execute right on function
      sql/item_func.cc:
        Fix bug#12812 create view calling a function works without execute right on function
        Added function Item_func_sp::check_access() which checks access rights.
        Added function Item_func_sp::fix_field() which calls check_access() after fixing.
        Item_func_sp::execute() now calls to check_access() to check access rights.
      mysql-test/t/sp.test:
        Test case for bug#12812 create view calling a function works without execute right on function
      mysql-test/r/sp.result:
        Test case for bug#12812 create view calling a function works without execute right on function
      3652f2f1
  33. 14 Sep, 2005 2 commits
  34. 13 Sep, 2005 2 commits
    • unknown's avatar
      after-merge fix · 11fe777a
      unknown authored
      11fe777a
    • unknown's avatar
      Fixed BUG#12379: PROCEDURE with HANDLER calling FUNCTION with error · 8c4c2f26
      unknown authored
                       get strange result
        according to Monty's suggestions, fixing the SELECT behaviour on errors
        with SP handlers. Note that some warnings from SELECT still shows up when
        the handler has caught - this is an effect of another known bug (BUG#7049).
      
      
      mysql-test/r/sp.result:
        New test cases for BUG#12379.
      mysql-test/t/sp.test:
        New test cases for BUG#12379.
      sql/sql_class.cc:
        Abort selects on errors more graceful with SP handlers.
      sql/sql_class.h:
        Abort selects on errors more graceful with SP handlers.
      8c4c2f26