Class CustomSQLParserListener

java.lang.Object
org.pgcodekeeper.core.parsers.antlr.base.CustomParserListener<PgDatabase>
org.pgcodekeeper.core.parsers.antlr.pg.CustomSQLParserListener
All Implemented Interfaces:
AntlrContextProcessor<SQLParser.SqlContext>, SqlContextProcessor

public final class CustomSQLParserListener extends CustomParserListener<PgDatabase> implements SqlContextProcessor
Custom ANTLR listener for parsing PostgreSQL SQL statements. Processes CREATE, ALTER, DROP statements and builds database schema model.
  • Constructor Details

    • CustomSQLParserListener

      public CustomSQLParserListener(PgDatabase database, String filename, ParserListenerMode mode, List<Object> errors, Queue<AntlrTask<?>> antlrTasks, IMonitor monitor, ISettings settings)
      Creates a new PostgreSQL SQL parser listener.
      Parameters:
      database - the target database schema to populate
      filename - name of the file being parsed
      mode - parsing mode
      errors - list to collect parsing errors
      antlrTasks - queue for asynchronous parsing tasks
      monitor - progress monitor for cancellation support
      settings - application settings
  • Method Details

    • process

      public void process(SQLParser.SqlContext rootCtx, org.antlr.v4.runtime.CommonTokenStream stream)
      Processes the complete SQL file context. Extracts and processes all statements in the file.
      Specified by:
      process in interface AntlrContextProcessor<SQLParser.SqlContext>
      Parameters:
      rootCtx - the root file context from ANTLR parser
      stream - the token stream associated with the context
    • statement

      public void statement(SQLParser.StatementContext statement, org.antlr.v4.runtime.CommonTokenStream stream)
      Processes a single SQL statement. Routes to appropriate handler based on statement type.
      Parameters:
      statement - the statement context to process
      stream - the token stream for the statement