Top Description Fields Constructors Methods
org.hibernate.hql.internal.antlr

public Class SqlGeneratorBase

extends TreeParser
implements SqlTokenTypes
Class Inheritance
All Implemented Interfaces
org.hibernate.hql.internal.antlr.SqlTokenTypes
Known Direct Subclasses
org.hibernate.hql.internal.ast.SqlGenerator
Imports
antlr.TreeParser, .Token, .RecognitionException, .ANTLRException, .NoViableAltException, .MismatchedTokenException, .SemanticException, .ASTPair, antlr.collections.AST, antlr.collections.impl.BitSet, .ASTArray

SQL Generator Tree Parser, providing SQL rendering of SQL ASTs produced by the previous phase, HqlSqlWalker. All syntax decoration such as extra spaces, lack of spaces, extra parens, etc. should be added by this class.
This grammar processes the HQL/SQL AST and produces an SQL string. The intent is to move dialect-specific code into a sub-class that will override some of the methods, just like the other two grammars in this system.
Author
Joshua Davis ([email protected])

Field Summary

Modifier and TypeField and Description
public static final String[]
public static final BitSet
public static final BitSet
public static final BitSet
public static final BitSet
public static final BitSet
public static final BitSet
private StringBuilder
buf

the buffer resulting SQL statement is written to

private boolean
protected List<StringBuilder>
Inherited from antlr.TreeParser:
_retTreeastFactoryASTNULLinputStatereturnASTtokenNamestraceDepth

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
public final void
public final void
public final void
public final void
protected void
protected void
public final void
public final void
booleanExpr(AST _t, boolean parens)

public final void
booleanOp(AST _t, boolean parens)

protected void
protected void
public final void
public final void
public final void
public final void
comparisonExpr(AST _t, boolean parens)

public final void
public final void
public final void
count(AST _t)

public final void
public final void
public final void
protected void
public final void
public final void
expr(AST _t)

public final void
public final void
from(AST _t)

protected void
public final void
protected int
getLastChar()

Returns the last character written to the output, or -1 if there isn't one.

protected StringBuilder
public final void
protected boolean
public final void
inList(AST _t)

public final void
public final void
public final void
public final void
private static final long[]
private static final long[]
private static final long[]
private static final long[]
private static final long[]
private static final long[]
public final void
public final void
public final void
protected void
public final String
public final void
protected void
nyi(AST n)

protected void
optionalSpace()

Add a aspace if the previous token was not a space or a parenthesis.

public final void
public final void
protected void
protected void
out(AST n)

public final void
public final void
public final void
protected void
renderCollectionSize(AST collectionSizeNode)

protected String
renderOrderByElement(String expression, String order, String nulls)

Implementation Note

This is just a stub.

protected String
public final void
public final void
selectBooleanExpr(AST _t, boolean parens)

public final void
public final void
public final void
public final void
protected void
public final void
public final void
public final void
public final void
public final void
public final void
public final void
tableJoin(AST _t, AST parent)

public final void
public final void
public final void
public final void
public final void
public final void
Inherited from antlr.TreeParser:
getASTgetASTFactorygetTokenNamegetTokenNamesmatchmatchmatchNotpanicreportErrorreportErrorreportWarningsetASTFactorysetASTNodeClasssetASTNodeTypetraceIntraceIndenttraceOut

Field Detail

_tokenNamesback to summary
public static final String[] _tokenNames
_tokenSet_0back to summary
public static final BitSet _tokenSet_0
_tokenSet_1back to summary
public static final BitSet _tokenSet_1
_tokenSet_2back to summary
public static final BitSet _tokenSet_2
_tokenSet_3back to summary
public static final BitSet _tokenSet_3
_tokenSet_4back to summary
public static final BitSet _tokenSet_4
_tokenSet_5back to summary
public static final BitSet _tokenSet_5
bufback to summary
private StringBuilder buf

the buffer resulting SQL statement is written to

captureExpressionback to summary
private boolean captureExpression
exprsback to summary
protected List<StringBuilder> exprs

Constructor Detail

SqlGeneratorBaseback to summary
public SqlGeneratorBase()

Method Detail

additiveExprback to summary
public final void additiveExpr(AST _t) throws RecognitionException
addrExprback to summary
public final void addrExpr(AST _t) throws RecognitionException
aggregateback to summary
public final void aggregate(AST _t) throws RecognitionException
argumentsback to summary
public final void arguments(AST _t) throws RecognitionException
arithmeticExprback to summary
public final void arithmeticExpr(AST _t) throws RecognitionException
beginFunctionTemplateback to summary
protected void beginFunctionTemplate(AST m, AST i)
betweenFunctionArgumentsback to summary
protected void betweenFunctionArguments()
binaryComparisonExpressionback to summary
public final void binaryComparisonExpression(AST _t) throws RecognitionException
booleanExprback to summary
public final void booleanExpr(AST _t, boolean parens) throws RecognitionException
booleanOpback to summary
public final void booleanOp(AST _t, boolean parens) throws RecognitionException
captureExpressionFinishback to summary
protected void captureExpressionFinish()
captureExpressionStartback to summary
protected void captureExpressionStart()
caseExprback to summary
public final void caseExpr(AST _t) throws RecognitionException
castExpressionback to summary
public final void castExpression(AST _t) throws RecognitionException
castTargetTypeback to summary
public final void castTargetType(AST _t) throws RecognitionException
comparisonExprback to summary
public final void comparisonExpr(AST _t, boolean parens) throws RecognitionException
conditionListback to summary
public final void conditionList(AST _t) throws RecognitionException
constantback to summary
public final void constant(AST _t) throws RecognitionException
countback to summary
public final void count(AST _t) throws RecognitionException
countExprback to summary
public final void countExpr(AST _t) throws RecognitionException
deleteStatementback to summary
public final void deleteStatement(AST _t) throws RecognitionException
distinctOrAllback to summary
public final void distinctOrAll(AST _t) throws RecognitionException
endFunctionTemplateback to summary
protected void endFunctionTemplate(AST m)
exoticComparisonExpressionback to summary
public final void exoticComparisonExpression(AST _t) throws RecognitionException
exprback to summary
public final void expr(AST _t) throws RecognitionException
filtersback to summary
public final void filters(AST _t) throws RecognitionException
fromback to summary
public final void from(AST _t) throws RecognitionException
fromFragmentSeparatorback to summary
protected void fromFragmentSeparator(AST a)
fromTableback to summary
public final void fromTable(AST _t) throws RecognitionException
getLastCharback to summary
protected int getLastChar()

Returns the last character written to the output, or -1 if there isn't one.

getStringBuilderback to summary
protected StringBuilder getStringBuilder()
groupExprsback to summary
public final void groupExprs(AST _t) throws RecognitionException
hasTextback to summary
protected boolean hasText(AST a)
inListback to summary
public final void inList(AST _t) throws RecognitionException
insertStatementback to summary
public final void insertStatement(AST _t) throws RecognitionException
likeEscapeback to summary
public final void likeEscape(AST _t) throws RecognitionException
mapComponentReferenceback to summary
public final void mapComponentReference(AST _t) throws RecognitionException
methodCallback to summary
public final void methodCall(AST _t) throws RecognitionException
mk_tokenSet_0back to summary
private static final long[] mk_tokenSet_0()
mk_tokenSet_1back to summary
private static final long[] mk_tokenSet_1()
mk_tokenSet_2back to summary
private static final long[] mk_tokenSet_2()
mk_tokenSet_3back to summary
private static final long[] mk_tokenSet_3()
mk_tokenSet_4back to summary
private static final long[] mk_tokenSet_4()
mk_tokenSet_5back to summary
private static final long[] mk_tokenSet_5()
multiplicativeExprback to summary
public final void multiplicativeExpr(AST _t) throws RecognitionException
nestedExprback to summary
public final void nestedExpr(AST _t) throws RecognitionException
nestedExprAfterMinusDivback to summary
public final void nestedExprAfterMinusDiv(AST _t) throws RecognitionException
nestedFromFragmentback to summary
protected void nestedFromFragment(AST d, AST parent)
nullOrderingback to summary
public final String nullOrdering(AST _t) throws RecognitionException
nullPrecedenceback to summary
public final void nullPrecedence(AST _t) throws RecognitionException
nyiback to summary
protected void nyi(AST n)
optionalSpaceback to summary
protected void optionalSpace()

Add a aspace if the previous token was not a space or a parenthesis.

orderDirectionback to summary
public final void orderDirection(AST _t) throws RecognitionException
orderExprsback to summary
public final void orderExprs(AST _t) throws RecognitionException
outback to summary
protected void out(String s)
outback to summary
protected void out(AST n)
parameterback to summary
public final void parameter(AST _t) throws RecognitionException
parenSelectback to summary
public final void parenSelect(AST _t) throws RecognitionException
quantifiedback to summary
public final void quantified(AST _t) throws RecognitionException
renderCollectionSizeback to summary
protected void renderCollectionSize(AST collectionSizeNode)
renderOrderByElementback to summary
protected String renderOrderByElement(String expression, String order, String nulls)

Implementation Note

This is just a stub. SqlGenerator contains the effective implementation.

resetCaptureback to summary
protected String resetCapture()
selectAtomback to summary
public final void selectAtom(AST _t) throws RecognitionException
selectBooleanExprback to summary
public final void selectBooleanExpr(AST _t, boolean parens) throws RecognitionException
selectClauseback to summary
public final void selectClause(AST _t) throws RecognitionException
selectColumnback to summary
public final void selectColumn(AST _t) throws RecognitionException
selectExprback to summary
public final void selectExpr(AST _t) throws RecognitionException
selectStatementback to summary
public final void selectStatement(AST _t) throws RecognitionException
separatorback to summary
protected void separator(AST n, String sep)
setClauseback to summary
public final void setClause(AST _t) throws RecognitionException
simpleExprback to summary
public final void simpleExpr(AST _t) throws RecognitionException
simpleExprListback to summary
public final void simpleExprList(AST _t) throws RecognitionException
simpleOrTupleExprback to summary
public final void simpleOrTupleExpr(AST _t) throws RecognitionException
sqlTokenback to summary
public final void sqlToken(AST _t) throws RecognitionException
statementback to summary
public final void statement(AST _t) throws RecognitionException
tableJoinback to summary
public final void tableJoin(AST _t, AST parent) throws RecognitionException
thetaJoinsback to summary
public final void thetaJoins(AST _t) throws RecognitionException
tupleExprback to summary
public final void tupleExpr(AST _t) throws RecognitionException
updateStatementback to summary
public final void updateStatement(AST _t) throws RecognitionException
whereClauseback to summary
public final void whereClause(AST _t) throws RecognitionException
whereClauseExprback to summary
public final void whereClauseExpr(AST _t) throws RecognitionException
whereExprback to summary
public final void whereExpr(AST _t) throws RecognitionException