db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edgar González <...@valhallaproject.com>
Subject [PATCH] orderBy when use alias
Date Fri, 03 Jan 2003 14:25:17 GMT
Hi,

Here is a patch to orderBy when use alias.

The bug happens when you use alias and specify an orderBy with an string column
of the table aliases, the code add a new column to the select clause with the ignoreCaseInOrderBy
database function. The problem is that when the column is added to the select clause not use
the alias name specified, instead use the table name, and if the table name is not used in
the query an SQL error ocurrs


Index: BasePeer.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java,v
retrieving revision 1.57
diff -u -r1.57 BasePeer.java
--- BasePeer.java 12 Dec 2002 14:53:28 -0000 1.57
+++ BasePeer.java 3 Jan 2003 14:07:04 -0000
@@ -1280,7 +1280,7 @@
                                 + orderByColumn.substring(spacePos));
                     }
                     selectClause.add(
-                        db.ignoreCaseInOrderBy(table + '.' + columnName));
+                        db.ignoreCaseInOrderBy(tableName + '.' + columnName));
                 }
                 else
                 {


----------------------------------------------------------------------------
Edgar Gonzalez Gonzalez
VALHALLA Project, s.a.
Chief Technology Officer
Web: www.valhallaproject.com
E-mail: egg@valhallaproject.com
Phone: +58-212-242.4379 / 6662 / 4055 / 6475
Fax: +58-212-242.6809

"The limits of my language mean the limits of my world."
Ludwig Wittgenstein

----------------------------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message