Class MySqlSqlParser

Object
gudusoft.gsqlparser.parser.AbstractSqlParser
gudusoft.gsqlparser.parser.MySqlSqlParser
All Implemented Interfaces:
SqlParser

public class MySqlSqlParser extends AbstractSqlParser
MySQL database SQL parser implementation.

This parser handles MySQL-specific SQL syntax including:

  • MySQL stored procedures and functions
  • MySQL triggers
  • Custom delimiter support (DELIMITER command)
  • MySQL-specific DML/DDL
  • Special operators and functions
  • SOURCE command and \\. command

Design Notes:

  • Extends AbstractSqlParser
  • Can directly instantiate: TLexerMysql, TParserMysqlSql
  • Uses single parser (no secondary parser like Oracle's PL/SQL)
  • Delimiter character: ';' for SQL statements (configurable via DELIMITER command)

Usage Example:

 // Get MySQL parser from factory
 SqlParser parser = SqlParserFactory.get(EDbVendor.dbvmysql);

 // Build context
 ParserContext context = new ParserContext.Builder(EDbVendor.dbvmysql)
     .sqlText("SELECT * FROM employees WHERE dept_id = 10")
     .build();

 // Parse
 SqlParseResult result = parser.parse(context);

 // Access statements
 TStatementList statements = result.getSqlStatements();
 
Since:
3.2.0.0
See Also:
  • Field Details

    • flexer

      The MySQL lexer used for tokenization (public for TGSqlParser.getFlexer())
  • Constructor Details

    • MySqlSqlParser

      public MySqlSqlParser()
      Construct MySQL SQL parser.

      Configures the parser for MySQL database with default delimiter: semicolon (;)

      Following the original TGSqlParser pattern, the lexer and parser are created once in the constructor and reused for all parsing operations.

  • Method Details