• unknown's avatar
    WL#4165 "Prepared statements: validation". · bd2a7328
    unknown authored
    Add metadata validation to ~20 more SQL commands. Make sure that
    these commands actually work in ps-protocol, since until now they
    were enabled, but not carefully tested.
    Fixes the ml003 bug found by Matthias during internal testing of the
    patch.
    
    
    mysql-test/r/ps_ddl.result:
      Update test results (WL#4165)
    mysql-test/t/ps_ddl.test:
      Cover with tests metadata validation of 26 SQL statements.
    sql/mysql_priv.h:
      Fix the name in the comment.
    sql/sp_head.cc:
      Changed the way the observer is removed in case of stored procedures
      to support validation prepare stmt from "call p1(<expr>)": whereas
      tables used in the expression must be validated, substatements
      of p1 must not.
      The previous scheme used to silence the observer only in stored
      functions and triggers.
    sql/sql_class.cc:
      Now the observer is silenced in sp_head::execute(). Remove it from
      Sub_statement_state.
    sql/sql_class.h:
      Now the observer is silenced in sp_head::execute(). Remove it from
      Sub_statement_state.
    sql/sql_parse.cc:
      Add CF_REEXECUTION_FRAGILE to 20 more SQLCOMs that need it.
    sql/sql_prepare.cc:
      Add metadata validation to ~20 new SQLCOMs that need it.
      Fix memory leaks with expressions used in SHOW DATABASES and CALL
      (and prepared statements).
      We need to fix all expressions at prepare, since if these expressions
      use subqueries, there are one-time transformations of the parse
      tree that must be done at prepare. 
      List of fixed commands includes: SHOW TABLES, SHOW DATABASES,
      SHOW TRIGGERS, SHOW EVENTS, SHOW OPEN TABLES,SHOW KEYS, SHOW FIELDS, 
      SHOW COLLATIONS, SHOW CHARSETS, SHOW VARIABLES, SHOW TATUS, SHOW TABLE
      STATUS, SHOW PROCEDURE STATUS, SHOW FUNCTION STATUS, CALL.
      Add comment to set_parameters().
    sql/table.h:
      Update comments.
    bd2a7328
mysql_priv.h 93.8 KB