PL/SQL parser
(MDEV-10142)
|
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Stored routines |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.3.1 |
| Type: | Technical task | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | refactoring | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18 | ||||||||
| Description |
|
In order to reuse sp_head for new classes behind Oracle-style packages ( 1. sp_head has a member st_sp_chistics *m_chistics, which can point in different moments of time to memory of different nature:
This is very hard to follow and is bug prone. 2. Having st_sp_chistics *m_chistics (as a pointer) rather than st_sp_chistics m_chistics (as a structure) is simply pointless, because:
We'll do the following: 2. Move m_chistics to the private section, to disallow initialization of its components to arbitrary memory types. sp_head::set_info() will make sure that m_chistics.comment.str is set either to NULL, or to a memory allocated on sp_head::mem_root. 3. Introduce a few methods to access m_chistics components for read and write. Btw, this will also make the calling code shorter and easier to read. 4. Fix the parser to set sp_head::m_chistics immediately after scanning the sp_c_chistics rule. This is much easier to read (comparing to a postponed initialization, from Lex->sp_chistics). 5. Add initialization of sp_head::m_created and sp_head::m_modified at contructor time. This is much reasier to follow (compating to a postponed initialization, e.g. by set_info())). 6. Remove redundant code.
7. Introduce a new class Sp_chistics, derived from st_sp_chistics, with automatic initialization. Reuse this class instead of st_sp_chistics when applicable, and remove tones of duplicate bzero's. 8. Fix show_create_sp() to accept st_sp_chistics as a reference, rather than as a pointer:
|
| Comments |
| Comment by Alexander Barkov [ 2017-07-12 ] |
|
Pushed to bb-10.2-ext |