Torque
  1. Torque
  2. TORQUE-177

SQLFunction interface should extend Column

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0-beta1
    • Fix Version/s: 4.0-beta1
    • Component/s: Runtime
    • Labels:
      None

      Description

      Support for DBA specific SQL Functions / Expression was added right after 3.3 was released. See org.apache.torque.utils.SummaryHelper and org.apache.torque.utils.functions package. This allows for SQL functions to be specified in queries in an SQL version independent way. E.g. string concatenation can be different on different servers.

      Since SQLFunctions are created with all the same info that a Column object needs, it does not make sense to have to do:

      <pre>
      hoursMax = FunctionFactory.max(TimeCard.HOURS);
      Column col = new ColumnImpl(
      null,
      TimeCard.HOURS.getTableName(),
      TimeCard.HOURS.getColumnName(),
      maxHours.toSQL()
      );
      criteria.addAsColumn(col);
      </pre>

      Since SQLFunctions contain the needed info for columns, the SQLFunction interface extend Column and supply the required column info via the Column functions. This means that SQLFunctions could be just added via:

      criterial.addAsColumn(FunctionFactory.max(TimeCard.HOURS);

        Activity

          People

          • Assignee:
            Thomas Fox
            Reporter:
            CG Monroe
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development