Make that SqlQueryStatement::appendOrderByClause().

Corey

-----Original Message-----
From: Corey Klaasmeyer [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 10:30 AM
To: 'OJB Users List'
Subject: [SQLGenerator::appendOrderByClause()] 0.9.7 Generates 'ORDER BY
< field-number1>, <field-number2>, ...'


I believe these should be field names *not* field numbers -- at least, field
numbers do not work with my driver. Here is the code:

                for (int i = 0; i < orderByColumnNumbers.length; i++)
                {
                        cf = (Criteria.Field) orderByFields.get(i);
                        if (i > 0)
                        {
                                buf.append(",");
                        }

this -->                buf.append(orderByColumnNumbers[i]);

should be -->     FieldDescriptor fd =
getRoot().cld.getFieldDescriptorByName(cf.name);
                buf.append(fd.getColumnName());

                        if (!cf.isAscending)
                        {
                                buf.append(" DESC");
                        }
                }

This works for me, but I'm not sure whether this will scope column names
properly in the case of joins. 

Am I missing something here? Is this is just a deficiency in my Driver?

Corey

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

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

Reply via email to