• konstantin@mysql.com's avatar
    Implement WL#2661 "Prepared Statements: Dynamic SQL in Stored Procedures". · 38486e83
    konstantin@mysql.com authored
    The idea of the patch is to separate statement processing logic,
    such as parsing, validation of the parsed tree, execution and cleanup, 
    from global query processing logic, such as logging, resetting
    priorities of a thread, resetting stored procedure cache, resetting
    thread count of errors and warnings.
    This makes PREPARE and EXECUTE behave similarly to the rest of SQL
    statements and allows their use in stored procedures.
    This patch contains a change in behaviour:
    until recently for each SQL prepared statement command, 2 queries
    were written to the general log, e.g.
    [Query]   prepare stmt from @stmt_text;
    [Prepare] select * from t1 <-- contents of @stmt_text
    The chagne was necessary to prevent [Prepare] commands from being written
    to the general log when executing a stored procedure with Dynamic SQL.
    We should consider whether the old behavior is preferrable and probably
    restore it.
    This patch refixes Bug#7115, Bug#10975 (partially), Bug#10605 (various bugs
    in Dynamic SQL reported before it was disabled).
    38486e83
item_func.cc 115 KB