An error occurred fetching the project authors.
  1. 25 Aug, 2005 1 commit
    • unknown's avatar
      Fix Bug#11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO query" · d29df564
      unknown authored
      mysql-test/r/sp.result:
        update result
      mysql-test/t/sp.test:
        Add test for Bug #11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO query"
      sql/item.cc:
        we should call destructors for Items before reuse
      sql/item.h:
        Add new method and constructor for Item_string.
      sql/sp_head.cc:
        String allocation should be done on the system heap for now.
      d29df564
  2. 24 Aug, 2005 1 commit
    • unknown's avatar
      fix test for a bug to use correct tables · 0183ec75
      unknown authored
      mysql-test/r/sp.result:
        fix result
      mysql-test/t/sp.test:
        fix test for a bug: tests in sp.test should reuse tables t1 and t2 and create/drop tables t3, t4 etc.
        So, tables t1 and t2 were renamed into t3 and t4
      0183ec75
  3. 19 Aug, 2005 1 commit
    • unknown's avatar
      A fix and a test case for "Bug #12168 'DECLARE CONTINUE HANDLER FOR · 276bd123
      unknown authored
      NOT FOUND ...' in conditional handled incorrectly".
      
      Whenever we remove an instruction during optimization, we need to
      adjust instruction numbers (ip - instruction pointer) stored in all
      instructions. In addition to that, sp_instr_hpush_jump, which 
      corresponds to DECLARE CONTINUE HANDLER needs adjustment for m_handler,
      which holds the number of instruction with the continue handler.
      In the bug report, a wrong ip stored in m_handler was pointing at 
      FETCH, which resulted in an error message and abnormal SP termination.
      The fix is to just remove m_handler member from sp_instr_hpush_jump,
      as it's always points to the instruction next to the DECLARE
      statement itself (m_ip+1).
      
      
      mysql-test/r/sp.result:
        Test results fixed (Bug#12168)
      mysql-test/t/sp.test:
        A test case for Bug#12168 "'DECLARE CONTINUE HANDLER FOR NOT
        FOUND ...' in conditional handled incorrectly"
      sql/sp_head.cc:
        Remove m_handler (the number of continue handler instruction)
        as it always equal to m_ip+1
      sql/sp_head.h:
        Remove m_handler (the number of continue handler instruction)
        as it always equal to m_ip+1
      276bd123
  4. 18 Aug, 2005 1 commit
    • unknown's avatar
      Fix for Bug#11247 Stored procedures: Function calls in long loops leak memory · fa19a9f2
      unknown authored
          and Bug#12297 SP crashes the server if data inserted inside a lon loop
      Third commit attempt. With fixes to the issues, showed up after full rebuild and
      tests on other hosts.
      
      
      mysql-test/r/rpl_sp.result:
        New warnings appeared in result file, as now we always create spcont in a stored routine.
        This is correct behaviour. We swallowed some warnings, as we used thd->spcont to check whether
        we are in the SP though we didn't set spcont in certain cases. This is fixed now.
      mysql-test/r/sp.result:
        fixed result file to reflect new tests
      mysql-test/t/sp.test:
        Added tests for bugs. Though one of them is disabled, as it fails because of the other bug.
        It should be enabled, when bug 12297 is fixed.
      sql/sp_head.cc:
        Per-instruction arena is implemented
      sql/sp_rcontext.cc:
         Now we should deal with callers_arena->free_list when we employ reuse mechanism with callers_arena
         switched during sp_eval_func_item
      sql/sp_rcontext.h:
        Add new member to sp_rcontext class, in order to handle instructions with assignment
        and/or with nested SP processing properly.
      fa19a9f2
  5. 11 Aug, 2005 1 commit
    • unknown's avatar
      Cleanups during review of new code · d83f6908
      unknown authored
      mysql-test/t/sp.test:
        Use --disable_parsing instead of comments
      sql/lock.cc:
        Remove compiler warning
      sql/mysqld.cc:
        Always send valid flag argument to reload_acl_and_cache()
      sql/sp_cache.cc:
        Simple optimization
        Don't use mutex to read 'long' variable
        Indentation fixes
      sql/sp_head.cc:
        Fix comments to use /* */
        Set proc_info to 0 after close_thread_tables()
      sql/sql_base.cc:
        remove not needed test
      sql/sql_parse.cc:
        Always send valid flag argument to reload_acl_and_cache()
        Fixed indentation
        Ensure we get an error if reset_master() fails.
      d83f6908
  6. 08 Aug, 2005 1 commit
    • unknown's avatar
      Fix for bug #10055 "Using stored function with information_schema causes empty · 39fda600
      unknown authored
      result set".
      
      To enable full access to contents of I_S tables from stored functions
      or statements that use them, we manipulate with thread's open tables
      state and ensure that we won't cause deadlock when we open tables by
      ignoring flushes and name-locks.
      Building of contents of I_S.TABLES no longer requires locking of tables
      since we use use handler::info() method with HA_STATUS_AUTO flag instead
      of handler::update_auto_increment() for obtaining information about
      auto-increment values. But this also means that handlers have to implement
      support for HA_STATUS_AUTO flag (particularly InnoDB needs it).
      
      
      mysql-test/r/alter_table.result:
        Updated test results. This change was caused by the fact that now when
        we build contents of I_S tables (and thus output of SHOW INDEX) we
        don't use instances of tables which may be already opened and locked
        by thread (we always use new instance).
      mysql-test/r/information_schema.result:
        Added test which checks how information about current auto-increment value for
        table is reported in INFORMATION_SCHEMA.TABLES view.
      mysql-test/r/sp.result:
        Added test for bug #10055 "Using stored function with information_schema causes
        empty result set".
      mysql-test/t/information_schema.test:
        Added test which checks how information about current auto-increment value for
        table is reported in INFORMATION_SCHEMA.TABLES view.
      mysql-test/t/sp.test:
        Added test for bug #10055 "Using stored function with information_schema causes
        empty result set".
      sql/mysql_priv.h:
        close_thread_tables():
          Get rid of 'stopper' argument which is no longer used. Now when we need
          to open and then close some table without touching tables which are already
          opened we use THD::reset_n/restore_backup_open_tables_state() methods.
        open_tables()/open_normal_and_derived_tables():
          Added 'flags' argument to be able open tables even if some has done
          a flush or hold namelock on them.
      sql/sp.cc:
        close_proc_table/open_proc_table_for_read/db_find_routine():
          Replaced push_open_tables_state/pop_open_tables_state() methods which
          were saving/restoring current open tables state in/from THD::open_state_list
          with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
          methods which assume that backup storage for this state is allocated on
          stack (or elsewhere) by their caller.
        open_proc_table_for_read():
          Since now we can have several open tables states stacked up we can't rely
          rely on checking whether we have some tables open in previous state.
          Instead we always assume that some tables are open and we need to ignore
          flush while locking mysql.proc. We don't really need 
          MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK in this case since we open mysql.proc table
          only for reading.
      sql/sp.h:
        Added declarations of open_proc_table_for_read()/close_proc_table() to be
        able to use them in sql_show.cc.
      sql/sql_base.cc:
        close_thread_tables():
          Get rid of 'stopper' argument which is no longer used. Now when we need
          to open and then close some table without touching tables which are already
          opened we use THD::reset_n/restore_backup_open_tables_state() methods.
        open_tables()/open_normal_and_derived_tables():
          Added 'flags' argument to be able open tables even if some has done
          a flush or hold namelock on them.
      sql/sql_class.cc:
        Open_tables_state, THD:
          Replaced push_open_tables_state/pop_open_tables_state() methods which
          were saving/restoring current open tables state in/from THD::open_state_list
          with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
          methods which assume that backup storage for this state is allocated on
          stack (or elsewhere) by their caller.
      sql/sql_class.h:
        Open_tables_state, THD:
          Replaced push_open_tables_state/pop_open_tables_state() methods which
          were saving/restoring current open tables state in/from THD::open_state_list
          with reset_n_backup_open_tables_state/restore_backup_open_tables_state()
          methods which assume that backup storage for this state is allocated on
          stack (or elsewhere) by their caller.
      sql/sql_handler.cc:
        open_tables()/open_normal_and_derived_tables():
          Added 'flags' argument to be able open tables even if some has done
          a flush or hold namelock on them.
      sql/sql_prepare.cc:
        open_tables()/open_normal_and_derived_tables():
          Added 'flags' argument to be able open tables even if some has done
          a flush or hold namelock on them.
      sql/sql_show.cc:
        get_all_tables():
          Now we use THD::reset_n_/restore_backup_open_tables_state() for 
          saving/restoring open tables state instead of working with it directly
          (This also allows us to have proper content of I_S system tables in
          statements with stored functions and in stored functions). We also
          ignore possible flushes when opening tables (we may create deadlock
          otherwise). Also we do all needed manipulations with LEX in this function
          and not in get_schema_tables_result() now.
        get_schema_tables_record():
          Let us use handler::info() method with HA_STATUS_AUTO flag for obtaining
          information about table's auto-increment value. This allows to avoid locking
          of tables which is needed when we use handler::update_auto_increment() method.
        fill_schema_proc():
          Now we use open_proc_table_for_read/close_proc_table() for access to
          mysql.proc table (so we won't cause deadlock if we already have some
          tables open and locked, this also allows us to have proper content in
          ROUTINES system table in statements using stored functions/in stored
          functions).
        get_schema_tables_result():
          Moved all manipulations with Open_tables_state and LEX needed for
          safe opening of tables to ST_SCHEMA_TABLE::fill_table functions
          (i.e. get_all_tables() and fill_schema_proc()).
      sql/sql_update.cc:
        open_tables()/open_normal_and_derived_tables():
          Added 'flags' argument to be able open tables even if some has done
          a flush or hold namelock on them.
      39fda600
  7. 03 Aug, 2005 1 commit
    • unknown's avatar
      Prelocking-free SPs, post-review fixes: · b323667f
      unknown authored
      * Don't activate prelocking mode for evaluating procedure arguments when it is not necessary.
      * Code structure simplification and cleanup.
      * Cleanup in .test files
      
      
      mysql-test/r/sp-prelocking.result:
        Prelocking-free SPs, post-review fixes:
        Added comment, s/testdb/mysqltest/, fixed a wrong test (error wasnt reported because of known bug in mysqltestrun)
      mysql-test/r/sp-security.result:
        Don't drop the table we're not using.
      mysql-test/r/sp.result:
        Prelocking-free SPs, post-review fixes:
        remove redundant "drop table if exists t3" statements
      mysql-test/t/sp-prelocking.test:
        Prelocking-free SPs, post-review fixes:
        Added comment, s/testdb/mysqltest/, fixed a wrong test (error wasnt reported because of known bug in mysqltestrun)
      mysql-test/t/sp-security.test:
        Don't drop the table we're not using.
      mysql-test/t/sp.test:
        Prelocking-free SPs, post-review fixes:
        remove redundant "drop table if exists t3" statements
      sql/sp.cc:
        New, better defined, sp_get_prelocking_info() function to get info about
          statement prelocking options
      sql/sp.h:
        Prelocking-free SPs, post-review fixes: New, better defined, sp_get_prelocking_info() 
        function to get info about statement prelocking options
      sql/sp_cache.h:
        Prelocking-free SPs, post-review fixes: Amended the comments
      sql/sp_head.cc:
        Prelocking-free SPs, post-review fixes: Amend the comments, simplify the code that 
        attaches removes statement's prelocking tables.
      sql/sql_base.cc:
        Prelocking-free SPs, post-review fixes:
        * Use a better defined sp_get_prelocking_info() function to get info about 
          statement prelocking options
        * Don't activate prelocked mode for evaluation of SP arguments that use tables 
          but don't need prelocking.
      sql/sql_class.cc:
        Prelocking-free SPs, post-review fixes: Initialize THD members in the order they are declared.
      b323667f
  8. 31 Jul, 2005 1 commit
    • unknown's avatar
      Fixes during review of new pushed code · 6b3478ec
      unknown authored
      Change bool in C code to my_bool
      Added to mysqltest --enable_parsning and --disable_parsing to avoid to have to comment parts of tests
      Added comparison of LEX_STRING's and use this to compare file types for view and trigger files.
      
      
      client/client_priv.h:
        Added OPT_TRIGGERS (to get rid of compiler warning)
      client/mysql.cc:
        Added cast to get rid of compiler warning
      client/mysqldump.c:
        Added OPT_TRIGGERS (to get rid of compiler warning)
        Abort if we can't write to outfile (even if --ignore-errors is given)
      client/mysqltest.c:
        Added --enable_parsning and --disable_parsing to avoid to have to comment parts of tests
      include/my_sys.h:
        Make my_progname const
      include/my_time.h:
        Avoid using 'bool' in C programs
      mysql-test/lib/init_db.sql:
        Align with mysql_create_system_tables
        (Ideally this file should be auto-generated from the above script)
      mysql-test/r/mysqltest.result:
        Test for --enable_parsing
      mysql-test/r/variables.result:
        Update results after fix for overflow checking of max_heap_table_size
      mysql-test/t/information_schema.test:
        USe --enable/disable parsing instead of comments
      mysql-test/t/mysqltest.test:
        Test for --enable_parsing
      mysql-test/t/sp.test:
        USe --enable/disable parsing instead of comments
      mysql-test/t/variables.test:
        Portability fix for 64 bit systems
      mysql-test/t/view.test:
        USe --enable/disable parsing instead of comments
      mysys/my_init.c:
        May my_progname const
      mysys/my_static.c:
        May my_progname const
      mysys/thr_lock.c:
        Remove not needed casts
      sql-common/my_time.c:
        Change bool -> my_bool as bool is not portable in C programs
      sql/field.cc:
        Test number_to_datetime() for -1 instead of < 0 (Safety fix)
        New prototype for TIME_to_timestamp()
      sql/item.h:
        Don't have prototypes for both uint32 and ulong as these 'may' be the same thing
      sql/item_timefunc.cc:
        New prototype for TIME_to_timestamp()
      sql/log.cc:
        Remove compiler warnings
      sql/mysql_priv.h:
        New prototype for TIME_to_timestamp()
        Added function for comparing LEX_STRING
      sql/set_var.cc:
        Added overflow checking when setting ulong variable
      sql/sql_base.cc:
        Added function is_equal()
        Changed strncmp -> is_equal() as strncmp() to not match "V" (instead of "VIEW")
      sql/sql_class.cc:
        Added comment
      sql/sql_select.cc:
        Portability fixes
        After review fixes
      sql/sql_trigger.cc:
        Use 'tables_alias_charset' for comparing database name
        Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly)
      sql/sql_view.cc:
        Use 'is_equal()' to compare file type. (Old code didn't do the comparison correctly)
      sql/time.cc:
        New prototype for TIME_to_timestamp() to allow easyer mapping to C function
      sql/tztime.cc:
        bool -> my_bool (to allow calling C code from C++ code)
      sql/tztime.h:
        bool -> my_bool (to allow calling C code from C++ code)
      6b3478ec
  9. 30 Jul, 2005 1 commit
    • unknown's avatar
      Added Non-prelocked SP execution: Now a PROCEDURE doesn't enter/leave prelocked mode for · 11abe15e
      unknown authored
      its body, but lets each statement to get/release its own locks. This allows a broader set
      of statements to be executed inside PROCEDUREs (but breaks replication)
      This patch should fix BUG#8072, BUG#8766, BUG#9563, BUG#11126
      
      
      mysql-test/r/sp-security.result:
        Drop tables this test attempts to create
      mysql-test/r/sp-threads.result:
        Update test results
      mysql-test/r/sp.result:
        Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
      mysql-test/r/view.result:
        Enabled a test case that now works with prelocking-free SPs
      mysql-test/t/sp-security.test:
        Drop tables this test attempts to create
      mysql-test/t/sp.test:
        Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
      mysql-test/t/view.test:
        Enabled a test case that now works with prelocking-free SPs
      sql/handler.cc:
        Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
      sql/item_func.cc:
        Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
      sql/sp.cc:
        Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
        "CALL proc(...)" statements.
      sql/sp.h:
        Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
        "CALL proc(...)" statements.
      sql/sp_cache.h:
        Added comments
      sql/sp_head.cc:
        Non-prelocked SP execution:
        * Try to unlock tables after PROCEDURE arguments have been evaluated.
        * Make sp_lex_keeper be able to execute in 2 modes: A) when already in prelocked mode
          B) when its statement enters/leaves prelocked mode itself.
      sql/sp_head.h:
        Non-prelocked SP execution:  Make sp_lex_keeper to additionally keep list of tables it 
        needs to prelock when its statement enters/leaves prelocked mode on its own.
      sql/sql_base.cc:
        Non-prelocked SP execution: Make open_tables() to
         * detect 'CALL proc(...)' and not to do prelocking for procedure body statements.
         * Make lex->query_tables_last to point precisely to a boundary in lex->query_tables 
           list where 'own' tables and views' tables end and added-for-prelocking tables begin.
           (it was not true before - view's tables could end up after query_tables_own_last)
      sql/sql_class.cc:
        Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
      sql/sql_class.h:
        Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
      sql/sql_lex.cc:
        Non-prelocked SP execution: More rigourous cleanup in st_lex::cleanup_after_one_table_open()
      sql/sql_parse.cc:
        Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt, remove outdated comments
      sql/sql_trigger.h:
        Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
      11abe15e
  10. 29 Jul, 2005 1 commit
    • unknown's avatar
      Added sql_mode saving to mysql_dump (BUG#5891, part 2) · 675c4bb4
      unknown authored
      client/client_priv.h:
        add OPT_ for --trigger parameter
      client/mysqldump.c:
        fixed short simbol for trigger
        fixed lines break for more compiler compatibility
        added sql_mode output
        added comments
        made protection of trigger and view restoring commands from execution by old versions of mysql
      mysql-test/r/mysqldump.result:
        changed test, to test sql_mode
      mysql-test/r/sp.result:
        now sql_mode preserved in SP
      mysql-test/t/mysqldump.test:
        changed test, to test sql_mode
      mysql-test/t/sp.test:
        now sql_mode preserved in SP
      sql/set_var.cc:
        fixed comment
      675c4bb4
  11. 22 Jul, 2005 2 commits
    • unknown's avatar
      fix for bug#8692 · 0c17b6ed
      unknown authored
      mysql-test/r/sp.result:
        added expected result for bug #8692
      mysql-test/t/sp.test:
        added testcase for bug #8692
      sql/protocol_cursor.cc:
        fixed detecting of null fields: A field contains a null value only 
        if length is NULL_LENGTH
      0c17b6ed
    • unknown's avatar
      Replace host column when testing 'SHOW PROCESSLIST' since it is · 3815b5ad
      unknown authored
      different on Windows. (Bug #11570)
      
      
      mysql-test/t/sp-threads.test:
        Replace host column to avoid spurious error on Windows
      mysql-test/t/sp.test:
        Replace host column to avoid spurious error on Windows
      3815b5ad
  12. 16 Jul, 2005 1 commit
    • unknown's avatar
      After-merge fixes (4.1 -> 5.0). · 7bdc4dd0
      unknown authored
      mysql-test/r/sp.result:
        Test results fixed: rewritten test for Bug#6129
      mysql-test/r/view.result:
        Push a change to the result file from Sanja's patch.
      mysql-test/t/sp.test:
        Rewrite the test for Bug#6129 (now that stored procedures don't
        evaluate system variables at parse, the test produced different results).
        The old test failed with 1 in the second invocation (the old
        result was wrong).
      sql/item_func.cc:
        After-merge fix.
      sql/item_func.h:
        After-merge fix.
      sql/mysql_priv.h:
        After-merge fix.
      sql/mysqld.cc:
        Rollback the patch for Bug#7403 (it breaks the test suite).
      7bdc4dd0
  13. 15 Jul, 2005 3 commits
    • unknown's avatar
      Post-review fix: Made test bug9538 test robust. · 51308e23
      unknown authored
      mysql-test/r/sp.result:
        Made test bug9538 test robust.
      mysql-test/t/sp.test:
        Made test bug9538 test robust.
      51308e23
    • unknown's avatar
      Fixed BUG#9538: SProc: Creation fails if we try to SET system variable · 6f619804
      unknown authored
                        using @@var_name in proc
        Made sure we don't lose the tokenizer state when swapping lex in during SET
        parsing.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#9538.
      mysql-test/t/sp.test:
        New test case for BUG#9538.
      sql/sp_head.cc:
        Keep lex->next_state when swapping lex during SP parsing (for SET mainly),
        otherwise the tokenizer gets confused.
      6f619804
    • unknown's avatar
      Added test case for bug #9565 "Wrong locking in stored procedure if a · 32e157ec
      unknown authored
      sub-sequent procedure is called" which was fixed by the same patch
      as bug #9597 "read lock stays when querying view from stored procedure".
      
      
      mysql-test/r/sp.result:
        Added test case for bug #9565 "Wrong locking in stored procedure if a
        sub-sequent procedure is called".
      mysql-test/t/sp.test:
        Added test case for bug #9565 "Wrong locking in stored procedure if a
        sub-sequent procedure is called".
      32e157ec
  14. 09 Jul, 2005 1 commit
    • unknown's avatar
      Enable support of access to tables from triggers. Thus fix bug #8406 "Triggers · 14b1f91b
      unknown authored
      crash if referencing a table" and several other related bugs.
      Fix for bug #11834 "Re-execution of prepared statement with dropped function
      crashes server." which was spotted during work on previous bugs.
      
      Also couple of nice cleanups:
      - Replaced two separate hashes for stored routines used by statement with one.
      - Now instead of doing one pass through all routines used in statement for
        caching them and then doing another pass for adding their tables to table
        list, we do only one pass during which do both things.
      
      
      mysql-test/r/sp-error.result:
        Added test for bug #11834 "Re-execution of prepared statement with dropped
        function crashes server" also covering handling of prepared statements
        which use stored functions but does not require prelocking.
      mysql-test/r/sp.result:
        Updated test for LOCK TABLES with views in table list.
        (Old version of statement used in this test will work ok now, since prelocking
         algorithm was tuned and will lock only one multi-set of tables for each routine
         even if this routine is used in several different views).
      mysql-test/r/trigger.result:
        Added several tests for triggers using tables.
      mysql-test/t/sp-error.test:
        Added test for bug #11834 "Re-execution of prepared statement with dropped
        function crashes server" also covering handling of prepared statements
        which use stored functions but does not require prelocking.
      mysql-test/t/sp.test:
        Updated comment about recursive views to reflect current situation.
        Updated test for LOCK TABLES with views in table list.
        (Old version of statement used in this test will work ok now, since prelocking
         algorithm was tuned and will lock only one multi-set of tables for each routine
         even if this routine is used in several different views).
      mysql-test/t/trigger.test:
        Added several tests for triggers using tables.
      sql/item_func.cc:
        Item_func_sp::cleanup():
          By next statement execution stored function can be dropped or altered so
          we can't assume that sp_head object for it will be still valid.
      sql/sp.cc:
        - Added Sroutine_hash_entry structure that represents element in the set of
          stored routines used by statement or routine. We can't as before use
          LEX_STRING for this purprose because we want link all elements of this set
          in list.
        - Replaced sp_add_to_hash() with sp_add_used_routine() which takes into account
          that now we use one hash for stored routines used by statement instead of two
          and which mantains list linking all elelemnts in this hash.
        - Renamed sp_merge_hash() to sp_update_sp_used_routines().
        - Introduced sp_update_stmt_used_routines() for adding elements to the set of
          routines used by statement from another similar set for statement or routine.
          This function will also mantain list linking elements of destination set.
        - Now instead of one sp_cache_routines() function we have family of 
          sp_cache_routines_and_add_tables() functions which are also responsible for
          adding tables used by routines being cached to statement table list. Nice
          optimization - thanks to list linking all elements in the hash of routines
          used by statement we don't need to perform several iterations over this hash
          (as it was before in cases when we have added new elements to it).
      sql/sp.h:
        Added declarations of functions used for manipulations with set (hash) of stored
        routines used by statement.
      sql/sp_head.cc:
        sp_name::init_qname():
          Now sp_name also holds key identifying routine in the set (hash) of
          stored routines used by statement. 
        sp_head:
          Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
          routines used by this routine we use one hash - m_sroutines. 
        sp_instr_set_trigger_field:
          Added support for subqueries in assignments to row accessors in triggers.
        Removed definition of sp_add_sp_tables_to_table_list() and auxilary functions 
        since now we don't have separate stage on which we add tables used by routines
        used by statement to table list for prelocking. We do it on the same stage as
        we load those routines in SP cache. So all this functionality moved to
        sp_cache_routines_and_add_tables() family of functions.
      sql/sp_head.h:
        sp_name:
          Now this class also holds key identifying routine in the set (hash) of stored
          routines used by statement. 
        sp_head:
          Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
          routines used by this routine we use one hash - m_sroutines. 
        sp_instr_set_trigger_field:
          Added support for subqueries in assignments to row accessors in triggers.
        Removed declaration of sp_add_sp_tables_to_table_list() since now we don't have
        separate stage on which we add tables used by routines used by statement to
        table list for prelocking. We do it on the same stage as we load those routines
        in SP cache.
      sql/sql_base.cc:
        open_tables():
        - LEX::spfuns/spprocs hashes were replaced with one LEX::sroutines hash.
        - Now instead of doing one pass through all routines used in statement for
          caching them and then doing another pass for adding their tables to table
          list, we do only one pass during which do both things. It is easy to do
          since all routines in the set of routines used by statement are linked in
          the list. This also allows us to calculate table list for prelocking more
          precisely.
        - Now triggers properly inform prelocking algorithm about tables they use.
      sql/sql_lex.cc:
        lex_start():
          Replaced LEX::spfuns/spprocs with with one LEX::sroutines hash.
          Added LEX::sroutines_list list linking all elements in this hash.
        st_lex::st_lex():
          Moved definition of LEX constructor to sql_lex.cc file to be able
          use sp_sroutine_key declaration from sp.h in it.
      sql/sql_lex.h:
        LEX:
          Replaced two separate hashes for stored routines used by statement with one.
          Added list linking all elements in this hash to be able to iterate through all
          elements and add new elements to this hash at the same time.
          Moved constructor definition to sql_lex.cc.
      sql/sql_parse.cc:
        mysql_execute_command():
          Replaced LEX::spfuns/spprocs with one LEX::sroutines hash.
      sql/sql_trigger.cc:
        Added missing GNU GPL notice.
        Table_triggers_list::check_n_load()
          Added initialization of sroutines_key which stores key representing
          triggers of this table in the set (hash) of routines used by this statement.
      sql/sql_trigger.h:
        Added missing GNU GPL notice.
        Table_triggers_list:
          Added sroutines_key member to store key representing triggers of this
          table in the set (hash) of routines used by this statement.
          Declared sp_cache_routines_and_add_tables_for_triggers() as friend since
          it needs access to sroutines_key and trigger bodies.
      sql/sql_yacc.yy:
        - Now we use sp_add_used_routine() instead of sp_add_to_hash() for adding
          elements to the set of stored routines used in statement.
        - Enabled support of subqueries as right sides in assignments to triggers' row
          accessors.
      14b1f91b
  15. 06 Jul, 2005 1 commit
    • unknown's avatar
      Fixed BUG#7088: Stored procedures: labels won't work if character set is utf8. · 23cc6010
      unknown authored
        We used 'IDENT' for labels as a temporary fix for the  parser conflicts
        introduced if the proper rule 'ident' was used. Now a specially tailored
        'label_ident' rule is used for labels instead.
      
      
      mysql-test/r/sp.result:
        New test cases for BUG#7088.
      mysql-test/t/sp.test:
        New test cases for BUG#7088.
      sql/sql_yacc.yy:
        Make labels in stored procedures work with other character sets than latin1.
        Using a separate 'label_ident' rule (instead of 'ident') and splitting
        the 'keyword' rule into two got rid of the temporary fix of using 'IDENT' for
        labels (which didn't heed character sets).
      23cc6010
  16. 01 Jul, 2005 2 commits
    • unknown's avatar
      Disabled the GOTO feature. (It's non-standard and undocumented.) · 1ff4a0eb
      unknown authored
      We want to have the defacto standard syntax for labels ("L:" instead of "label L;"),
      and fix some known bugs, before we enable this again.
      The code is left intact (#ifdef'ed SP_GOTO) and the test cases are kept in
      sp-goto.test, for the future...
      
      
      mysql-test/r/sp-error.result:
        Moved all goto tests to sp-goto.test.
      mysql-test/r/sp.result:
        Moved all goto tests to sp-goto.test.
      mysql-test/t/disabled.def:
        Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
        We keep the tests in sp-goto.test for the future, but disable for now.
      mysql-test/t/sp-error.test:
        Moved all goto tests to sp-goto.test.
      mysql-test/t/sp.test:
        Moved all goto tests to sp-goto.test.
      sql/lex.h:
        Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
      sql/sql_yacc.yy:
        Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
      1ff4a0eb
    • unknown's avatar
      "Fix" for bug #11394 "Recursion in SP crash server" and bug #11600 · 0f64a495
      unknown authored
      "Stored procedures: crash with function calling itself".
      
      Disallow recursive stored routines until we either make Item's and LEX
      reentrant safe or will use spearate sp_head instances (and thus separate
      LEX objects and Item trees) for each routine invocation.
      
      
      mysql-test/r/sp-error.result:
        Added tests for bug #11394 "Recursion in SP crash server" and
        bug #11600 "Stored procedures: crash with function calling itself".
        (We simply disallow recursion for stored routines).
      mysql-test/r/sp.result:
        Disabled test cases containing recursive stored routines until we will
        support for them.
      mysql-test/t/sp-error.test:
        Added tests for bug #11394 "Recursion in SP crash server" and
        bug #11600 "Stored procedures: crash with function calling itself".
        (We simply disallow recursion for stored routines).
      mysql-test/t/sp.test:
        Disabled test cases containing recursive stored routines until we will
        support for them.
      sql/share/errmsg.txt:
        Added error message saying that recursive stored routines are disallowed.
      sql/sp_head.cc:
        sp_head::execute():
          Since many Item's and LEX members can't be used in reentrant fashion
          we have to disable recursion for stored routines. So let us track
          routine invocations using sp_head::m_is_invoked member and raise
          error when one attempts to call routine recursively.
      sql/sp_head.h:
        sp_head:
          Added m_is_invoked member for tracking of routine invocations and
          preventing recursion.
      0f64a495
  17. 30 Jun, 2005 1 commit
    • unknown's avatar
      Fixed BUG#11529: crash server after use stored procedure · a95bb38a
      unknown authored
      Make sure to cleanup the items for a cursor query after each open, otherwise
      it's done too late, after the run-time mem_root is freed.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#11529.
      mysql-test/t/sp.test:
        New test case for BUG#11529.
      sql/sp_head.cc:
        Add a back pointer from a sp_cursor to its cpush instruction, and use it to set
        the arena and cleanup the items for the cursor's query when opening it.
      sql/sp_rcontext.cc:
        Store pointer in sp_cursor to its cpush instruction.
      sql/sp_rcontext.h:
        Store pointer in sp_cursor to its cpush instruction.
      a95bb38a
  18. 21 Jun, 2005 1 commit
    • unknown's avatar
      fixed items cleunup for SP (BUG#10136) · ef36e81b
      unknown authored
      mysql-test/r/sp.result:
        test commented until bug#11394 fix
        test for bug#10136
      mysql-test/t/sp.test:
        test commented until bug#11394 fix
        bug10136
      sql/sp_head.cc:
        fixed items cleunup for SP
      ef36e81b
  19. 10 Jun, 2005 1 commit
    • unknown's avatar
      Post review and additional fix for BUG#10968: Stored procedures: crash if long loop. · 03949f8c
      unknown authored
        Fixed valgrind complaints. This fixes the memory leak problems for
        procedured, and partially for functions. There's still a leak involving
        results from functions that turned out to be too involved, so it will be
        fixed separately.
      
      
      mysql-test/r/sp.result:
        Fixed some minor mistake (spotted while debugging).
      mysql-test/t/sp.test:
        Fixed some minor mistake (spotted while debugging).
      sql/item_func.cc:
        Moved Item_func_sp::cleanup() from item_func.h to ease debugging,
        and made a debug output come out right.
      sql/item_func.h:
        Moved Item_func_sp::cleanup() to item_func.cc to ease debugging.
      sql/sp_head.cc:
        Fixed valgrind problems with the previous memory leak fix (unit cleanup and
        putting result field in a differen mem_root), and removed prealloc flag from
        init_alloc_root() calls.
      sql/sp_rcontext.cc:
        New mem_root pointer used for return fields from functions.
      sql/sp_rcontext.h:
        New mem_root pointer used for return fields from functions.
      03949f8c
  20. 07 Jun, 2005 1 commit
  21. 06 Jun, 2005 1 commit
    • unknown's avatar
      sp.test, sp.result: · 3b808af0
      unknown authored
        Added a test case for bug #6866.
      sql_select.cc:
        Fixed bug #6866.
        Bug was due to the fact that on_expr was not backed up
        for the second execution of the stored procedure.
      
      
      sql/sql_select.cc:
        Fixed bug #6866.
        Bug was due to the fact that on_expr was not backed up
        for the second execution of the stored procedure.
      mysql-test/r/sp.result:
        Added a test case for bug #6866.
      mysql-test/t/sp.test:
        Added a test case for bug #6866.
      3b808af0
  22. 01 Jun, 2005 1 commit
    • unknown's avatar
      Fixed BUG#10961: Stored procedures: crash if select * from dual · 77bd9d36
      unknown authored
        Have to catch errors from SELECT when opening a cursor.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#10961.
      mysql-test/t/sp.test:
        New test case for BUG#10961.
      sql/protocol.h:
        Init data in Protocol_cursor constructor, for error cases.
      sql/sp_head.cc:
        Catch "hidden" errors during SELECT when opening a cursor.
      77bd9d36
  23. 27 May, 2005 1 commit
  24. 08 May, 2005 1 commit
    • unknown's avatar
      Item::fix_field need correct pointer on item reference to chnge it if itis... · a6b15466
      unknown authored
      Item::fix_field need correct pointer on item reference to chnge it if itis need, so support of correct item address added to SP commands (BUG#5963)
      some optimisation of IF/NOT IF ptomised to Pem
      
      
      mysql-test/r/sp.result:
        test for bug#5963
      mysql-test/t/sp.test:
        test for bug#5963
      sql/item.cc:
        new method which return reference on Item for SP variables support
      sql/item.h:
        comment fixed
        method added
      sql/sp_head.cc:
        preparation of item made separate function
        we do not need new constant Item to check IF/IF NOT
        support of passing correct address of item for fix_fields method
      sql/sp_rcontext.cc:
        support of Item address passing to fix_fields
      sql/sp_rcontext.h:
        support of correct address passing to fix_fields
      sql/sql_class.cc:
        support of correct item address passing to fix_field
      a6b15466
  25. 07 May, 2005 1 commit
    • unknown's avatar
      Corrections to test "sp", stored procedure "fib" (see entry 9937 in the bug DB). · 81a895f7
      unknown authored
      mysql-test/r/sp.result:
        Correct the result file for the changed test.
      mysql-test/t/sp.test:
        1) Correct the "fib" stored procedure and its initial data to be mathematical correct: fib(0) = 0
        2) Do a small run of "fib" first, that is not likely to hit a memory limit (see entry 9937 in the bug DB).
      BitKeeper/etc/logging_ok:
        Logging to logging@openlogging.org accepted
      81a895f7
  26. 05 May, 2005 1 commit
    • unknown's avatar
      Fix for bug #9841 "Unexpected read lock when trying to update a view in · 1e6193ca
      unknown authored
      a stored procedure" (version 2).
      
      To handle updates and inserts into view in SP properly we should set
      lock types for tables of the view's main select when we are opening
      view for prelocking purproses.
      
      
      mysql-test/r/sp.result:
        Added test case for bug #9841 "Unexpected read lock when trying to update
        a view in a stored procedure"
      mysql-test/t/sp.test:
        Added test case for bug #9841 "Unexpected read lock when trying to update
        a view in a stored procedure"
      sql/sql_view.cc:
        mysql_make_view():
          To handle updates and inserts into view in SP properly we should set
          lock types for tables of the view's main select when we are opening
          view for prelocking purproses.
          Also it is more correct to use LEX::select_lex::get_table_list() 
          instead of 'view_tables' variable for obtaining list of those
          tables.
      1e6193ca
  27. 28 Apr, 2005 1 commit
  28. 22 Apr, 2005 1 commit
    • unknown's avatar
      Fixed BUG#9004: Inconsistent behaviour of SP re. warnings · 83a8ee38
      unknown authored
      mysql-test/r/sp.result:
        New test case for BUG#9004.
        Also updated some other results, since formerly "invisible" (but correct)
        warnings now are visible.
      mysql-test/t/sp.test:
        New test case for BUG#9004.
      sql/sql_error.cc:
        Don't reset warnings while executing a stored routine.
      sql/sql_parse.cc:
        Don't reset warnings while executing a stored routine.
      83a8ee38
  29. 21 Apr, 2005 1 commit
  30. 20 Apr, 2005 2 commits
    • unknown's avatar
      Bug#9775 - Stored procedures: crash if create function that returns enum or set · de8a3b31
      unknown authored
        Fix bug and implement return type casting.
      
      
      mysql-test/r/sp.result:
        Bug#9775
          Test for bug + feature
        Fix previous tests
      mysql-test/t/sp.test:
        Bug#9775
          Test for bug + feature
        Fix previous tests
      sql/item_func.cc:
        Bug#9775
          new method Item_func_sp::execute(Field **)
          some optimizations.
      sql/item_func.h:
        Bug#9775
          results for Item_func_sp pass through a Field of the return type.
          new method Item_func_sp::execute(Field **)
      sql/sp_head.cc:
        Bug#9775
          missing initialiation for type_lengths in sp_head::create_typelib()
      de8a3b31
    • unknown's avatar
      Fixed BUG#6898: Stored procedure crash if GOTO statements exist · 5642bbd3
      unknown authored
        Bug in the optimizer caused an infinite loop for weird code.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#6898.
      mysql-test/t/sp.test:
        New test case for BUG#6898.
      sql/sp_head.cc:
        Detect self referencing jumps in the optimizer.
      5642bbd3
  31. 19 Apr, 2005 2 commits
    • unknown's avatar
      Bug#7648 - Stored procedure crash when invoking a function that returns a bit · f054047f
      unknown authored
        bugfix 9102 corrected the crashing, this corrects the result.
      
      
      mysql-test/r/sp.result:
        Bug#7648
          New test for bug
      mysql-test/t/sp.test:
        Bug#7648
          New test for bug
      sql/item_func.h:
        Bug#7648
          Cannot cheat in Item_func_sp::val_int()
      f054047f
    • unknown's avatar
      Bug#9102 - Stored proccedures: function which returns blob causes crash · 9bf92ed6
      unknown authored
        Initialization of fields for sp return type was not complete.
      
      
      mysql-test/r/sp.result:
        Bug#9102
          Test for bug
      mysql-test/t/sp.test:
        Bug#9102
          Test for bug
      sql/mysql_priv.h:
        Bug#9102
          new function: sp_prepare_create_field()
      sql/sp_head.cc:
        Strip spaces and do charset conversion for sp function typelibs
      sql/sql_table.cc:
        Bug#9102
          new function - sp_prepare_create_field()
          prepares create_field in similar way to mysql_prepare_table()
      sql/sql_yacc.yy:
        Bug#9102
      9bf92ed6
  32. 15 Apr, 2005 1 commit
  33. 14 Apr, 2005 1 commit
    • unknown's avatar
      Fixed BUG#9598: stored procedure call within stored procedure · e0fdbeba
      unknown authored
                      overwrites IN variable
        and added error checking of variables for [IN]OUT parameters while
        rewriting the out parameter handling.
      
      
      mysql-test/r/sp-error.result:
        New test case for non-variable argument for [IN]OUT parameters.
        (And changed to qualified names in some other error messages.)
      mysql-test/r/sp.result:
        New test case for BUG#9598.
      mysql-test/t/sp-error.test:
        New test case for non-variable argument for [IN]OUT parameters.
      mysql-test/t/sp.test:
        New test case for BUG#9598.
      sql/item.h:
        Need to distinguish between SP local variable items and other items,
        for error checking and [IN]OUT parameter handling.
      sql/share/errmsg.txt:
        New error message for non-variable arguments for [IN]OUT parameters in stored procedures.
      sql/sp_head.cc:
        Rewrote the [IN]OUT parameter handling in procedure invokation, to make
        it work properly when using user variables in sub-calls.
        Also added error checking for non-variable arguments for such parameters
        (and changed to qualified names for wrong number of arg. errors).
      sql/sp_rcontext.cc:
        No need to keep track on the out index for an [IN]OUT parameter any more.
      sql/sp_rcontext.h:
        No need to keep track on the out index for an [IN]OUT parameter any more.
      e0fdbeba
  34. 13 Apr, 2005 1 commit