protected void appendTableWithJoins ( TableAlias alias , StringBuffer where , StringBuffer buf ) { int stmtFromPos = 0 ; byte joinSyntax = getJoinSyntaxType ( ) ; if ( joinSyntax == SQL92_JOIN_SYNTAX ) { stmtFromPos = buf . length ( ) ; // store position of join (by: Terry Dexter) } if ( alias == getRoot ( ) ) { // BRJ: also add indirection table to FROM-clause for MtoNQuery if ( getQuery ( ) instanceof MtoNQuery ) { MtoNQuery mnQuery = ( MtoNQuery ) m_query ; buf . append ( getTableAliasForPath ( mnQuery . getIndirectionTable ( ) , null ) . getTableAndAlias ( ) ) ; buf . append ( ", " ) ; } buf . append ( alias . getTableAndAlias ( ) ) ; } else if ( joinSyntax != SQL92_NOPAREN_JOIN_SYNTAX ) { buf . append ( alias . getTableAndAlias ( ) ) ; } if ( ! alias . hasJoins ( ) ) { return ; } for ( Iterator it = alias . iterateJoins ( ) ; it . hasNext ( ) ; ) { Join join = ( Join ) it . next ( ) ; if ( joinSyntax == SQL92_JOIN_SYNTAX ) { appendJoinSQL92 ( join , where , buf ) ; if ( it . hasNext ( ) ) { buf . insert ( stmtFromPos , "(" ) ; buf . append ( ")" ) ; } } else if ( joinSyntax == SQL92_NOPAREN_JOIN_SYNTAX ) { appendJoinSQL92NoParen ( join , where , buf ) ; } else { appendJoin ( where , buf , join ) ; } } }
Appends to the statement table and all tables joined to it .