tfischer 2004/12/06 11:50:27
Modified: src/java/org/apache/torque/util Tag: TORQUE_3_1_BRANCH
SQLBuilder.java
Log:
modified the way aliases are processed with joins.
The old code produced an SQL statement like
SELECT author.AUTHOR_ID, author.NAME FROM book RIGHT JOIN author ON
book.AUTHOR_ID=author.AUTHOR_ID LEFT JOIN book AS b ON
author.AUTHOR_ID=b.AUTHOR_ID
which produced an ORA-00905 error on oracle
The new code omits the "AS" keyword:
SELECT author.AUTHOR_ID, author.NAME FROM book RIGHT JOIN author ON
book.AUTHOR_ID=author.AUTHOR_ID LEFT JOIN book b ON author.AUTHOR_ID=b.AUTHOR_ID
and executes on Oracle
Revision Changes Path
No revision
No revision
1.1.2.5 +5 -4
db-torque/src/java/org/apache/torque/util/Attic/SQLBuilder.java
Index: SQLBuilder.java
===================================================================
RCS file:
/home/cvs/db-torque/src/java/org/apache/torque/util/Attic/SQLBuilder.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- SQLBuilder.java 3 Dec 2004 18:40:26 -0000 1.1.2.4
+++ SQLBuilder.java 6 Dec 2004 19:50:26 -0000 1.1.2.5
@@ -482,11 +482,12 @@
String aliasName = criteria.getTableForAlias(tableName);
if (StringUtils.isNotEmpty(aliasName))
{
- // If the tables have an alias, add an "<xxx> AS <yyy> statement"
+ // If the tables have an alias, add an "<xxx> <yyy> statement"
+ // <xxx> AS <yyy> causes problems on oracle
return new StringBuffer(
- tableName.length() + aliasName.length() + 4)
+ tableName.length() + aliasName.length() + 1)
.append(aliasName)
- .append(SqlEnum.AS)
+ .append(" ")
.append(tableName)
.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]