• unknown's avatar
    Bug#14635: Accept NEW.x as INOUT parameters to stored procedures · afe2520e
    unknown authored
    from within triggers
    
    Add support for passing NEW.x as INOUT and OUT parameters to stored
    procedures.  Passing NEW.x as INOUT parameter requires SELECT and
    UPDATE privileges on that column, and passing it as OUT parameter
    requires only UPDATE privilege.
    
    
    mysql-test/r/sp-error.result:
      Update the result for new message.
    mysql-test/r/trigger-grant.result:
      Add result for bug#14635.
    mysql-test/r/trigger.result:
      Add result for bug#14635.
    mysql-test/t/trigger-grant.test:
      Add test case for bug#14635.
    mysql-test/t/trigger.test:
      Add test case for bug#14635.
    sql/item.cc:
      Add implementations of set_value() and set_required_privilege() methods
      of Settable_routine_parameter interface.
      
      Use Item_trigger_field::want_privilege instead of
      Item_trigger_field::access_type.
      
      Reset privileges on Item_trigger_field::cleanup().
    sql/item.h:
      Add interface class Settable_routine_parameter and interface query
      method to Item class.  Item_splocal and Item_trigger_field implement
      this interface.
      
      For Item_trigger_field:
       - add read_only attribute and is_read_only() method.
       - remove access_type and add original_privilege and want_privilege
         instead.
       - add set_value() method.
       - add reset_privilege() method.
    sql/item_func.cc:
      Add implementations of set_value() method of Settable_routine_parameter
      interface.
    sql/item_func.h:
      Item_func_get_user_var implements Settable_routine_parameter interface.
    sql/share/errmsg.txt:
      Update english ER_SP_NOT_VAR_ARG message.
    sql/sp_head.cc:
      Use Settable_routine_parameter interface for parameter update.
    sql/sql_yacc.yy:
      Set read_only and want_privilege members in Item_trigger_field
      appropriately.  For NEW.x trigger variable used in left-hand-side
      of SET statement the latter is set to UPDATE_ACL, otherwise it is
      set to SELECT_ACL (but see Item_trigger_field::set_required_privilege(),
      where it may be updated to different value).
    afe2520e
item_func.h 39.3 KB