You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Thomas Fischer (JIRA)" <ji...@apache.org> on 2007/04/15 13:22:15 UTC

[jira] Commented: (TORQUE-89) OrderByColumn for COUNT, SUM

    [ https://issues.apache.org/jira/browse/TORQUE-89?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488931 ] 

Thomas Fischer commented on TORQUE-89:
--------------------------------------

I do not believe that the proposed change to removeSQLFunction() will have the desired results. One still would want to remove any sql functions from the table name even if it does not contain a dot (because if one does not, this would mean that table names may not be found in the table Map, leading to errors in creating the sql statement which are not attributed easily to this). 
The dot is an easy method to determine where the column name sits. If this would not be used, one would have to do a sophisticated parsing of the column string. And I'd like to avoid different algorithms for "table name containing a dot" and "table name not containing a dot". 

I am reluctant to change the algorithm of removeSQLFunction() between release candidates, this may induce subtle errors in user's code. After 3.3 is out, it is planned to replace strings for table names by structured objects, so this kind of problem can be solved more easily then.


> OrderByColumn for COUNT, SUM
> ----------------------------
>
>                 Key: TORQUE-89
>                 URL: https://issues.apache.org/jira/browse/TORQUE-89
>             Project: Torque
>          Issue Type: Bug
>          Components: Runtime
>    Affects Versions: 3.3-RC2
>         Environment: Linux
>            Reporter: Stefan Birrer
>
> I've a "complicated" JOIN statement that features some custom column like "COUNT(a) AS ca".
> Torque runtime fails on the 
> Criteria::addAscendingOrderByColumn("ca")
> because it expects a full qualified table.columnName which is not the case for the example "ca" column.
> The problem can be fixed by adapting the following functions (3.3-RC2):
> src/java/org/apache/torque/util/SQLBuilder.java
> removeSQLFunction(final String name) : name must not necessarily contain '.' or '*" thus replacing the first thrown exception with a "return name" fixes that issue
> processOrderBy(...) : in the for loop, strippedColumnName must not contain '.'  hence replacing the first thrown exception with "orderByColumn.add(orderByColumn); break;" fixes the issue
> This are quick fixes and I guess you want to reconsider whether you want to implement it that way. After these two changes, it was working correctly though.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org