I hope this should help:


Index: BasePeer.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/om/peer/BasePeer.java,v
retrieving revision 1.19
diff -u -r1.19 BasePeer.java
--- BasePeer.java       2000/12/13 21:56:29     1.19
+++ BasePeer.java       2000/12/26 17:38:05
@@ -935,7 +935,10 @@
                 ColumnMap column = dbMap.getTable(table).getColumn(
columnName );
                 if (  column.getType() instanceof String )
                 {
-                    orderByClause.add(
db.ignoreCaseInOrderBy(orderByColumn) );
+                   if (spacePos == -1)
+                        orderByClause.add(
db.ignoreCaseInOrderBy(orderByColumn) );
+                   else
+                       orderByClause.add(
db.ignoreCaseInOrderBy(orderByColumn.substring(0,spacePos)) +
orderByColumn.substring(spacePos));
                 }
                 else
                 {                                                          

On Sat, 23 Dec 2000 02:08:15 -0800, Turbine wrote:

>  Merry Christmas to anyone who isn't out doing last minute shopping.
>  
>  The following SQL is being generated by BasePeer:
>  SELECT . . . .ORDER BY UPPER(Person.lastName DESC)
>  
>  if I use:
>  criteria..addOrderByColumn("Person.lastName DESC")
>  
>  The correct syntax for MSSQL is:
>  SELECT . . . .ORDER BY UPPER(Person.lastName) DESC
>  or just
>  SELECT . . . .ORDER BY Person.lastName DESC
>  if case isn't significant.
>  
>  The problem appears to be in BasePeer line 938:
>  orderByClause.add( db.ignoreCaseInOrderBy(orderByColumn) );
>  
>  This is being obscured by the fact that about half of the database
>  adapters implement the ignoreCaseInOrderBy method by returning the
>  passed string unchanged. So for example it won't happen with MySQL.
>  
>  I'm not sure how to fix this because I don't know if it is correct
>  behavior for some databases but not others. I can hack around it by
>  adding an ignoreCaseInOrderBy method to DBMSSQL that returns its input
>  unchanged. But, if the generated syntax is incorrect, it would be
>  better to fix it in BasePeer.
>  
>  Any of you database experts out there know if the generated syntax is
>  correct for other databases?
>  
>  Thanks
>  Chris
>  
>  
>  
>  
>  
>  
>  ------------------------------------------------------------
>  To subscribe:        [EMAIL PROTECTED]
>  To unsubscribe:      [EMAIL PROTECTED]
>  Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
>  Problems?:           [EMAIL PROTECTED]
>  


fedor.

--
BNTP: Bad News Transfer Protocol





_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/




------------------------------------------------------------
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