An error occurred fetching the project authors.
  1. 25 Feb, 2006 1 commit
    • unknown's avatar
      Fixed compiler warnings from gcc 4.0.2: · f5f01b15
      unknown authored
      - Added empty constructors and virtual destructors to many classes and structs
      - Removed some usage of the offsetof() macro to instead use C++ class pointers
      
      
      configure.in:
        Added comment
      ndb/include/ndbapi/NdbDictionary.hpp:
        Fixed compiler warnings from gcc 4.0.2
      sql/field.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/handler.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/item.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/item_cmpfunc.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/log_event.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/mysql_priv.h:
        Fixed compiler warnings from gcc 4.0.2
        For find_table_in_list I fixed it to use proper C++ class pointers instead of C style pointers
      sql/opt_range.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/parse_file.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sp_rcontext.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/spatial.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_base.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_cache.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_class.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_parse.cc:
        Fixed compiler warnings from gcc 4.0.2
        (Not pretty, but seams to work...)
      sql/sql_select.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/sql_update.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/table.h:
        Fixed compiler warnings from gcc 4.0.2
      sql/tztime.cc:
        Fixed compiler warnings from gcc 4.0.2
      sql/tztime.h:
        Fixed compiler warnings from gcc 4.0.2
      f5f01b15
  2. 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
  3. 22 Nov, 2005 1 commit
    • 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
  4. 17 Oct, 2005 1 commit
    • unknown's avatar
      Additional fix for BUG#7049, after review. · c8a2ff6f
      unknown authored
      Make sure "select" aborts when finding a SP condition handler beyond the current scope.
      
      
      mysql-test/r/sp.result:
        Updated test results after fixing error handling in select.
      sql/mysqld.cc:
        Make sure "select" aborts when finding a SP condition handler beyond the current scope.
      sql/protocol.cc:
        Make sure "select" aborts when finding a SP condition handler beyond the current scope.
      sql/sp_rcontext.h:
        Added method for checking if the handler was found in the current context.
      sql/sql_error.cc:
        Make sure "select" aborts when finding a SP condition handler beyond the current scope.
      c8a2ff6f
  5. 26 Sep, 2005 2 commits
    • unknown's avatar
      Fixed BUG#7049: Stored procedure CALL errors are ignored · a5925a90
      unknown authored
        Search the chain of sp_rcontexts recursively for handlers. If one is found,
        it will be detected in the sp_head::execute() method at the corresponding
        level.
      
      
      mysql-test/r/sp.result:
        New test case for BUG#7049.
        Note that the spurious warnings in the BUG#12379 test now are gone (as expected).
      mysql-test/t/sp.test:
        New test case for BUG#7049.
      sql/sp_head.cc:
        Link sp_rcontexts to allow catching errors across invokation boundaries.
        (Also fixed print method for the hreturn instruction.)
      sql/sp_rcontext.cc:
        Link sp_rcontexts to allow catching errors across invokation boundaries.
        If a handler is not found in the current sp_rcontext, recurse into the previous ones (if any).
      sql/sp_rcontext.h:
        Link sp_rcontexts to allow catching errors across invokation boundaries.
      a5925a90
    • unknown's avatar
      Fixed BUG#6127: Stored procedure handlers within handlers don't work · ad8ff141
      unknown authored
          Replaced the dumb in-handler/not-in-handler check with a proper recursion
          check of handlers being executed.
          (Re-commit in a different tree, to make push possible.)
      
      
      mysql-test/r/sp.result:
        New test case for BUG#6127.
      mysql-test/t/sp.test:
        New test case for BUG#6127.
      sql/sp_head.cc:
        Replaced the setting of ctx->in_handler with a enter/exit handler methods.
      sql/sp_rcontext.cc:
        Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
      sql/sp_rcontext.h:
        Replaced the boolean in_handler flag with a stack of handlers being exectuted, for proper recursion check.
        (And added some comments in the sp_rcontext class.)
      ad8ff141
  6. 21 Sep, 2005 1 commit
    • unknown's avatar
      A fix and a test case for Bug#6513 "Test Suite: Values inserted by using · 813fc410
      unknown authored
      cursor is interpreted latin1 character and Bug#9819 "Cursors: Mysql Server
      Crash while fetching from table with 5 million records."
      A fix for a possible memory leak when fetching into an SP cursor
      in a long loop.
      The patch uses a common implementation of cursors in the binary protocol and 
      in stored procedures and implements materialized cursors.
      For implementation details, see comments in sql_cursor.cc
      
      
      include/my_sys.h:
        - declaration for multi_alloc_root
      libmysqld/Makefile.am:
        - drop protocol_cursor.cc, add sql_cursor.cc (replaces the old
        implementation of cursors with a new one)
      mysql-test/r/ctype_ujis.result:
        - test results fixed (a test case for Bug#6513)
      mysql-test/r/sp-big.result:
        - test results fixed (a test case for Bug#9819)
      mysql-test/t/ctype_ujis.test:
        Add a test case for Bug#6513 "Test Suite: Values inserted by using cursor is
         interpreted latin1 character"
      mysql-test/t/sp-big.test:
        Add a restricted test case for Bug#9819 "Cursors: Mysql Server Crash
        while fetching from table with 5 million records."
      mysys/my_alloc.c:
        - an implementation of multi_alloc_root; this is largely a copy-paste
          from mulalloc.c, but the function is small and there is no easy way
          to reuse the existing C function.
      sql/Makefile.am:
        - add sql_cursor.h, sql_cursor.cc (a new implementation of stored procedure
        cursors) and drop protocol_cursor.cc (the old one)
      sql/handler.cc:
        - now TABLE object has its mem_root always initialized.
          Adjust the implementation handler::ha_open
      sql/item_subselect.cc:
        - adjust to the changed declaration of st_select_lex_unit::prepare
      sql/protocol.h:
        - drop Protocol_cursor
      sql/sp_head.cc:
        - move juggling with Query_arena::free_list and Item::next to
          sp_eval_func_item, as this is needed in 3 places already.
      sql/sp_head.h:
        - declare a no-op implementation for cleanup_stmt in sp_instr_cpush.
          This method is needed for non-materializing cursors, which are yet not 
          used in stored procedures.
        - declaration for sp_eval_func_item
      sql/sp_rcontext.cc:
        - reimplement sp_cursor using the new implementation of server side cursors.
        - use sp_eval_func_item to assign values of SP variables from the
          row fetched from a cursor. This should fix a possible memory leak in 
          the old implementation of sp_cursor::fetch
      sql/sp_rcontext.h:
        - reimplement sp_cursor using the new implementation of server side cursors.
      sql/sql_class.cc:
        - disable the functionality that closes transient cursors at commit/rollback;
          transient cursors are not used in 5.0, instead we use materialized ones.
          To be enabled in a later version.
      sql/sql_class.h:
        - adjust to the rename Cursor -> Server_side_cursor
        - additional declarations of select_union used in materialized cursors
      sql/sql_derived.cc:
        - reuse bits of tmp table code in UNION, derived tables, and materialized
          cursors
        - cleanup comments
      sql/sql_lex.h:
        - declarations of auxiliary methods used by materialized cursors
        - a cleanup in st_select_lex_unit interface
      sql/sql_list.h:
        - add an array operator new[] to class Sql_alloc
      sql/sql_prepare.cc:
        - split the tight coupling of cursors and prepared statements to reuse 
          the same implementation in stored procedures
        - cleanups of error processing in Prepared_statement::{prepare,execute}
      sql/sql_select.cc:
        - move the implementation of sensitive (non-materializing) cursors to 
          sql_cursor.cc
        - make temporary tables self-contained: the table, its record and fields
          are allocated in TABLE::mem_root. This implementation is not clean
          and resets thd->mem_root several times because of the way create_tmp_table 
          works (many additional things are done inside it).
        - adjust to the changed declaration of st_select_lex_unit::prepare
      sql/sql_select.h:
        - move the declaration of sensitive (non-materializing) cursors to 
          sql_cursor.cc
      sql/sql_union.cc:
        - move pieces of st_select_unit::prepare to select_union and st_table
          methods to be able to reuse code in the implementation of materialized
          cursors
      sql/sql_view.cc:
        - adjust to the changed signature of st_select_lex_unit::prepare
      sql/table.cc:
        - implement auxiliary st_table methods for use with temporary tables
      sql/table.h:
        - add declarations for auxiliary methods of st_table used to work with 
         temporary tables
      tests/mysql_client_test.c:
        - if cursors are materialized, a parallel update of the table used
          in the cursor may go through: update the test.
      sql/sql_cursor.cc:
        New BitKeeper file ``sql/sql_cursor.cc'' -- implementation of server side
        cursors
      sql/sql_cursor.h:
        New BitKeeper file ``sql/sql_cursor.h'' - declarations for
        server side cursors.
      813fc410
  7. 25 Aug, 2005 1 commit
    • unknown's avatar
      Fix for BUG#12335 (SP replication) : New binlogging strategy for stored PROCEDUREs/FUNCTIONs. · 8a5e5274
      unknown authored
      "Interleaved SPs execution is now binlogged properly, "SELECT spfunc()" is binlogged too.
      The known remaining issue is binlogging/replication of "a routine is deleted while it is executed" scenario.
      
      
      mysql-test/r/rpl_sp.result:
        Fix for BUG#12335: updated test cases/results
      mysql-test/t/rpl_sp.test:
        Fix for BUG#12335: updated test cases/results
      sql/item.cc:
        Fix for BUG#12335 (SP replication): 
         - Added Item_name_const 'function'
         - Addede 'delete reuse' to call dtor on item reuse
      sql/item.h:
        Fix for BUG#12335 (SP replication) : Added Item_name_const 'function' + code cleanup
      sql/item_create.cc:
         Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
      sql/item_create.h:
         Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
      sql/item_func.cc:
        Fix for BUG#12335 (SP replication) : binary log is now constrolled from within execute_function.
      sql/lex.h:
        Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
      sql/log.cc:
        Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
        one to temporary disable binlogging but collect a 'union' information about binlog write
        calls.
      sql/mysql_priv.h:
        Fix for BUG#12335 (SP replication)
      sql/sp_head.cc:
        Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for 
        StoredRoutinesBinlogging for details
      sql/sp_head.h:
        Comments added
      sql/sp_pcontext.h:
        Comments added
      sql/sp_rcontext.h:
        Comments added
      sql/sql_class.cc:
        Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for 
        StoredRoutinesBinlogging for details
      sql/sql_class.h:
        Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
        one to temporary disable binlogging but collect a 'union' information about binlog write
        calls.
      sql/sql_delete.cc:
        Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
      sql/sql_insert.cc:
        Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
      sql/sql_lex.cc:
        Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
        the tokenizer.
      sql/sql_lex.h:
        Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
        the tokenizer.
      sql/sql_parse.cc:
        Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for 
        StoredRoutinesBinlogging for details
      sql/sql_update.cc:
        Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
      sql/sql_yacc.yy:
        Fix for BUG#12335 (SP replication) : When creating Item_splocal, remember where it is located
        in the query.
      8a5e5274
  8. 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
  9. 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
  10. 14 Jun, 2005 1 commit
    • unknown's avatar
      prohibit opening Query cache for SP cursors (BUG#9715) · e1c2646a
      unknown authored
      mysql-test/r/query_cache.result:
        testing cursors in SP with QC
        testing suspicious but working using selects in function with QC
      mysql-test/t/query_cache.test:
        testing cursors in SP with QC
        testing suspicious but working using selects in function with QC
      sql/sp_head.h:
        method for prohibiting of QC using SP query
      sql/sp_rcontext.cc:
        prohibit opening Query cache for SP cursors
      sql/sp_rcontext.h:
        constructor moved to .cc file to be able to use methods from lex_keeper
      e1c2646a
  11. 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
  12. 27 May, 2005 1 commit
    • unknown's avatar
      Add USE_PRAGMA_INTERFACE and USE_PRAGMA_IMPLEMENTATION to files not existsing in 4.1 · 73b4415c
      unknown authored
      sql/hash_filo.h:
        USE_PRAGMA_INTERFACE
      sql/sp_cache.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_cache.h:
        USE_PRAGMA_INTERFACE
      sql/sp_head.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_head.h:
        USE_PRAGMA_INTERFACE
      sql/sp_pcontext.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_pcontext.h:
        USE_PRAGMA_INTERFACE
      sql/sp_rcontext.cc:
        USE_PRAGMA_IMPLEMENTATION
      sql/sp_rcontext.h:
        USE_PRAGMA_INTERFACE
      73b4415c
  13. 23 May, 2005 1 commit
    • unknown's avatar
      Fixed on BUG#6048: Stored procedure causes operating system reboot · 9c79a9d6
      unknown authored
        Memory leak in locally evalutated expressions during SP execution fixed by
        reusing allocated item slots when possible.
        Note: No test case added, since the test is a stress test that tries to make
        the machine to run out of memory.
        Second attempt, now tested with debug build, valgrind build, max (optimized)
        build, with and without --debug, --vagrind and --ps-protocol.
        Errors in trigger and view test with --debug in debug build where present
        before this patch, and likewise for valgrind warnings for view test in
        valgrind build with --ps-protocol.
      
      
      sql/item.cc:
        Init rsize in Item (for SP item reusal).
      sql/item.h:
        Addes special new operator for reuse of Items, for SP internal use only.
      sql/sp_head.cc:
        Reuse items assigned internally in SPs when possible.
      sql/sp_rcontext.cc:
        Reuse items assigned internally in SPs when possible.
        Moved the local variable assignment here (from sp_head) to avoid
        duplicated code.
      sql/sp_rcontext.h:
        New arg to sp_rcontext::set_item_eval() (and some coding style).
      sql/sql_class.cc:
        Adjusted call to new set_item_eval().
      9c79a9d6
  14. 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
  15. 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
  16. 04 Mar, 2005 1 commit
    • unknown's avatar
      Better approach for prelocking of tables for stored routines execution · ac9f68b9
      unknown authored
      and some SP-related cleanups.
      
      - We don't have separate stage for calculation of list of tables
        to be prelocked and doing implicit LOCK/UNLOCK any more.
        Instead we calculate this list at open_tables() and do implicit
        LOCK in lock_tables() (and UNLOCK in close_thread_tables()).
        Also now we support cases when same table (with same alias) is
        used several times in the same query in SP.
      
      - Cleaned up execution of SP. Moved all common code which handles
        LEX and does preparations before statement execution or complex
        expression evaluation to auxilary sp_lex_keeper class. Now 
        all statements in SP (and corresponding instructions) that
        evaluate expression which can contain subquery have their
        own LEX.
      
      
      mysql-test/r/lock.result:
        Replaced wrong error code with the correct one after fixing bug in
        SP-locking.
      mysql-test/r/mysqldump.result:
        Added dropping of view which is used in test to its beginning.
      mysql-test/r/sp.result:
        Added tests for improved SP-locking.
        Temporarily disabled tests for SHOW PROCEDURE STATUS and alike
        (Until Monty will allow to open mysql.proc under LOCK TABLES without
        mentioning it in lock list).
        Replaced wrong results of test for bug #5240 with correct results after
        fixing bug in handling of cursors.
      mysql-test/t/lock.test:
        Replaced wrong error code with the correct one after fixing bug in
        SP-locking.
      mysql-test/t/mysqldump.test:
        Added dropping of view which is used in test to its beginning.
      mysql-test/t/sp.test:
        Added tests for improved SP-locking.
        Temporarily disabled tests for SHOW PROCEDURE STATUS and alike
        (Until Monty will allow to open mysql.proc under LOCK TABLES without
        mentioning it in lock list).
        Removed test for bug #1654 since we already test exactly this function
        in one of SP-locking tests.
        Removed comment about cursor's wrong behavior in test for bug #5240
        after fixing bug which was its cause.
      sql/item_func.cc:
        Removed comment which is no longer true.
      sql/mysql_priv.h:
        Changed open_tables() signature.
        Now its 2nd parameter is in/out since it can add elements to table list.
      sql/sp.cc:
        sp_find_procedure():
         Added one more parameter which enforces cache only lookup.
        
        sp_merge_hash():
         Now uses its return value to indicate that first of two hashes changed
         as result of merge.
        
        sp_cache_routines():
         This function caches all stored routines used in query now.
      sql/sp.h:
        - sp_find_procedure() now has one more parameter which enforces cache only
          lookup.
        - sp_merge_hash() now uses its return value to indicate that first of two
          hashes changed as result of merge.
        - sp_cache_routines() caches all stored routines now. So it does not need
          third argument any more.
      sql/sp_head.cc:
        sp_head::sp_head():
         Added initialization of new m_spfuns and m_spprocs members.
        
        sp_head::execute():
         Let us save/restore part of thread context which can be damaged by
         execution of instructions.
        sp_head::execute_function()/execute_procedure():
         Now it is responsibility of caller to close tables used in
         subqueries which are passed as routine parameters.
        
        sp_head::restore_lex():
         Let us accumulate information about routines used by this one
         in new m_spfuns, m_spprocs hashes.
        
        sp_lex_keeper::reset_lex_and_exec_core()
         Main method of new auxilary sp_lex_keeper class to which instructions 
         delegate responsibility for handling LEX and preparations before
         executing statement or calculating complex expression.
        
        Since all instructions which calculate complex expression or execute
        command now use sp_lex_keeper they have to implement
        sp_instr::exec_core() method. Most of instruction specific logic
        has moved from sp_instr::execute() to this new method.
        
        Removed sp_instr_set_user_var class which is no longer used, because
        nowdays we allow execution of statements in stored functions and
        triggers.
        
        sp_merge_table_list() became sp_head::merge_table_list() method. It
        also treats sp_head::m_sptabs as multi-set of tables now.
        
        sp_hash_to_table_list() became sp_head::add_used_tables_to_table_list().
        It takes into account that sp_head::m_sptabs is multi-set and allocates
        object into persistent arena of PS.
        
        Removed sp_merge_table_hash(), sp_open_and_lock_tables(),
        sp_unlock_tables(), sp_merge_routine_tables() methods since they are not
        used by new prelocking mechanism.
        
        Added sp_add_sp_tables_to_table_list() which serves for adding tables needed
        by routines used in query to the query table list for prelocking.
      sql/sp_head.h:
        class sp_head:
        - Added m_spfuns, m_spprocs members for storing names of routines used
          by this routine.
        - Added add_used_tables_to_table_list() method which allows to add
          tables needed by this routine to query's table list.
        - Converted sp_merge_table_list() to sp_head::merge_table_list() method.
        - Changed semantics of THD::m_sptabs. Now it is multi-set which contains
          only tables which are used by this routine and not routines that are
          called from this one.
        
        Removed sp_merge_routine_tables(), sp_merge_table_hash(),
        sp_open_and_lock_tables(), sp_unlock_tables() calls since they are not
        used for our prelocking list calculation.
        
        Added auxilary sp_lex_keeper class to which instructions delegate
        responsibility for handling LEX and preparations before executing
        statement or calculating complex expression. This class uses
        new sp_instr::exec_core() method which is responsible for executing
        instruction's core function after all preparations were made.
        
        All instructions which hold and calculate complex expression now have
        their own LEX (by aggregating sp_lex_keeper instance). sp_instr_stmt
        now uses sp_lex_keeper too.
        
        Removed sp_instr_set_user_var class which is no longer used, because
        nowdays we allow execution of statements in stored functions and
        triggers.
      sql/sp_rcontext.cc:
        Now sp_cursor holds pointer to sp_lex_keeper instead of LEX.
      sql/sp_rcontext.h:
        Now sp_cursor holds pointer to sp_lex_keeper instead of LEX.
      sql/sql_acl.cc:
        acl_init(), grant_init():
          Now we use simple_open_n_lock_tables() instead of explicit
          calls to open_tables() and mysql_lock_tables().
      sql/sql_base.cc:
        Implemented support for execution of statements in "prelocked" mode.
        
        When we have statement which uses stored routines explicitly or
        implicitly (via views or triggers) we have to open and lock all tables
        for these routines at the same time as tables for the main statement.
        In fact we have to do implicit LOCK TABLES at the begining of such
        statement and implict UNLOCK TABLES at its end. We call such mode
        "prelocked".
        
        When open_tables() is called for the statement tables which are needed
        for execution of routines used by it are added to its tables list
        (this process also caches all routines used). Implicit use of routines
        is discovered when we open view or table with trigger and apropriate
        tables are added to the table list at this moment. Statement which has
        such extra tables in its list (well actually any that uses functions)
        is marked as requiring prelocked mode for its execution.
        
        When lock_tables() sees such statement it will issue implicit LOCK TABLES
        for this extended table list instead of doing usual locking, it will also
        set THD::prelocked_mode to indicate that we are in prelocked mode.
        
        When open_tables()/lock_tables() are called for statement of stored
        routine (substatement), they notice that we are running in prelocked mode
        and use one of prelocked tables from those that are not used by upper
        levels of execution.
        
        close_thread_tables() for substatement won't really close tables used
        but will mark them as free for reuse instead.
        
        Finally when close_thread_tables() is called for the main statement it
        really unlocks and closes all tables used.
        
        Everything will work even if one uses such statement under real LOCK
        TABLES (we are simply not doing implicit LOCK/UNLOCK in this case).
      sql/sql_class.cc:
        Added initialization of THD::prelocked_mode member.
      sql/sql_class.h:
        - Added prelocked_mode_type enum and THD::prelocked_mode member
          which are used for indication whenever "prelocked mode" is on 
          (i.e. that statement uses stored routines and is executed under
           implicit LOCK TABLES).
        - Removed THD::shortcut_make_view which is no longer needed.
          We use TABLE_LIST::prelocking_placeholder for the same purprose
          now.
      sql/sql_handler.cc:
        Changed open_tables() invocation.
        Now its 2nd parameter is in/out since it can add elements to table list.
      sql/sql_lex.cc:
        lex_start():
          Added initialization of LEX::query_tables_own_last.
          Unused LEX::sptabs member was removed.
        st_lex::unlink_first_table()/link_first_table_back():
          We should update LEX::query_tables_last properly if table list
          contains(ed) only one element.
      sql/sql_lex.h:
        LEX:
        - Removed sptabs member since it is no longer used.
        - Added query_tables_own_last member, which if non-0 indicates that
          statement requires prelocking (implicit LOCK TABLES) for its execution
          and points to last own element in query table list. If it is zero
          then this query does not need prelocking.
        - Added requires_prelocking(), mark_as_requiring_prelocking(),
          first_not_own_table() inline methods to incapsulate and simplify
          usage of this new member.
      sql/sql_parse.cc:
        dispatch_command():
          To properly leave prelocked mode when needed we should call
          close_thread_tables() even if there are no open tables.
        mysql_execute_command():
        - Removed part of function which were responsible for doing implicit
          LOCK TABLES before statement execution if statement used stored 
          routines (and doing UNLOCK TABLES at the end).
          Now we do all this in open_tables()/lock_tables()/close_thread_tables()
          instead.
        - It is also sensible to reset errors before execution of statement
          which uses routines.
        - SQLCOM_DO, SQLCOM_SET_OPTION, SQLCOM_CALL
          We should always try to open tables because even if statement has empty
          table list, it can call routines using tables, which should be preopened
          before statement execution.
        - SQLCOM_CALL
          We should not look up routine called in mysql.proc, since it should be
          already cached by this moment by open_tables() call.
        - SQLCOM_LOCK_TABLES
          it is better to use simple_open_n_lock_tables() since we want to avoid
          materialization of derived tables for this command.
      sql/sql_prepare.cc:
        mysql_test_update():
          Changed open_tables() invocations. Now its 2nd parameter is in/out
          since it can add elements to table list.
        check_prepared_statement():
          Since now we cache all routines used by statement in open_tables() we 
          don't need to do it explicitly.
        mysql_stmt_prepare():
          Now we should call close_thread_tables() when THD::lex points to the
          LEX of statement which opened tables.
        reset_stmt_for_execute():
          Commented why we are resetting all tables in table list.
      sql/sql_trigger.h:
        Table_triggers_list::process_triggers():
          We should surpress sending of ok packet when we are calling trigger's
          routine, since now we allow statements in them.
      sql/sql_update.cc:
        Changed open_tables() invocations.
        Now its 2nd parameter is in/out since it can add elements to table list.
      sql/sql_view.cc:
        mysql_make_view():
        - Removed handling of routines used in view. Instead we add tables which
          are needed for their execution to statement's table list in 
          open_tables().
        - Now we use TABLE_LIST::prelocking_placeholder instead of 
          THD::shortcut_make_view for indicating that view is opened
          only to discover which tables and routines it uses (this happens
          when we build extended table list for prelocking). Also now we try
          to avoid to modify main LEX in this case (except of its table list).
        - Corrected small error we added tables to the table list of the main
          LEX without updating its query_tables_last member properly.
      sql/sql_yacc.yy:
        Now each expression which is used in SP statements and can contain
        subquery has its own LEX. This LEX is stored in corresponding sp_instr
        object and used along with Item tree for expression calculation.
        
        We don't need sp_instr_set_user_var() anymore since now we allow
        execution of statements in stored functions and triggers.
      sql/table.h:
        Added TABLE_LIST::prelocking_placeholder member for distinguishing
        elements of table list which does not belong to the statement itself
        and added there only for prelocking (as they are to be used by routines
        called by this statement).
      sql/tztime.cc:
        my_tz_init():
          Now we use more simplier simple_open_n_lock_tables() call instead of 
          open_tables()/lock_tables() pair.
      ac9f68b9
  17. 23 Oct, 2004 1 commit
    • unknown's avatar
      Fixed BUG#6029: Stored procedure specific handlers should have priority. · 4c06b4ae
      unknown authored
      mysql-test/r/sp.result:
        New test case for BUG#6022.
      mysql-test/t/sp.test:
        New test case for BUG#6022.
      sql/sp_rcontext.cc:
        Find the most specific condition handler, not just the first one.
        (And corrected the return type for find_handler)
      sql/sp_rcontext.h:
        Corrected return type for find_handler.
      4c06b4ae
  18. 28 Sep, 2004 1 commit
    • unknown's avatar
      Strict mode & better warnings · 2a491215
      unknown authored
      Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field.
      Added checking of date/datetime fields.
      If strict mode, give error if we have not given value to field without a default value (for INSERT)
      
      
      client/mysqltest.c:
        Added --exit as an option to abort a test in a middle (good for debugging)
      include/my_time.h:
        Added flags to allow checking of dates in strict mode
      include/mysql_com.h:
        Added flag to check if field has a default value or not
      include/mysqld_error.h:
        New error messages for strict mode
      include/sql_state.h:
        Fixed SQL states (for strict mode tests)
      mysql-test/r/auto_increment.result:
        Updated error messages
      mysql-test/r/func_sapdb.result:
        Added test for ALLOW_INVALID_DATES
      mysql-test/r/func_str.result:
        Updated error messages
      mysql-test/r/func_time.result:
        Updated error messages
      mysql-test/r/insert.result:
        Updated error messages
      mysql-test/r/loaddata.result:
        Updated error messages
      mysql-test/r/select.result:
        Updated error messages
      mysql-test/r/sp.result:
        Updated error messages
      mysql-test/r/timezone2.result:
        Updated error messages
      mysql-test/r/type_datetime.result:
        Updated error messages
      mysql-test/r/type_decimal.result:
        Updated error messages
      mysql-test/r/type_float.result:
        Updated error messages
      mysql-test/r/type_ranges.result:
        Updated error messages
      mysql-test/r/type_time.result:
        Updated error messages
      mysql-test/r/type_uint.result:
        Updated error messages
      mysql-test/r/warnings.result:
        Updated error messages
      mysql-test/t/func_sapdb.test:
        Aded test
      sql-common/my_time.c:
        Added checking of dates
      sql/field.cc:
        Better error messages
        Optimization of warning handling (by introducing of check_int())
        Changed to use my_strtoll10()
      sql/field.h:
        Added check_int()
      sql/item_func.cc:
        Warnings when dividing by NULL
      sql/item_func.h:
        Warnings when dividing by NULL
      sql/item_timefunc.cc:
        Testing of date/datetime
        Use macros instead of constants
      sql/mysql_priv.h:
        New modes (part of strict mode)
      sql/mysqld.cc:
        New modes (part of strict mode)
      sql/opt_range.cc:
        Simple optimizations
      sql/protocol.cc:
        Add note/warning level to find_handler()
      sql/set_var.cc:
        Added mode 'traditional'
      sql/share/czech/errmsg.txt:
        New error messages for strict mode
      sql/share/danish/errmsg.txt:
        New error messages for strict mode
      sql/share/dutch/errmsg.txt:
        New error messages for strict mode
      sql/share/english/errmsg.txt:
        New error messages for strict mode
      sql/share/estonian/errmsg.txt:
        New error messages for strict mode
      sql/share/french/errmsg.txt:
        New error messages for strict mode
      sql/share/german/errmsg.txt:
        New error messages for strict mode
      sql/share/greek/errmsg.txt:
        New error messages for strict mode
      sql/share/hungarian/errmsg.txt:
        New error messages for strict mode
      sql/share/italian/errmsg.txt:
        New error messages for strict mode
      sql/share/japanese/errmsg.txt:
        New error messages for strict mode
      sql/share/korean/errmsg.txt:
        New error messages for strict mode
      sql/share/norwegian-ny/errmsg.txt:
        New error messages for strict mode
      sql/share/norwegian/errmsg.txt:
        New error messages for strict mode
      sql/share/polish/errmsg.txt:
        New error messages for strict mode
      sql/share/portuguese/errmsg.txt:
        New error messages for strict mode
      sql/share/romanian/errmsg.txt:
        New error messages for strict mode
      sql/share/russian/errmsg.txt:
        New error messages for strict mode
      sql/share/serbian/errmsg.txt:
        New error messages for strict mode
      sql/share/slovak/errmsg.txt:
        New error messages for strict mode
      sql/share/spanish/errmsg.txt:
        New error messages for strict mode
      sql/share/swedish/errmsg.txt:
        New error messages for strict mode
      sql/share/ukrainian/errmsg.txt:
        New error messages for strict mode
      sql/sp_rcontext.cc:
        Add note/warning level to find_handler()
      sql/sp_rcontext.h:
        Add note/warning level to find_handler()
      sql/sql_base.cc:
        Fix bug for detecting crashed table
      sql/sql_class.cc:
        Variables for strct mode
      sql/sql_class.h:
        Variables for strct mode
      sql/sql_error.cc:
        In strict mode, convert warnings to errors
      sql/sql_insert.cc:
        Strict mode
        If strict mode, give error if we have not given value to field without a default value
      sql/sql_load.cc:
        Strict mode
      sql/sql_parse.cc:
        Strict mode.
        Add flag to field if it doesn't have a default value
      sql/sql_select.cc:
        Added comment
        Prepare for upper level handling of table->status
      sql/sql_union.cc:
        Added THD to write_record()
      sql/sql_update.cc:
        Strict mode
      sql/table.cc:
        Handling of default values
      sql/time.cc:
        Checking of dates
      2a491215
  19. 10 Sep, 2004 1 commit
    • unknown's avatar
      Fixed BUG#3294: Stored procedure crash if table dropped before use. · 1912148c
      unknown authored
        Dropping the table was not the real problem, the problem was with errors
        occuring within error handlers.
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#3294.
      mysql-test/t/sp-error.test:
        New test case for BUG#3294.
      sql/sp_head.cc:
        Use hreturn instruction both for continue and exit handlers (a special case
        of a jump).
      sql/sp_head.h:
        Use hreturn instruction both for continue and exit handlers (a special case
        of a jump).
      sql/sp_rcontext.cc:
        Keep track on if we're in a handler already, for error handling.
      sql/sp_rcontext.h:
        Keep track on if we're in a handler already, for error handling.
      sql/sql_yacc.yy:
        Use hreturn instruction both for continue and exit handlers (a special case
        of a jump).
      1912148c
  20. 21 Jul, 2004 1 commit
    • unknown's avatar
      Fixed BUG#2653: Undeclared variables not detected in stored procedures. · 28287c0d
      unknown authored
      We now get an run-time error instead of a crash (although a slightly misleading
      error message, but it's an improvement).
      
      
      mysql-test/r/sp-error.result:
        New test case for BUG#2653.
      mysql-test/t/sp-error.test:
        New test case for BUG#2653.
      sql/sp_head.cc:
        Detect failed evals (fix item really), which are due to unresolved variables/fields.
        Typically this would be a reference to an undeclared variable.
        (Also got rid of some compiler warnings.)
      sql/sp_rcontext.cc:
        Detect failed evals (fix item really), which are due to unresolved variables/fields.
        Typically this would be a reference to an undeclared variable.
      sql/sp_rcontext.h:
        Changed return type to int, so be able to detect failed evals (fix item).
      sql/sql_class.cc:
        Changed return type to int, so be able to detect failed evals (fix item).
      28287c0d
  21. 09 Jan, 2004 1 commit
    • unknown's avatar
      Fix BUG#2269: Lost connect if stored procedure called before USE · b0928683
      unknown authored
      (And some minor correction of cursor open)
      
      
      sql/sp_head.cc:
        Detect some errors that doesn't result in a non-zero return code in
        the SP execution loop.
        (Also corrected the cursor post_open() call.)
      sql/sp_rcontext.cc:
        Corrected the semantics of cursor post_open().
      sql/sp_rcontext.h:
        Corrected the semantics of cursor post_open().
      b0928683
  22. 08 Jan, 2004 1 commit
    • unknown's avatar
      Fix BUG#2259: Crash after fetch from not-open cursor in stored procedure · 02753573
      unknown authored
      Initialize and test properly when cleaning up, to avoid crash in some error cases.
      
      
      mysql-test/r/sp-error.result:
        Test case for BUG#2259
      mysql-test/t/sp-error.test:
        Test case for BUG#2259
      sql/sp_rcontext.cc:
        Cleanup in a more controlled way to avoid crashes in some error cases.
        Remove unused variable.
      sql/sp_rcontext.h:
        Initialize member var, for cleanup tests.
      02753573
  23. 21 Dec, 2003 1 commit
    • unknown's avatar
      Update for VC++ · 4f72061f
      unknown authored
      (Fixed project files, compiler warnings etc..)
      
      
      BitKeeper/etc/ignore:
        added mysql_priv.h
      VC++Files/libmysqld/libmysqld.dsp:
        Update for VC++to
      VC++Files/sql/mysqld.dsp:
        Update for VC++
      client/mysqlbinlog.cc:
        Remove not used variable
      sql-common/client.c:
        Fix for compilation with VC++
      sql/filesort.cc:
        Remove not used variable
      sql/item_timefunc.cc:
        Fixed compiler warnings
      sql/log_event.cc:
        Fixed compiler warnings
        - One can't portable allocate an stack-array dynamicly
        - Changed sql_mode to ulong to match THD.variables.sql_mode (If they are not the same we get a lot of compiler warnings)
      sql/log_event.h:
        Changed sql_mode to ulong to match THD.variables.sql_mode (If they are not the same we get a lot of compiler warnings)
      sql/sp.cc:
        sql_mode to ulong
        Don't use strcpy
        Replaced sprintf() with strmov
      sql/sp_cache.cc:
        Fixed compiler warning
      sql/sp_head.cc:
        Removed not used variable
      sql/sp_rcontext.cc:
        Removed not used variable
      sql/sp_rcontext.h:
        Fixed compiler warning
      sql/sql_class.cc:
        Portability fix
      sql/sql_delete.cc:
        Fixed compiler warning
      sql/sql_insert.cc:
        Fixed compiler warning
      sql/sql_update.cc:
        Fixed compiler warning
      4f72061f
  24. 27 Nov, 2003 1 commit
    • unknown's avatar
      Fixed BUG#1965: Opening a cursor hangs client when malformed select fails · 919b5ba6
      unknown authored
        and BUG#1966: "select 1 into a" on top-level hangs client
      
      
      include/mysql_com.h:
        Added no_send_eof flag to NET for SP cursors (the simple read-only version).
      mysql-test/r/sp-error.result:
        Added tests for BUG#1965 and BUG#1966.
      mysql-test/t/sp-error.test:
        Added tests for BUG#1965 and BUG#1966.
      sql/net_serv.cc:
        Added no_send_eof flag to NET for SP cursors (the simple read-only version).
      sql/protocol.cc:
        Added no_send_eof flag to NET for SP cursors (the simple read-only version).
      sql/sp_rcontext.cc:
        Use net->no_send_eof flag to prevent eofs during cursor open (instead of
        the dirty vio=0 which didn't work).
      sql/sp_rcontext.h:
        Use net->no_send_eof flag to prevent eofs during cursor open (instead of
        the dirty vio=0 which didn't work).
      sql/sql_yacc.yy:
        Give error message if doing SELECT ... INTO localvar even if it's outside an SP.
      919b5ba6
  25. 14 Oct, 2003 1 commit
    • unknown's avatar
      Fix for BUG#1495: Evaluate items before setting a local variable with SELECT INTO. · 776784b8
      unknown authored
      Also copy and restore order_list and group_list for selects in SPs.
      
      
      mysql-test/r/sp.result:
        Test for BUG#1495, and an additional cursor test.
      mysql-test/t/sp.test:
        Test for BUG#1495, and an additional cursor test.
      sql/sp_head.cc:
        Fix BUG#1495: renamed eval_func_item() into sp_eval_func_item() and made it
        non-static.
        Also need to copy and restore order_list and group_list pointers before and
        after execution of a substatement. (Which means these must always be properly
        initialized for all queries.)
      sql/sp_rcontext.cc:
        Fix BUG#1495: Evaluate and set a local variable (for SELECT INTO).
      sql/sp_rcontext.h:
        Fix BUG#1495: Evaluate and set a local variable (for SELECT INTO).
      sql/sql_class.cc:
        Fix BUG#1495: Evaluate and set a local variable (for SELECT INTO).
      sql/sql_class.h:
        Fix BUG#1495: Evaluate and set a local variable (for SELECT INTO); need type for this.
      sql/sql_parse.cc:
        order_list and group_list must be initialized in select_lex for all queries,
        to make SP sub statement execution work.
      sql/sql_yacc.yy:
        Type needed for setting local variables.
      sql/table.h:
        Need a copy of the Item* pointer when executing sub-statements in SPs. (Since
        it's modified and must be restored afterwards.)
      776784b8
  26. 10 Oct, 2003 1 commit
    • unknown's avatar
      WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the · 04c6b9b8
      unknown authored
      (updated) Protocol_cursor class.
      Also did some bug fixes.
      
      
      Docs/sp-imp-spec.txt:
        Added CURSOR docs (and fixed typos)
      Docs/sp-implemented.txt:
        Updated for CURSORs
      include/mysqld_error.h:
        New error codes/messages for CURSORs
      libmysqld/Makefile.am:
        SP cursors now needs this.
      mysql-test/r/sp-error.result:
        New tests for cursors.
      mysql-test/r/sp.result:
        New tests for cursors.
      mysql-test/t/sp-error.test:
        New tests for cursors.
      mysql-test/t/sp.test:
        New tests for cursors.
      sql/protocol.cc:
        We now always have Protocol_cursor (SPs use it)
      sql/protocol.h:
        Fixed bugs in Protocol_cursor (for SPs)
      sql/protocol_cursor.cc:
        Fixed bugs in Protocol_cursor (for SPs)
      sql/share/czech/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/danish/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/dutch/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/english/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/estonian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/french/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/german/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/greek/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/hungarian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/italian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/japanese/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/korean/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/norwegian-ny/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/norwegian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/polish/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/portuguese/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/romanian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/russian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/serbian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/slovak/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/spanish/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/swedish/errmsg.txt:
        New error codes/messages for CURSORs
      sql/share/ukrainian/errmsg.txt:
        New error codes/messages for CURSORs
      sql/sp_head.cc:
        Added cursor support.
        Also fixed problems with item_lists, where pointers and ref_pointer_arrays.
      sql/sp_head.h:
        Added cursor support
      sql/sp_pcontext.cc:
        Added cursor support
      sql/sp_pcontext.h:
        Added cursor support
      sql/sp_rcontext.cc:
        Added cursor support, in particular the new sp_cursor class.
      sql/sp_rcontext.h:
        Added cursor support, in particular the new sp_cursor class.
      sql/sql_lex.h:
        We sometimes need to copy item_lists in LEX when executing substatements in SPs
      sql/sql_yacc.yy:
        Added minimal cursor support (not the full syntax yet).
      04c6b9b8
  27. 16 Sep, 2003 1 commit
    • unknown's avatar
      Implemented SP CONDITIONs and HANDLERs, with the extension of handling · 4deedf62
      unknown authored
      MySQL error codes as well.
      (No UNDO HANDLERs yet, and no SIGNAL or RESIGNAL.)
      WL#850
      
      
      Docs/sp-imp-spec.txt:
        Spec of CONDITIONs and HANDLERs (and updated some old stuff too).
      Docs/sp-implemented.txt:
        Updated info about caching, CONDITIONs and HANDLERs.
      include/mysqld_error.h:
        New error for undeclared CONDITION.
      libmysqld/Makefile.am:
        New file: sp_rcontext.cc.
      mysql-test/r/sp-error.result:
        New tests for CONDITIONs and HANDLERs.
      mysql-test/r/sp.result:
        New tests for CONDITIONs and HANDLERs.
      mysql-test/t/sp-error.test:
        New tests for CONDITIONs and HANDLERs.
      mysql-test/t/sp.test:
        New tests for CONDITIONs and HANDLERs.
      sql/Makefile.am:
        New file: sp_rcontext.cc.
      sql/lex.h:
        New symbols for CONDITIONs, HANDLERs and CURSORs.
      sql/mysqld.cc:
        Catch error if we have a handler for it.
      sql/protocol.cc:
        Catch error if we have a handler for it.
      sql/share/czech/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/danish/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/dutch/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/english/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/estonian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/french/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/german/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/greek/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/hungarian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/italian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/japanese/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/korean/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/norwegian-ny/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/norwegian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/polish/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/portuguese/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/romanian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/russian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/serbian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/slovak/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/spanish/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/swedish/errmsg.txt:
        New error for undeclared CONDITION.
      sql/share/ukrainian/errmsg.txt:
        New error for undeclared CONDITION.
      sql/sp_head.cc:
        New HANDLER code.
      sql/sp_head.h:
        New HANDLER code.
      sql/sp_pcontext.cc:
        New CONDITION and HANDLER code.
      sql/sp_pcontext.h:
        New CONDITION and HANDLER code.
      sql/sp_rcontext.h:
        New CONDITION and HANDLER code.
      sql/sql_yacc.yy:
        New CONDITION and HANDLER code.
      4deedf62
  28. 26 Feb, 2003 1 commit
    • unknown's avatar
      Made stored FUNCTION invokation work almost always. Still buggy and unstable, and · 76b037dc
      unknown authored
      various known problems, but good enough for a checkpoint commit.
      
      
      mysql-test/r/sp.result:
        New tests for invoking simple FUNCTIONs.
      mysql-test/t/sp.test:
        New tests for invoking simple FUNCTIONs.
      sql/item_func.cc:
        New Item_func_sp for stored FUNCTIONs.
      sql/item_func.h:
        New Item_func_sp for stored FUNCTIONs.
      sql/sp.cc:
        Close mysql.proc table earlier so recursive find_function calls work.
        Added temporary sp_function_exists() function for checking without parsing.
      sql/sp.h:
        Added temporary sp_function_exists() function for checking without parsing.
      sql/sp_head.cc:
        New code for executing a FUNCTION. (And reworked some of the old code in the process.)
      sql/sp_head.h:
        New code for executing a FUNCTION.
      sql/sp_rcontext.h:
        Added result slot for FUNCTIONs.
      sql/sql_lex.cc:
        Added check for stored FUNCTION, analogous to UDFs.
      sql/sql_parse.cc:
        sp_head::execute was renamed into execute_procedure.
      sql/sql_yacc.yy:
        Added parsing of stored FUNCTION invocation and code generation for RETURN statement.
      76b037dc
  29. 08 Dec, 2002 1 commit
    • unknown's avatar
      Simplistic, experimental framework for Stored Procedures (SPs). · 27de9ece
      unknown authored
      Implements creation and dropping of PROCEDUREs, IN, OUT, and INOUT parameters,
      single-statement procedures, rudimentary multi-statement (begin-end) prodedures
      (when the client can handle it), and local variables.
      Missing most of the embedded SQL language, all attributes, FUNCTIONs, error handling,
      reparses procedures at each call (no caching), etc, etc.
      Certainly buggy too, but procedures can actually be created and called....
      
      
      sql/Makefile.am:
        Added SP files.
      sql/item.cc:
        Added this*_item() methods for Item_splocal. (SP local variable)
      sql/item.h:
        Added this*_item() methods for SPs in Item, and the new Item_splocal
        class (SP local variable).
      sql/lex.h:
        Added new symbols for SPs. (Note: SPSET is temporary and will go away later.)
      sql/sql_class.cc:
        Initialize SP runtime context in THD.
      sql/sql_class.h:
        Add SP runtime context to THD.
      sql/sql_lex.cc:
        Init. buf pointer to beginning of command (needed by SPs).
        Also initialize SP head and parse time context.
      sql/sql_lex.h:
        New SQLCOM_ tags for SPs, and added pointer to beginning of command pointer and
        SP head and parse-time context to LEX.
      sql/sql_parse.cc:
        Added SQLCOM_CREATE_PROCEDURE, _CALL, _ALTER_PROCEDURE and _DROP_PROCEDURE cases.
        (Still rudimentary and lacking proper error handling...)
      sql/sql_yacc.yy:
        Lots and lots of additions for SPs...
        (Still even more missing, and no error messages...)
      27de9ece