An error occurred fetching the project authors.
  1. 11 Apr, 2006 1 commit
    • unknown's avatar
      Fixed BUG#18787: Server crashed when calling a stored procedure containing · 9381c8a0
      unknown authored
                       a misnamed function
        ... in the presence of a continue handler. The problem was that with a
        handler, it continued to execute as if function existed and had set a
        useful return value (which it hadn't).
        The fix is to set a null return value and do an error return when a function
        wasn't found.
      
      
      mysql-test/r/sp.result:
        Updated results for a new test case (BUG#18787).
      mysql-test/t/sp.test:
        New testcase for BUG#18787.
      sql/item_func.cc:
        Don't set "out of resources" error in Item_func_sp::execute() if no
        result field is returned, it's simply wrong, it can be sometthing else,
        like a function not found. Instead set null_value and return error.
        Also, set "out of resources" when field creation fails in
        Item_func_sp::sp_result_field() and Item_func_sp::tmp_table_field().
      9381c8a0
  2. 28 Mar, 2006 1 commit
    • unknown's avatar
      Post review fixes for BUG#16474: SP crashed MySQL. · 537ec1e6
      unknown authored
      mysql-test/r/ps.result:
        Added test coverage for "order by" in prepared statements (related to BUG#16474).
      mysql-test/r/sp.result:
        Added reference to test case for BUG#16474.
      mysql-test/t/ps.test:
        Added test coverage for "order by" in prepared statements (related to BUG#16474).
      mysql-test/t/sp.test:
        Added reference to test case for BUG#16474.
      sql/sql_select.cc:
        Fixed comment and test for basic_const_item() instead of is_splocal().
      537ec1e6
  3. 10 Mar, 2006 2 commits
    • unknown's avatar
      Fixed BUG#16474: SP crashed MySQL · fb36d923
      unknown authored
        fix_fields() was not called for "order by" variables if the type was a
        "constant integer", and thus interpreted as a column index.
        However, a local variable is an expression and should not be interpreted
        as a column index. Instead it behaves just like when using a user variable
        for instance (i.e. it will not affect the ordering).
      
      
      
      mysql-test/r/sp.result:
        Updated results for new test case (BUG#16474).
      mysql-test/t/sp.test:
        New test case for BUG#16474.
      sql/sql_select.cc:
        When processing order list,
      fb36d923
    • unknown's avatar
      Fixed bug#13575: SP funcs in select with distinct/group and order by can · 50c8c206
      unknown authored
      produce wrong data
      
      By default Item_sp_func::val_str() returns string from it's result_field 
      internal buffer. When grouping is present Item_copy_string is used to 
      store SP function result, but it doesn't additionally buffer the result.
      When the next record is read, internal buffer is overwritten, due to
      this Item_copy_string::val_str() will have wrong data. Thus producing
      weird query result.
      
      The Item_func_sp::val_str() now makes a copy of returned value to prevent
      occasional corruption.
      
      
      mysql-test/t/sp.test:
        Added test case for bug#13575: SP funcs in select with distinct/group and order by can
        produce wrong data
      mysql-test/r/sp.result:
        Added test case for bug#13575: SP funcs in select with distinct/group and
            order by can produce wrong data
      sql/item_func.h:
        Fixed bug#13575: SP funcs in select with distinct/group and order by can
            produce wrong data
            The Item_func_sp::val_str() now makes a copy of returned value to prevent
            occasinal corruption.
      50c8c206
  4. 09 Mar, 2006 1 commit
    • unknown's avatar
      Bug#10656 Stored Procedure - Create index and Truncate table command error · 2acff5c3
      unknown authored
       -Add test case
      Move testcase that needs innodb from sp.test => sp_trans.test 
      
      
      mysql-test/r/sp.result:
        Move test cases tyhat requires innodb to sp_trans.test
      mysql-test/r/sp_trans.result:
        Move test cases tyhat requires innodb to sp_trans.test
        Add test case for bug#10656
      mysql-test/t/sp.test:
        Move test cases tyhat requires innodb to sp_trans.test
      mysql-test/t/sp_trans.test:
        Add test case for bug#10656
        Move test cases that require innodb to sp_trans.test
      2acff5c3
  5. 02 Mar, 2006 2 commits
    • unknown's avatar
      Fixed BUG#17476: Stored procedure not returning data when it is called first · 7865ce61
      unknown authored
                       time per connection
        Removed const_string() method from Item_string (it was only used in one
        place, in a bad way). Defer possible SP variable, and access data directly
        instead, in date_format item.
      
      
      mysql-test/r/sp.result:
        Updated results for new test (BUG#17476).
      mysql-test/t/sp.test:
        New test case (BUG#17476)
      sql/item.h:
        Removed const_string() from Item_string.
        It was only used in one place, and we can just use str_value in Item directly.
      sql/item_timefunc.cc:
        Must defer a (possible) local SP variable to use max_length and str_value
        in Item_func_date_format::fix_length_and_dec(), and refer to str_value
        directly without the const_string() method (now removed); the cast didn't
        work in all cases anyway.
      7865ce61
    • unknown's avatar
      Fix for bug #17615: invalid handling of function results in UPDATE...SET statement. · 6ea2c3cd
      unknown authored
      sql/item_func.cc:
        Fix for bug #17615: invalid handling of function results in UPDATE...SET statement.
        - set proper collation
      6ea2c3cd
  6. 24 Feb, 2006 1 commit
    • unknown's avatar
      Fixes to embedded server to be able to run tests with it · 0afb6ff6
      unknown authored
      (Needed for "list of pushes" web page and autopush)
      
      
      include/mysql.h:
        Fix to embedded server to be able to run tests on it
      libmysql/libmysql.c:
        Fix to embedded server to be able to run tests on it
      libmysqld/emb_qcache.cc:
        Fix to embedded server to be able to run tests on it
      libmysqld/embedded_priv.h:
        Fix to embedded server to be able to run tests on it
      libmysqld/lib_sql.cc:
        Fix to embedded server to be able to run tests on it
      libmysqld/libmysqld.c:
        Fix to embedded server to be able to run tests on it
      mysql-test/mysql-test-run.sh:
        Fix to embedded server to be able to run tests on it
      mysql-test/r/binlog.result:
        Updated test for embedded server
      mysql-test/r/ctype_cp932.result:
        Updated test for embedded server
      mysql-test/r/innodb.result:
        Updated test for embedded server
      mysql-test/r/mysqltest.result:
        Updated test for embedded server
      mysql-test/r/query_cache.result:
        Updated test for embedded server
      mysql-test/r/query_cache_notembedded.result:
        Updated test for embedded server
      mysql-test/r/sp-error.result:
        Updated test for embedded server
      mysql-test/r/sp.result:
        Updated test for embedded server
      mysql-test/r/subselect.result:
        Updated test for embedded server
      mysql-test/r/view.result:
        Updated test for embedded server
      mysql-test/r/view_grant.result:
        Updated test for embedded server
      mysql-test/t/backup.test:
        Updated test for embedded server
      mysql-test/t/binlog.test:
        Updated test for embedded server
      mysql-test/t/blackhole.test:
        Updated test for embedded server
      mysql-test/t/compress.test:
        Updated test for embedded server
      mysql-test/t/ctype_cp932.test:
        Updated test for embedded server
      mysql-test/t/delayed.test:
        Updated test for embedded server
      mysql-test/t/handler.test:
        Updated test for embedded server
      mysql-test/t/innodb.test:
        Updated test for embedded server
      mysql-test/t/mysql.test:
        Updated test for embedded server
      mysql-test/t/mysql_client_test.test:
        Updated test for embedded server
      mysql-test/t/mysqltest.test:
        Updated test for embedded server
      mysql-test/t/query_cache.test:
        Updated test for embedded server
      mysql-test/t/query_cache_notembedded.test:
        Updated test for embedded server
      mysql-test/t/read_only.test:
        Updated test for embedded server
      mysql-test/t/skip_grants.test:
        Updated test for embedded server
      mysql-test/t/sp-destruct.test:
        Updated test for embedded server
      mysql-test/t/sp-error.test:
        Updated test for embedded server
      mysql-test/t/sp-threads.test:
        Updated test for embedded server
      mysql-test/t/sp.test:
        Updated test for embedded server
      mysql-test/t/subselect.test:
        Updated test for embedded server
      mysql-test/t/temp_table.test:
        Updated test for embedded server
      mysql-test/t/view.test:
        Updated test for embedded server
      mysql-test/t/view_grant.test:
        Updated test for embedded server
      mysql-test/t/wait_timeout.test:
        Updated test for embedded server
      mysys/mf_dirname.c:
        Review fix: Don't access data outside of array
      mysys/my_bitmap.c:
        Remove compiler warnings
      scripts/mysql_fix_privilege_tables.sql:
        Add flush privileges to .sql script so that one doesn't have to reboot mysqld when one runs the mysql_fix_privilege_script
      sql-common/client.c:
        Updated test for embedded server
      sql/item.cc:
        Remove DBUG_PRINT statement that can cause crashes when running with --debug
      sql/mysqld.cc:
        Fix to embedded server to be able to run tests on it
      sql/protocol.cc:
        Fix to embedded server to be able to run tests on it
        (Trivial reconstruction of code)
      sql/protocol.h:
        Fix to embedded server to be able to run tests on it
      sql/sql_base.cc:
        Better comment
      sql/sql_class.cc:
        Fix to embedded server to be able to run tests on it
      sql/sql_class.h:
        Fix to embedded server to be able to run tests on it
      sql/sql_cursor.cc:
        Fix to embedded server to be able to run tests on it
      sql/sql_parse.cc:
        Fix to embedded server to be able to run tests on it
        Don't crash for disabled commands when using embedded server
      sql/sql_prepare.cc:
        Fix to embedded server to be able to run tests on it
      mysql-test/r/ctype_cp932_notembedded.result:
        New BitKeeper file ``mysql-test/r/ctype_cp932_notembedded.result''
      mysql-test/r/innodb_notembedded.result:
        New BitKeeper file ``mysql-test/r/innodb_notembedded.result''
      mysql-test/r/sp.result.orig:
        New BitKeeper file ``mysql-test/r/sp.result.orig''
      mysql-test/r/sp_notembedded.result:
        New BitKeeper file ``mysql-test/r/sp_notembedded.result''
      mysql-test/r/subselect_notembedded.result:
        New BitKeeper file ``mysql-test/r/subselect_notembedded.result''
      mysql-test/t/ctype_cp932_notembedded.test:
        New BitKeeper file ``mysql-test/t/ctype_cp932_notembedded.test''
      mysql-test/t/innodb_notembedded.test:
        New BitKeeper file ``mysql-test/t/innodb_notembedded.test''
      mysql-test/t/sp.test.orig:
        New BitKeeper file ``mysql-test/t/sp.test.orig''
      mysql-test/t/sp_notembedded.test:
        New BitKeeper file ``mysql-test/t/sp_notembedded.test''
      mysql-test/t/subselect_notembedded.test:
        New BitKeeper file ``mysql-test/t/subselect_notembedded.test''
      0afb6ff6
  7. 16 Feb, 2006 1 commit
  8. 15 Feb, 2006 2 commits
    • unknown's avatar
      Additional tests for nested handlers added to sp.test. · 4628da29
      unknown authored
      A follow-up to BUG#15011 (already fixed).
      
      
      mysql-test/r/sp.result:
        Updated results for new handler tests.
      mysql-test/t/sp.test:
        Additional tests for nested handlers.
      4628da29
    • 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
  9. 26 Jan, 2006 1 commit
    • unknown's avatar
      Fixed on BUG#16568: Continue handler with simple CASE not working correctly · af187fa2
      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).
      af187fa2
  10. 25 Jan, 2006 1 commit
    • unknown's avatar
      Fixed BUGS#15011: error handler for mysql errno in nested block not activated · cc037976
      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.
      cc037976
  11. 20 Jan, 2006 1 commit
  12. 19 Jan, 2006 1 commit
    • unknown's avatar
      Fixed BUG#15866: Thread stack limit insufficient for recursive call "fib(20)" · 7fc2604c
      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.)
      7fc2604c
  13. 16 Jan, 2006 1 commit
    • unknown's avatar
      Post-merge fixes (BUG#14498) · c5216f4e
      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)
      c5216f4e
  14. 12 Jan, 2006 1 commit
    • unknown's avatar
      Fix for bug #12198 "Temporary table aliasing does not work inside stored · c12a3dfe
      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.
      c12a3dfe
  15. 13 Dec, 2005 2 commits
    • unknown's avatar
      Added bug synopsis in comment for sp.test case BUG#15231. · 2111e203
      unknown authored
      mysql-test/t/sp.test:
        Added bug synopsis in comment for test case BUG#15231.
      2111e203
    • unknown's avatar
      Fixed BUG#15231: Stored procedure bug with not found condition handler · 5e84bbcb
      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.
      5e84bbcb
  16. 08 Dec, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#15441 "Running SP causes Server · 9c4985de
      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.
      9c4985de
  17. 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
  18. 06 Dec, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#15392 "Server crashes during · 8c2d8ac7
      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.
      8c2d8ac7
  19. 03 Dec, 2005 1 commit
    • unknown's avatar
      this has nothing to do with the bug#13012. · da8b9967
      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
      da8b9967
  20. 02 Dec, 2005 2 commits
  21. 01 Dec, 2005 1 commit
    • unknown's avatar
      Fix for bug #14304: auto_increment field incorrect set from within stored... · f853fbc9
      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
      f853fbc9
  22. 26 Nov, 2005 1 commit
    • unknown's avatar
      Enabled back bunch of tests for stored routines which were disabled · 06887bc3
      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).
      06887bc3
  23. 24 Nov, 2005 1 commit
  24. 23 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#13729 Stored procedures: packet error after exception handled · b1182823
      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.
      b1182823
  25. 22 Nov, 2005 2 commits
    • unknown's avatar
      Recursion support made for SP (BUG#10100). · 164ce4c5
      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.
      164ce4c5
    • unknown's avatar
      Fix for BUG#13549 "Server crash with nested stored procedures · 6574612d
      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.
      6574612d
  26. 18 Nov, 2005 1 commit
  27. 15 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14723: Dumping of stored functions seems to cause corruption · 738038e7
      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.
      738038e7
  28. 11 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14723: Dumping of stored functions seems to cause corruption · 425207c9
      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.
      425207c9
  29. 08 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14643: Stored Procedure: Continuing after failed var. · 850cfe78
      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.
      850cfe78
  30. 04 Nov, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14498: Stored procedures: hang if undefined variable and exception · 898adb8c
      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).
      898adb8c
  31. 03 Nov, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#14210 "Simple query with > operator on · 3fa0dd23
      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
      3fa0dd23
  32. 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
  33. 26 Oct, 2005 1 commit
    • unknown's avatar
      Fixed BUG#14233: Crash after tampering with the mysql.proc table · 9349f18b
      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.
      9349f18b
  34. 24 Oct, 2005 1 commit
    • unknown's avatar
      Fix for BUG#13095: Cannot create VIEWs in prepared statements · 33d5d4ad
      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.
      33d5d4ad