Package org.firebirdsql.jaybird.parser
Class StatementDetector
- java.lang.Object
-
- org.firebirdsql.jaybird.parser.StatementDetector
-
- All Implemented Interfaces:
TokenVisitor
@InternalApi public final class StatementDetector extends java.lang.Object implements TokenVisitor
Detects the type of statement, and - optionally - whether a DML statement has aRETURNING
clause.If the detected statement type is
UPDATE
,DELETE
,INSERT
,UPDATE OR INSERT
andMERGE
, it identifies the affected table and - optionally - whether or not aRETURNING
clause is present (delegated to aReturningClauseDetector
).The types of statements detected are informed by the needs of Jaybird, and may change between point releases.
- Since:
- 5
- Author:
- Mark Rotteveel
-
-
Constructor Summary
Constructors Constructor Description StatementDetector()
Detect statement type and returning clause.StatementDetector(boolean detectReturning)
Detect statement type and - optionally - returning clause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
complete(VisitorRegistrar visitorRegistrar)
Signals that the last token was produced and the statement text was fully parsed.LocalStatementType
getStatementType()
StatementIdentification
toStatementIdentification()
void
visitToken(Token token, VisitorRegistrar visitorRegistrar)
Notifies the visitor of a token.
-
-
-
Constructor Detail
-
StatementDetector
public StatementDetector()
Detect statement type and returning clause.- See Also:
StatementDetector(boolean)
-
StatementDetector
public StatementDetector(boolean detectReturning)
Detect statement type and - optionally - returning clause.- Parameters:
detectReturning
-true
detect returning clause,false
do not detect returning clause
-
-
Method Detail
-
visitToken
public void visitToken(Token token, VisitorRegistrar visitorRegistrar)
Description copied from interface:TokenVisitor
Notifies the visitor of a token.- Specified by:
visitToken
in interfaceTokenVisitor
- Parameters:
token
- TokenvisitorRegistrar
- Visitor registrar (can be used to remove itself, or add other visitors)
-
complete
public void complete(VisitorRegistrar visitorRegistrar)
Description copied from interface:TokenVisitor
Signals that the last token was produced and the statement text was fully parsed.- Specified by:
complete
in interfaceTokenVisitor
- Parameters:
visitorRegistrar
- Visitor registrar (can be used to remove itself, or add other visitors)
-
toStatementIdentification
public StatementIdentification toStatementIdentification()
-
getStatementType
public LocalStatementType getStatementType()
- Returns:
- detected statement type,
UNKNOWN
when no tokens have been received (nothing was parsed)
-
-