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

SQLFunction interface should extend Column

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0-beta1
    • 4.0-beta1
    • Runtime
    • 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);

      Attachments

        Activity

          People

            tfischer Thomas Fox
            monroe CG Monroe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: