public class InformixSqlParser extends AbstractSqlParser
This parser handles Informix-specific SQL syntax including:
Design Notes:
AbstractSqlParser using the template method patternTLexerInformix for tokenizationTParserInformix for parsingUsage Example:
// Get Informix parser from factory
SqlParser parser = SqlParserFactory.get(EDbVendor.dbvinformix);
// Build context
ParserContext context = new ParserContext.Builder(EDbVendor.dbvinformix)
.sqlText("SELECT * FROM customer WHERE customer_num = 101")
.build();
// Parse
SqlParseResult result = parser.parse(context);
// Access statements
TStatementList statements = result.getSqlStatements();
SqlParser,
AbstractSqlParser,
TLexerInformix,
TParserInformixAbstractSqlParser.PreparedSqlReader| Modifier and Type | Field and Description |
|---|---|
TLexerInformix |
flexer
The Informix lexer used for tokenization
|
defaultDelimiterStr, delimiterChar, frameStack, globalContext, globalFrame, lexer, parserContext, sourcetokenlist, sqlcmds, sqlEnv, sqlstatements, syntaxErrors, vendor| Constructor and Description |
|---|
InformixSqlParser()
Construct Informix SQL parser.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
extractVendorRawStatements(SqlParseResult.Builder builder)
Call Informix-specific raw statement extraction logic.
|
protected TCustomLexer |
getLexer(ParserContext context)
Return the Informix lexer instance.
|
protected TCustomParser |
getParser(ParserContext context,
TSourceTokenList tokens)
Return the Informix SQL parser instance with updated token list.
|
protected TCustomParser |
getSecondaryParser(ParserContext context,
TSourceTokenList tokens)
No secondary parser for Informix (only Oracle has dual parsers).
|
protected void |
performInterpreter(ParserContext context,
TStatementList statements)
Perform interpretation (AST evaluation).
|
protected TStatementList |
performParsing(ParserContext context,
TCustomParser parser,
TCustomParser secondaryParser,
TSourceTokenList tokens,
TStatementList rawStatements)
Parse all raw statements.
|
protected void |
performSemanticAnalysis(ParserContext context,
TStatementList statements)
Perform semantic analysis using TSQLResolver.
|
protected void |
setupVendorParsersForExtraction()
Setup parsers for raw statement extraction.
|
protected void |
tokenizeVendorSql()
Call Informix-specific tokenization logic.
|
String |
toString() |
afterStatementParsed, attemptErrorRecovery, copyErrorsFromStatement, doAfterTokenize, doExtractRawStatements, extractRawStatements, getanewsourcetoken, getDefaultDelimiterStr, getDelimiterChar, getErrorCount, getrawsqlstatements, getSyntaxErrors, getVendor, handleStatementParsingException, initializeGlobalContext, isDollarFunctionDelimiter, onRawStatementComplete, onRawStatementCompleteVendorSpecific, parse, performTokenization, prepareSqlReader, processTokensBeforeParse, processTokensInTokenTable, setTokenHandle, tokenize, towinlinebreakpublic TLexerInformix flexer
public InformixSqlParser()
Configures the parser for Informix database with default delimiter (;).
Following the original TGSqlParser pattern, the lexer and parser are created once in the constructor and reused for all parsing operations.
protected TCustomLexer getLexer(ParserContext context)
getLexer in class AbstractSqlParsercontext - the parser contextprotected TCustomParser getParser(ParserContext context, TSourceTokenList tokens)
getParser in class AbstractSqlParsercontext - the parser contexttokens - the source token listprotected void tokenizeVendorSql()
Delegates to doinformixtexttotokenlist which handles Informix's special token transformations and statement recognition.
tokenizeVendorSql in class AbstractSqlParserprotected void setupVendorParsersForExtraction()
Informix uses a single parser (no secondary parser like Oracle).
setupVendorParsersForExtraction in class AbstractSqlParserprotected void extractVendorRawStatements(SqlParseResult.Builder builder)
Delegates to doinformixgetrawsqlstatements which handles Informix's statement boundary detection and stored procedure recognition.
extractVendorRawStatements in class AbstractSqlParserbuilder - the result builder to populate with raw statementsprotected TCustomParser getSecondaryParser(ParserContext context, TSourceTokenList tokens)
getSecondaryParser in class AbstractSqlParsercontext - the parser contexttokens - the source token listprotected TStatementList performParsing(ParserContext context, TCustomParser parser, TCustomParser secondaryParser, TSourceTokenList tokens, TStatementList rawStatements)
Migrated from TGSqlParser.doparse() with Informix-specific handling.
performParsing in class AbstractSqlParsercontext - the parser contextparser - the main parser instancesecondaryParser - secondary parser (may be null)tokens - the source token listrawStatements - raw statements already extracted (never null)protected void performSemanticAnalysis(ParserContext context, TStatementList statements)
Inherited pattern from AbstractSqlParser with Informix-specific context.
performSemanticAnalysis in class AbstractSqlParsercontext - the parser contextstatements - the parsed statements (mutable)protected void performInterpreter(ParserContext context, TStatementList statements)
Inherited pattern from AbstractSqlParser with Informix-specific context.
performInterpreter in class AbstractSqlParsercontext - the parser contextstatements - the parsed statements (mutable)public String toString()
toString in class AbstractSqlParser