public void append2SQLFrom ( final SQLSelect _select ) throws EFapsException { // for attributes it must be evaluated if the attribute is inside a child table if ( this . valueSelect != null && "attribute" . equals ( this . valueSelect . getValueType ( ) ) ) { final Type type ; if ( this . selectParts . size ( ) > 0 ) { type = this . selectParts . get ( this . selectParts . size ( ) - 1 ) . getType ( ) ; } else { type = this . query . getMainType ( ) ; } Attribute attr = this . valueSelect . getAttribute ( ) ; if ( attr == null ) { attr = type . getAttribute ( ( ( AttributeValueSelect ) this . valueSelect ) . getAttrName ( ) ) ; } // if the attr is still null that means that the type does not have this attribute, so last // chance to find the attribute is to search in the child types if ( attr == null ) { for ( final Type childType : type . getChildTypes ( ) ) { attr = childType . getAttribute ( ( ( AttributeValueSelect ) this . valueSelect ) . getAttrName ( ) ) ; if ( attr != null ) { ( ( AttributeValueSelect ) this . valueSelect ) . setAttribute ( attr ) ; break ; } } } if ( attr != null && attr . getTable ( ) != null && ! attr . getTable ( ) . equals ( type . getMainTable ( ) ) ) { final ChildTableSelectPart childtable = new ChildTableSelectPart ( type , attr . getTable ( ) ) ; this . selectParts . add ( childtable ) ; } } for ( final ISelectPart sel : this . selectParts ) { this . tableIndex = sel . join ( this , _select , this . tableIndex ) ; } }
Method used to append to the from part of an SQL statement .