I need the ability to specify the sort direction in the Order By clause
(ASC[ending] or DESC[ending]).
As I think about what this would take to implement directly in Turbine
(namely changes to Criteria and BasePeer) I run into a few problems.

To me, the best way to handle it would be to introduce an OrderBy class
that groups together the column being ordered and its direction.  This
could easily be hidden in Criteria for adding order by clauses with a
direction and for storing them, but it would mean an impact on any code
that directly calls criteria.getOrderByColumns().  Of course,
BasePeer.createQueryString() would have to change no matter how this is
approached, but the change suggested above could impact other areas as
well.

Another approach that comes to mind is to create another StringStackBuffer
in Criteria called orderByDirection.  This would store the direction
indictors corresponding to each element in orderByColumn.  With this
approach, BasePeer.createQueryString() would be modified to look for the
directions, but if anyone is calling criteria.getOrderByColumns(), they
would not have any problems until they started to set the direction in
their order by clauses.  Only then would they need to worry about calling
criteria.getOrderByDirections() (and, presumably, at that point this is
what they'd want).  My biggest concern about this approach is that it
requires the two stack buffers to stay in sync (not programmatically
difficult, but seems kludgy).

Through all of this, I'm assuming that ASC and DESC and standing SQL
keywords and that they are the same across databases.  Does anybody know
otherwise?

Of course, all of this can be avoided if I just call BasePeer.executeQuery
() directly and I've resorted to that several times for particularly
complicated SQL statements.  However, this one seems like it should be easy
enough (and generally useful enough?) to investigate further.

Any suggestions?

Parker.
-----------------------
Parker J. May
Senior Project Manager
Outcome Technology Associates
[EMAIL PROTECTED]



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to