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() ) {
writeCrossJoinSeparator();
}
else {
out( " " );
}