hi peter,

i committed the fix.

jakob

Peter Wieland wrote:

Hi Jakob,

the code changes seem to work well. Thank you very much. I'll tell if
further problems occur.

Thank you for your help,

Peter


hi peter,


please replace the method addJoin in SqlQueryStatement with the following:



    private void addJoin(TableAlias left, Object[] leftKeys, TableAlias
    right,
Object[] rightKeys, boolean outer, String name)
    {
        TableAlias extAlias, rightCopy;


        left.addJoin(new Join(left, leftKeys, right, rightKeys, outer,
        name));


        // build join between left and extents of right
        if (right.hasExtents())
        {
            for (int i = 0; i < right.extents.size(); i++)
            {
                extAlias = (TableAlias) right.extents.get(i);
                FieldDescriptor[] extKeys =
                getExtentFieldDescriptors(extAlias,
(FieldDescriptor[])rightKeys);


                left.addJoin(new Join(left, leftKeys, extAlias, extKeys,
                true,
name));
            }
        }


        // we need to copy the alias on the right for each extent on the
        left
        if (left.hasExtents())
        {
           for (int i = 0; i < left.extents.size(); i++)
           {
               extAlias = (TableAlias) left.extents.get(i);
               FieldDescriptor[] extKeys =
               getExtentFieldDescriptors(extAlias,
(FieldDescriptor[])leftKeys);
               rightCopy = right.copy("C" + i);


               // copies are treated like normal extents
               right.extents.add(rightCopy);
               right.extents.addAll(rightCopy.extents);


               addJoin(extAlias, extKeys, rightCopy ,rightKeys, true
               ,name);
           }
        }
    }


    /**
     * Get the FieldDescriptors of the extent based on the
     FieldDescriptors of
the parent
     * @param extAlias
     * @param fds
     * @return
     */
    private FieldDescriptor[] getExtentFieldDescriptors(TableAlias
    extAlias,
FieldDescriptor[] fds)
    {
        FieldDescriptor[] result = new FieldDescriptor[fds.length];


        for (int i = 0; i < fds.length; i++)
        {
            result[i] =
extAlias.cld.getFieldDescriptorByName(fds[i].getAttributeName());
        }


        return result;
    }


getExtentFieldDescriptors is new and tries to get the correct
fieldDescriptors
please report any problems asap.


hth
jakob





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to