protected String createSQLStatement()
        throws EFapsException
    {

        final SQLSelect select = new SQLSelect()
                        .column(0, "ID")
                        .from(getMainType().getMainTable().getSqlTable(), 0);
        for (final OneSelect oneSel : this.allSelects) {
            oneSel.append2SQLFrom(select);
        }

        int colIndex = select.getColumns().size() + 1;
        // if the main table has a column for the type it is selected also
        if (getMainType().getMainTable().getSqlColType() != null) {
            select.column(0, getMainType().getMainTable().getSqlColType());
            this.typeColumnIndex = colIndex;
            colIndex++;
        }

        for (final OneSelect onesel : this.allSelects) {
            if (onesel.getValueSelect() != null) {
                colIndex += onesel.append2SQLSelect(select, colIndex);
            }
        }

        select.addPart(SQLPart.WHERE).addColumnPart(0, "ID").addPart(SQLPart.IN).addPart(SQLPart.PARENTHESIS_OPEN);

        int i = 0;
        for (final Instance instance : getInstanceList()) {
            if (Context.getDbType().getMaxExpressions() > -1 && i > Context.getDbType().getMaxExpressions()) {
                select.addPart(SQLPart.PARENTHESIS_CLOSE)
                                .addPart(SQLPart.OR)
                                .addColumnPart(0, "ID").addPart(SQLPart.IN).addPart(SQLPart.PARENTHESIS_OPEN);
                i = 0;
            }
            if (i > 0) {
                select.addPart(SQLPart.COMMA);
            }
            select.addValuePart(instance.getId());
            i++;
        }
        select.addPart(SQLPart.PARENTHESIS_CLOSE);

        for (final OneSelect oneSel : this.allSelects) {
            oneSel.append2SQLWhere(select);
        }

        return select.getSQL();
    }
protected String createSQLStatement ( ) throws EFapsException { final SQLSelect select = new SQLSelect ( ) . column ( 0 , "ID" ) . from ( getMainType ( ) . getMainTable ( ) . getSqlTable ( ) , 0 ) ; for ( final OneSelect oneSel : this . allSelects ) { oneSel . append2SQLFrom ( select ) ; } int colIndex = select . getColumns ( ) . size ( ) + 1 ; if ( getMainType ( ) . getMainTable ( ) . getSqlColType ( ) != null ) { select . column ( 0 , getMainType ( ) . getMainTable ( ) . getSqlColType ( ) ) ; this . typeColumnIndex = colIndex ; colIndex ++ ; } for ( final OneSelect onesel : this . allSelects ) { if ( onesel . getValueSelect ( ) != null ) { colIndex += onesel . append2SQLSelect ( select , colIndex ) ; } } select . addPart ( SQLPart . WHERE ) . addColumnPart ( 0 , "ID" ) . addPart ( SQLPart . IN ) . addPart ( SQLPart . PARENTHESIS_OPEN ) ; int i = 0 ; for ( final Instance instance : getInstanceList ( ) ) { if ( Context . getDbType ( ) . getMaxExpressions ( ) > - 1 && i > Context . getDbType ( ) . getMaxExpressions ( ) ) { select . addPart ( SQLPart . PARENTHESIS_CLOSE ) . addPart ( SQLPart . OR ) . addColumnPart ( 0 , "ID" ) . addPart ( SQLPart . IN ) . addPart ( SQLPart . PARENTHESIS_OPEN ) ; i = 0 ; } if ( i > 0 ) { select . addPart ( SQLPart . COMMA ) ; } select . addValuePart ( instance . getId ( ) ) ; i ++ ; } select . addPart ( SQLPart . PARENTHESIS_CLOSE ) ; for ( final OneSelect oneSel : this . allSelects ) { oneSel . append2SQLWhere ( select ) ; } return select . getSQL ( ) ; }
Method to create on Statement out of the different parts.

@return StringBuilder containing the SQL statement
@throws EFapsException on error