public final class SqlParseResult extends Object
This value object encapsulates all outputs produced by SQL parsing, providing clean separation between parser implementation and result data. Once built, a SqlParseResult instance cannot be modified (immutable).
Design Pattern: Value Object + Builder
Contents:
Usage Example:
SqlParseResult result = parser.parse(context);
// Check for errors
if (result.hasErrors()) {
System.err.println(result.getErrorMessage());
return;
}
// Access parsed statements
TStatementList statements = result.getSqlStatements();
for (int i = 0; i < statements.size(); i++) {
TCustomSqlStatement stmt = statements.get(i);
// Process statement...
}
SqlParser,
ParserContext| Modifier and Type | Class and Description |
|---|---|
static class |
SqlParseResult.Builder
Builder for constructing SqlParseResult instances.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getErrorCode()
Get the error code.
|
String |
getErrorMessage()
Get the error message if parsing failed.
|
long |
getInterpreterTimeMs()
Get interpreter time in milliseconds.
|
TSourceToken |
getLastTokenOfStatementBeenValidated() |
TCustomLexer |
getLexer()
Get the lexer instance (for backward compatibility).
|
TCustomParser |
getParser()
Get the parser instance (for backward compatibility).
|
long |
getParsingTimeMs()
Get parsing time in milliseconds.
|
TCustomParser |
getSecondaryParser()
Get the secondary parser instance (for Oracle PL/SQL parser).
|
long |
getSemanticAnalysisTimeMs()
Get semantic analysis time in milliseconds.
|
TSourceTokenList |
getSourceTokenList()
Get the list of source tokens.
|
TStatementList |
getSqlStatements()
Get the list of parsed SQL statements.
|
ArrayList<TSyntaxError> |
getSyntaxErrors()
Get detailed syntax errors.
|
long |
getTokenizationTimeMs()
Get tokenization time in milliseconds.
|
long |
getTotalTimeMs()
Get total time (all phases combined) in milliseconds.
|
boolean |
hasErrors()
Check if parsing resulted in errors.
|
boolean |
isSuccessful()
Check if parsing was successful.
|
String |
toString() |
public TSourceToken getLastTokenOfStatementBeenValidated()
public TSourceTokenList getSourceTokenList()
public TStatementList getSqlStatements()
public String getErrorMessage()
public int getErrorCode()
public ArrayList<TSyntaxError> getSyntaxErrors()
public long getTokenizationTimeMs()
public long getParsingTimeMs()
public long getSemanticAnalysisTimeMs()
public long getInterpreterTimeMs()
public long getTotalTimeMs()
public TCustomLexer getLexer()
public TCustomParser getParser()
public TCustomParser getSecondaryParser()
public boolean hasErrors()
public boolean isSuccessful()