|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.util.functions.AggregateFunction
public class AggregateFunction
A container for classes that will generate SQL for the SQL99 Standard Aggregate functions. These can be used via the Criteria.addSelectColumn method to produce SQL statements that can be called via the BasePeerImpl.doSelect methods.
Note database servers that use non-standard function names can be supported by setting the function name in the constructor accordingly.
E.g., older MySQL servers use LEAST instead of MIN. This can be supported by supplying "LEAST" as function name.
Constructor Summary | |
---|---|
protected |
AggregateFunction(String function,
Column column,
boolean distinct)
Constructor for aggregate functions. |
Method Summary | |
---|---|
Object |
getArgument(int i)
Returns the function parameters at index i. |
Object[] |
getArguments()
Return all the parameters as an object array. |
Column |
getColumn()
Returns the column the function is applied to. |
String |
getColumnName()
Returns the column name. |
String |
getFullTableName()
Returns the table name prefixed with the schema name if it exists. |
protected String |
getFunction()
Get the function name to use, e.g. |
String |
getSchemaName()
Returns the name of any fixed schema prefix for the column's table (if any). |
String |
getSqlExpression()
Generate the SQL for this function. |
String |
getTableName()
Returns the name of the associated table (not prefixed by the schema name). |
boolean |
isDistinct()
Should the column have DISTINCT added in front of it? |
void |
setArguments(Object[] args)
Assumes that there are one or two arguments being specified. |
void |
setColumn(Column column)
Sets the column the function is applied to. |
void |
setFunction(String function)
Set the function name to use, e.g. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AggregateFunction(String function, Column column, boolean distinct)
function
- the function name, not null or blank.column
- the column to apply the function to, not null.distinct
- whether to apply DISTINCT to the column.Method Detail |
---|
public Column getColumn()
getColumn
in interface SQLFunction
public void setColumn(Column column)
column
- the column, not null.public boolean isDistinct()
protected String getFunction()
public void setFunction(String function)
function
- The function name to use, not null or blank.
UnsupportedOperationException
- if a subclass does not support
changing the function name; never thrown by this implementation.public String getSqlExpression()
getSqlExpression
in interface Column
IllegalStateException
- if the arguments are not setpublic Object getArgument(int i)
SQLFunction
getArgument
in interface SQLFunction
i
- The 0 based parameter to get.
public Object[] getArguments()
SQLFunction
getArguments
in interface SQLFunction
public void setArguments(Object[] args)
setArguments
in interface SQLFunction
args
- The column to apply the function to.
IllegalArgumentException
- If at least one argument has not
been supplied or the second argument
object is not Boolean.public String getColumnName()
getColumnName
in interface Column
public String getTableName()
Column
getTableName
in interface Column
public String getSchemaName()
Column
getSchemaName
in interface Column
public String getFullTableName()
Column
getFullTableName
in interface Column
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |