Class InformixSqlParser
- All Implemented Interfaces:
SqlParser
This parser handles Informix-specific SQL syntax including:
- Informix stored procedures and functions
- Informix triggers
- Informix execute statements
- Special token handling (CONNECT TO, LOCK TABLE, etc.)
Design Notes:
- Extends
AbstractSqlParserusing the template method pattern - Uses
TLexerInformixfor tokenization - Uses
TParserInformixfor parsing - Delimiter character: ';' for SQL statements
Usage 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();
- Since:
- 3.2.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gudusoft.gsqlparser.parser.AbstractSqlParser
AbstractSqlParser.PreparedSqlReader -
Field Summary
FieldsFields inherited from class gudusoft.gsqlparser.parser.AbstractSqlParser
defaultDelimiterStr, delimiterChar, frameStack, globalContext, globalFrame, lexer, parserContext, sourcetokenlist, sqlcmds, sqlEnv, sqlstatements, syntaxErrors, vendor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCall Informix-specific raw statement extraction logic.protected TCustomLexergetLexer(ParserContext context) Return the Informix lexer instance.protected TCustomParsergetParser(ParserContext context, TSourceTokenList tokens) Return the Informix SQL parser instance with updated token list.protected TCustomParsergetSecondaryParser(ParserContext context, TSourceTokenList tokens) No secondary parser for Informix (only Oracle has dual parsers).protected voidperformInterpreter(ParserContext context, TStatementList statements) Perform interpretation (AST evaluation).protected TStatementListperformParsing(ParserContext context, TCustomParser parser, TCustomParser secondaryParser, TSourceTokenList tokens, TStatementList rawStatements) Parse all raw statements.protected voidperformSemanticAnalysis(ParserContext context, TStatementList statements) Perform semantic analysis using TSQLResolver.protected voidSetup parsers for raw statement extraction.protected voidCall Informix-specific tokenization logic.toString()Methods inherited from class gudusoft.gsqlparser.parser.AbstractSqlParser
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, towinlinebreak
-
Field Details
-
flexer
The Informix lexer used for tokenization
-
-
Constructor Details
-
InformixSqlParser
public InformixSqlParser()Construct Informix SQL parser.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.
-
-
Method Details
-
getLexer
Return the Informix lexer instance.- Specified by:
getLexerin classAbstractSqlParser- Parameters:
context- the parser context- Returns:
- configured lexer instance (never null)
-
getParser
Return the Informix SQL parser instance with updated token list.- Specified by:
getParserin classAbstractSqlParser- Parameters:
context- the parser contexttokens- the source token list- Returns:
- configured parser instance (never null)
-
tokenizeVendorSql
Call Informix-specific tokenization logic.Delegates to doinformixtexttotokenlist which handles Informix's special token transformations and statement recognition.
- Specified by:
tokenizeVendorSqlin classAbstractSqlParser
-
setupVendorParsersForExtraction
Setup parsers for raw statement extraction.Informix uses a single parser (no secondary parser like Oracle).
- Specified by:
setupVendorParsersForExtractionin classAbstractSqlParser
-
extractVendorRawStatements
Call Informix-specific raw statement extraction logic.Delegates to doinformixgetrawsqlstatements which handles Informix's statement boundary detection and stored procedure recognition.
- Specified by:
extractVendorRawStatementsin classAbstractSqlParser- Parameters:
builder- the result builder to populate with raw statements
-
getSecondaryParser
No secondary parser for Informix (only Oracle has dual parsers).- Overrides:
getSecondaryParserin classAbstractSqlParser- Parameters:
context- the parser contexttokens- the source token list- Returns:
- secondary parser instance, or null if not needed
-
performParsing
protected TStatementList performParsing(ParserContext context, TCustomParser parser, TCustomParser secondaryParser, TSourceTokenList tokens, TStatementList rawStatements) Parse all raw statements.Migrated from TGSqlParser.doparse() with Informix-specific handling.
- Specified by:
performParsingin classAbstractSqlParser- Parameters:
context- the parser contextparser- the main parser instancesecondaryParser- secondary parser (may be null)tokens- the source token listrawStatements- raw statements already extracted (never null)- Returns:
- statement list with parsed AST (never null)
-
performSemanticAnalysis
Perform semantic analysis using TSQLResolver.Inherited pattern from AbstractSqlParser with Informix-specific context.
- Overrides:
performSemanticAnalysisin classAbstractSqlParser- Parameters:
context- the parser contextstatements- the parsed statements (mutable)
-
performInterpreter
Perform interpretation (AST evaluation).Inherited pattern from AbstractSqlParser with Informix-specific context.
- Overrides:
performInterpreterin classAbstractSqlParser- Parameters:
context- the parser contextstatements- the parsed statements (mutable)
-
toString
- Overrides:
toStringin classAbstractSqlParser
-