SQLFunction interface should extend Column
------------------------------------------

                 Key: TORQUE-177
                 URL: https://issues.apache.org/jira/browse/TORQUE-177
             Project: Torque
          Issue Type: Improvement
          Components: Runtime
    Affects Versions: 4.0
            Reporter: CG Monroe


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);



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to