Methods Summary |
---|
protected void | beginFunctionTemplate(antlr.collections.AST m, antlr.collections.AST i)
MethodNode methodNode = ( MethodNode ) m;
SQLFunction template = methodNode.getSQLFunction();
if ( template == null ) {
// if template is null we just write the function out as it appears in the hql statement
super.beginFunctionTemplate( m, i );
}
else {
// this function has a template -> redirect output and catch the arguments
outputStack.addFirst( writer );
writer = new FunctionArguments();
}
|
protected void | commaBetweenParameters(java.lang.String comma)
writer.commaBetweenParameters( comma );
|
protected void | endFunctionTemplate(antlr.collections.AST m)
MethodNode methodNode = ( MethodNode ) m;
SQLFunction template = methodNode.getSQLFunction();
if ( template == null ) {
super.endFunctionTemplate( m );
}
else {
// this function has a template -> restore output, apply the template and write the result out
FunctionArguments functionArguments = ( FunctionArguments ) writer; // TODO: Downcast to avoid using an interface? Yuck.
writer = ( SqlWriter ) outputStack.removeFirst();
out( template.render( functionArguments.getArgs(), sessionFactory ) );
}
|
protected void | fromFragmentSeparator(antlr.collections.AST a)
// check two "adjecent" nodes at the top of the from-clause tree
AST next = a.getNextSibling();
if ( next == null || !hasText( a ) ) {
return;
}
FromElement left = ( FromElement ) a;
FromElement right = ( FromElement ) next;
///////////////////////////////////////////////////////////////////////
// HACK ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Attempt to work around "ghost" ImpliedFromElements that occasionally
// show up between the actual things being joined. This consistently
// occurs from index nodes (at least against many-to-many). Not sure
// if there are other conditions
//
// Essentially, look-ahead to the next FromElement that actually
// writes something to the SQL
while ( right != null && !hasText( right ) ) {
right = ( FromElement ) right.getNextSibling();
}
if ( right == null ) {
return;
}
///////////////////////////////////////////////////////////////////////
if ( !hasText( right ) ) {
return;
}
if ( right.getRealOrigin() == left ||
( right.getRealOrigin() != null && right.getRealOrigin() == left.getRealOrigin() ) ) {
// right represents a joins originating from left; or
// both right and left reprersent joins originating from the same FromElement
if ( right.getJoinSequence() != null && right.getJoinSequence().isThetaStyle() ) {
out( ", " );
}
else {
out( " " );
}
}
else {
// these are just two unrelated table references
out( ", " );
}
|
public ParseErrorHandler | getParseErrorHandler()
return parseErrorHandler;
|
public java.lang.String | getSQL()
return getStringBuffer().toString();
|
protected void | nestedFromFragment(antlr.collections.AST d, antlr.collections.AST parent)
// check a set of parent/child nodes in the from-clause tree
// to determine if a comma is required between them
if ( d != null && hasText( d ) ) {
if ( parent != null && hasText( parent ) ) {
// again, both should be FromElements
FromElement left = ( FromElement ) parent;
FromElement right = ( FromElement ) d;
if ( right.getRealOrigin() == left ) {
// right represents a joins originating from left...
if ( right.getJoinSequence() != null && right.getJoinSequence().isThetaStyle() ) {
out( ", " );
}
else {
out( " " );
}
}
else {
// not so sure this is even valid subtree. but if it was, it'd
// represent two unrelated table references...
out( ", " );
}
}
out( d );
}
|
protected void | optionalSpace()
int c = getLastChar();
switch ( c ) {
case -1:
return;
case ' ":
return;
case ')":
return;
case '(":
return;
default:
out( " " );
}
|
protected void | out(java.lang.String s)
writer.clause( s );
|
protected void | out(antlr.collections.AST n)
if ( n instanceof Node ) {
out( ( ( Node ) n ).getRenderText( sessionFactory ) );
}
else {
super.out( n );
}
|
public static void | panic()
throw new QueryException( "TreeWalker: panic" );
|
public void | reportError(antlr.RecognitionException e)
parseErrorHandler.reportError( e ); // Use the delegate.
|
public void | reportError(java.lang.String s)
parseErrorHandler.reportError( s ); // Use the delegate.
|
public void | reportWarning(java.lang.String s)
parseErrorHandler.reportWarning( s );
|