WL#2999: Clean-up the stored procedure code
Affects: Server-5.0 — Status: Un-Assigned — Priority: High
During the work with bug fixes in the stored procedure code the need for unrelated (to the bug at hand) structure and style changes is occasionally spotted. (The SP code has been developed for a few years now and is beginning to show signs of "age".) Although fixing these issues is important, it's not of the same priority as the bugs at hand, and fixing it in the same patches would obscure the actual bugfixes. Therefore the clean-up should be done as a separate task. This is maintenance work only, and shall not contain any functional changes, but it will make future development and bugfixing easier. Suggested fixes for this task: - In sp.cc, move the issuing of error messages "inwards" to sp_find_routine*, more in style with the rest of the server code. - The sp_head class contains some data that are only used during parsing. Move this out to a separate class. E.g. the backpatch lists and some pointers used for the extraction of lexical elements. - A general revision of variable and class member names in the SP classes. Make sure things are named in a consistent manner. - Indentation and comment styles: Update according to coding style where other changes are made. I suggest that we limit this task to the above to keep it small. (Further maintenance can of course be scheduled in new tasks, for SPs and other code, if needed.) --------- In addition to the previous list, keeping track of the "next" instruction to execute can be simplified. Below is a quote from the review of BUG#8407, explaining the problem: " Another note is that our execution path for instruction execution becomes more and more hard to follow. instr->execute -> sp_lex_keeper::reset_lex_and_exec_core -> instr->open_and_lock_tables if error -> instr->get_cont_dest <- <- -> instr->exec_core (no call to get_cont_dest if error) <- <- "
Copyright (c) 2000, 2017, Oracle Corporation and/or its affiliates. All rights reserved.