Skip to content
  • Roy Lyseng's avatar
    447c4cc3
    WL#5094 Create SQL command classes for DML statements · 447c4cc3
    Roy Lyseng authored
    Refined the class Sql_cmd_dml as a subclass of Sql_cmd for processing
    of SQL DML statements. Subclasses of Sql_cmd_dml are created for these
    classes of SQL statements:
    
    - SELECT
    - INSERT ... VALUES, INSERT ... SELECT
    - UPDATE (both single-table and multi-table variation)
    - DELETE (both single-table and multi-table variation)
    - DO
    - CALL
    
    Refactored processing of INSERT, UPDATE and DELETE statements for clear
    separation of preparation and execution code, as well as simplifying
    the execution logic.
    
    After this refactoring, most DML statements go through a fixed set of
    processes, each implemented using member functions, most of them virtual.
    SET statements and CREATE TABLE ... SELECT statements are still processed
    by handle_query() after this worklog, however.
    
    Preparing a statement goes through these processes:
    
    - precheck()
    - open_tables_for_query()
    - resolve_var_assignments()
    - prepare_inner() (the actual preparation code)
    - cleanup()
    
    Executing a statement goes through these processes:
    
    - set_statement_timer()
    - preparation (if not already done, otherwise precheck() and open_tables())
    - run_before_dml_hook() (if data change statement)
    - push_internal_handler() (if data change statement)
    - lock_tables()
    - query_cache.store_query()
    - execute_inner() (the actual optimization and execution code)
    - pop_internal_handler()
    - cleanup()
    - reset_statement_timer()
    
    Query_result objects are changed so that they are created for
    the duration of the statement object.
    447c4cc3
    WL#5094 Create SQL command classes for DML statements
    Roy Lyseng authored
    Refined the class Sql_cmd_dml as a subclass of Sql_cmd for processing
    of SQL DML statements. Subclasses of Sql_cmd_dml are created for these
    classes of SQL statements:
    
    - SELECT
    - INSERT ... VALUES, INSERT ... SELECT
    - UPDATE (both single-table and multi-table variation)
    - DELETE (both single-table and multi-table variation)
    - DO
    - CALL
    
    Refactored processing of INSERT, UPDATE and DELETE statements for clear
    separation of preparation and execution code, as well as simplifying
    the execution logic.
    
    After this refactoring, most DML statements go through a fixed set of
    processes, each implemented using member functions, most of them virtual.
    SET statements and CREATE TABLE ... SELECT statements are still processed
    by handle_query() after this worklog, however.
    
    Preparing a statement goes through these processes:
    
    - precheck()
    - open_tables_for_query()
    - resolve_var_assignments()
    - prepare_inner() (the actual preparation code)
    - cleanup()
    
    Executing a statement goes through these processes:
    
    - set_statement_timer()
    - preparation (if not already done, otherwise precheck() and open_tables())
    - run_before_dml_hook() (if data change statement)
    - push_internal_handler() (if data change statement)
    - lock_tables()
    - query_cache.store_query()
    - execute_inner() (the actual optimization and execution code)
    - pop_internal_handler()
    - cleanup()
    - reset_statement_timer()
    
    Query_result objects are changed so that they are created for
    the duration of the statement object.
Loading