protected void appendSQLClause(SelectionCriteria c, StringBuffer buf)
    {
        // BRJ : handle SqlCriteria
        if (c instanceof SqlCriteria)
        {
            buf.append(c.getAttribute());
            return;
        }
        
        // BRJ : criteria attribute is a query
        if (c.getAttribute() instanceof Query)
        {
            Query q = (Query) c.getAttribute();
            buf.append("(");
            buf.append(getSubQuerySQL(q));
            buf.append(")");
            buf.append(c.getClause());
            appendParameter(c.getValue(), buf);
            return;
        }

		AttributeInfo attrInfo = getAttributeInfo((String) c.getAttribute(), false, c.getUserAlias(), c.getPathClasses());
        TableAlias alias = attrInfo.tableAlias;

        if (alias != null)
        {
            boolean hasExtents = alias.hasExtents();

            if (hasExtents)
            {
                // BRJ : surround with braces if alias has extents
                buf.append("(");
                appendCriteria(alias, attrInfo.pathInfo, c, buf);

                c.setNumberOfExtentsToBind(alias.extents.size());
                Iterator iter = alias.iterateExtents();
                while (iter.hasNext())
                {
                    TableAlias tableAlias = (TableAlias) iter.next();
                    buf.append(" OR ");
                    appendCriteria(tableAlias, attrInfo.pathInfo, c, buf);
                }
                buf.append(")");
            }
            else
            {
                // no extents
                appendCriteria(alias, attrInfo.pathInfo, c, buf);
            }
        }
        else
        {
            // alias null
            appendCriteria(alias, attrInfo.pathInfo, c, buf);
        }

    }
protected void appendSQLClause ( SelectionCriteria c , StringBuffer buf ) { if ( c instanceof SqlCriteria ) { buf . append ( c . getAttribute ( ) ) ; return ; } if ( c . getAttribute ( ) instanceof Query ) { Query q = ( Query ) c . getAttribute ( ) ; buf . append ( "(" ) ; buf . append ( getSubQuerySQL ( q ) ) ; buf . append ( ")" ) ; buf . append ( c . getClause ( ) ) ; appendParameter ( c . getValue ( ) , buf ) ; return ; } AttributeInfo attrInfo = getAttributeInfo ( ( String ) c . getAttribute ( ) , false , c . getUserAlias ( ) , c . getPathClasses ( ) ) ; TableAlias alias = attrInfo . tableAlias ; if ( alias != null ) { boolean hasExtents = alias . hasExtents ( ) ; if ( hasExtents ) { buf . append ( "(" ) ; appendCriteria ( alias , attrInfo . pathInfo , c , buf ) ; c . setNumberOfExtentsToBind ( alias . extents . size ( ) ) ; Iterator iter = alias . iterateExtents ( ) ; while ( iter . hasNext ( ) ) { TableAlias tableAlias = ( TableAlias ) iter . next ( ) ; buf . append ( " OR " ) ; appendCriteria ( tableAlias , attrInfo . pathInfo , c , buf ) ; } buf . append ( ")" ) ; } else { appendCriteria ( alias , attrInfo . pathInfo , c , buf ) ; } } else { appendCriteria ( alias , attrInfo . pathInfo , c , buf ) ; } }
Answer the SQL-Clause for a SelectionCriteria
If the Criteria references a class with extents an OR-Clause is
added for each extent
@param c SelectionCriteria