MySQL Internals Manual  /  Stored Programs  /  Internal Representation

16.3 Internal Representation

A Stored Program is represented in memory by two major parts:

  • The code of the stored program, including SQL statements and control flow logic (IF, WHILE, ...),

  • A symbol table that describes all the local variables, cursors, labels, conditions ... declared in the code.

Individual instructions of various kind are implemented by all the C++ classes that inherit from class sp_instr. The symbol table ('symbol table' is a term used in conjunction with compilers or interpreters, in MySQL the term 'Parsing Context' is used instead) is implemented by the C++ class sp_pcontext. A Stored Program as a whole is represented by the C++ class sp_head, which contains the instructions (array m_instr) and the root parsing context (member m_pcont).


Class sp_head contains concepts from different areas: it represents both what a stored program is, which is the topic of this section, and how a stored program logic is used during runtime interpretation, which is the subject of other sections.

User Comments
Sign Up Login You must be logged in to post a comment.