Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-89

OrderByColumn for COUNT, SUM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3-RC2
    • 4.0-beta1
    • Runtime
    • None
    • Linux

    Description

      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.

      Attachments

        Activity

          People

            tfischer Thomas Fox
            sempi Stefan Birrer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: