|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ModSQL.IndirectFunction
Wrapper for some other function. This class is typically used to hold column names before the names can be looked up. It may also be used to make a function appear in two seperate locations (such as SELECT expressions appearing in the ORDER BY clause).
| Field Summary | |
private String |
description
Text description of function (usually a column name). |
private boolean |
force_aggregate
Make the function appear as an aggregate regardless of whether it is or not (used for GROUP BY columns). |
private Object |
last_value
Last value returned by function (used for forced aggregates). |
private Function |
value
Function being wrapped. |
| Fields inherited from interface ModSQL.Function |
MATCH_BEGINS, MATCH_EQU, MATCH_GT, MATCH_GTE, MATCH_LT, MATCH_LTE, MATCH_NE |
| Constructor Summary | |
IndirectFunction(String description)
Constructor. |
|
| Method Summary | |
void |
addParameter(Function item)
Adds a parameter to the list of parameters. |
Object |
evaluate(boolean aggregate)
Evaluate the function and return the result. |
Object |
evaluate(int match_op,
Object match_value)
Calls the equivalent evaluate() method for the underlying function. |
void |
evaluateOrder(int index,
int order)
Specify the order in which the parameters should be evaluated. |
String |
getDescription()
Get text description of function. |
Function |
getFunction()
Get function being wrapped. |
int |
getMaxResultSize()
Return the maximum number of characters that this function expects to return in a String object. |
Function |
getParameter(int index)
Get a particular parameter. |
int |
getParameterCount()
Get the number of parameters. |
int |
getSQLType()
Return the SQL type of the value that this function expects to return. |
boolean |
isAggregate()
Determine if this function will return a value that is an aggregate of many database rows. |
boolean |
isConstant()
Determine if this function returns a constant value. |
void |
optimize()
If the function has been set, it is optimized. |
void |
registerWith(Object o)
This method responds to two objects: FunctionProvider to lookup the description if the function has not been set yet, and
Select.GroupByList to check for GROUP BY columns that need to be
forced to aggregate. |
void |
reset()
Calls reset() for the underlying function and set the last value returned by evaluate() to null. |
String |
toString()
Returns string version of function or description if function is not set yet. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private String description
private Function value
private boolean force_aggregate
private Object last_value
| Constructor Detail |
public IndirectFunction(String description)
description - text description of function (column name)| Method Detail |
public String toString()
toString in class Objectpublic String getDescription()
public Function getFunction()
public int getParameterCount()
getParameterCount in interface Functionpublic Function getParameter(int index)
getParameter in interface Functionindex - index of parameter to getIndexOutOfBoundsException - always
public void addParameter(Function item)
throws SQLException
addParameter in interface Functionitem - function to addSQLException - always
public void evaluateOrder(int index,
int order)
evaluateOrder in interface Functionindex - index of parameterorder - number indicating order in which parameter is evaluatedIndexOutOfBoundsException - always
public void registerWith(Object o)
throws SQLException
This method responds to two objects:
FunctionProvider to lookup the description if the function has not been set yet, and
Select.GroupByList to check for GROUP BY columns that need to be
forced to aggregate.
Otherwise, if the function has been set, the object is passed on to that function.
registerWith in interface Functiono - object to register withSQLException - if an error occurs
public void optimize()
throws SQLException
If the function has been set, it is optimized. Otherwise, an exception is thrown.
optimize in interface FunctionSQLException - if an error occurs
public boolean isConstant()
throws SQLException
isConstant in interface FunctionSQLException - if an error occurs
public boolean isAggregate()
throws SQLException
isAggregate in interface FunctionSQLException - if an error occurs
public int getSQLType()
throws SQLException
getSQLType in interface FunctionSQLException - if an error occurs
public int getMaxResultSize()
throws SQLException
getMaxResultSize in interface FunctionSQLException - if an error occurs
public Object evaluate(boolean aggregate)
throws SQLException,
EndOfTable
evaluate in interface Functionaggregate - true to get final aggregate valueSQLException - if an error occursEndOfTable - if thrown by the function
public Object evaluate(int match_op,
Object match_value)
throws SQLException,
EndOfTable
evaluate in interface Functionmatch_op - how the value should be matchedmatch_value - desired valueSQLException - if an error occursEndOfTable - if thrown by the function
public void reset()
throws SQLException
reset in interface FunctionSQLException - if an error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||