MySQL Internals Manual  /  Stored Programs  /  Stored Program Parser

15.4 Stored Program Parser

There is no Stored Program Parser as such, there is only one parser in the SQL layer in the server. This parser is capable of understanding every SQL statement, including statements related to Stored Programs. The parser is implemented as an ascendant parser, using bison. The source code is located in the file sql/sql_yacc.yy.

The parts of the parser dedicated more specially to Stored Programs are starting at the following rules:

  • CREATE PROCEDURE : see rule sp_tail,

  • CREATE FUNCTION : see rule sp_tail,

  • CREATE TRIGGER : see rule trigger_tail,

  • CREATE EVENT : see rule event_tail.

In every case, the parser reads the SQL text stream that represents the code as input, and creates an internal representation of the Stored Program as output, with one C++ object of type sp_head. A limiting consequence of this approach is that a stored program does not support nesting: it is impossible to embed one CREATE PROCEDURE into another, since the parser currently may only support one sp_head object at a time.

Download this Manual
EPUB - 0.8Mb
User Comments
Sign Up Login You must be logged in to post a comment.