ModSQL
Class Operator_Add
java.lang.Object
|
+--ModSQL.AbstractFunction
|
+--ModSQL.Operator
|
+--ModSQL.Operator_Add
- All Implemented Interfaces:
- Function
- final class Operator_Add
- extends Operator
SQL operator "+".
- Author:
- chris.studholme@utoronto.ca
|
Method Summary |
void |
addParameter(Function function)
Adds a function to the list of parameters maintained by this operator. |
Object |
evaluate(boolean aggregate)
Evaluate parameters and compute sum. |
Object |
evaluate(int match_op,
Object match_value)
Evaluate parameters and compute sum. |
String |
functionName()
Returns "#ADD". |
int |
getMaxResultSize()
Returns -1 as this operator will never return a String object. |
int |
getSQLType()
Return the SQL type of the value that this function expects to return. |
void |
optimize()
Prepare the function for use. |
| Methods inherited from class ModSQL.AbstractFunction |
convertToSQLType, evaluateConstantParameters, evaluateOrder, evaluateParameters, evaluateParameters, getCompatableType, getObjectSQLType, getParameter, getParameterCount, isAggregate, isConstant, postfixParameters, prefixParameters, registerWith, reset, toString |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
constant_value
private Number constant_value
- Sum of all constant parameters.
return_type
private int return_type
- SQL return type of operator.
Operator_Add
Operator_Add()
addParameter
public void addParameter(Function function)
throws SQLException
- Adds a function to the list of parameters maintained by this operator.
If the function is of type Operator_Negate and has double negation,
the double negation will be removed. If the function is of type
Operator_Add, or Operator_Negate followed by Operator_Add, the functions
parameters (summands) are added instead of the function.
- Overrides:
addParameter in class AbstractFunction
- Parameters:
function - function to add- Throws:
SQLException - if a database error occurs
optimize
public void optimize()
throws SQLException
Prepare the function for use. This method determines the return
type of the operator, evaluates all constant parameters and computes
the sum of the constant parameters.
- Overrides:
optimize in class AbstractFunction
- Throws:
SQLException - if the parameters are invalid
functionName
public String functionName()
- Returns "#ADD".
- Overrides:
functionName in class AbstractFunction
- Returns:
- name of function
getSQLType
public int getSQLType()
throws SQLException
- Return the SQL type of the value that this function expects to return.
The data returned by the function must either be of this type, or null.
- Returns:
- SQL type of data to be returned
getMaxResultSize
public int getMaxResultSize()
- Returns -1 as this operator will never return a String object.
- Returns:
- maximum size of String returned or -1 if unknown
evaluate
public Object evaluate(boolean aggregate)
throws SQLException,
EndOfTable
- Evaluate parameters and compute sum.
- Parameters:
aggregate - passed to parameters- Returns:
- result object
- Throws:
SQLException - if a database-access error occursEndOfTable - if thrown by a parameter
evaluate
public Object evaluate(int match_op,
Object match_value)
throws SQLException,
EndOfTable
- Evaluate parameters and compute sum.
- Overrides:
evaluate in class AbstractFunction
- Parameters:
match_op - how the value should be matchedmatch_value - desired value- Returns:
- result object
- Throws:
SQLException - if a database-access error occursEndOfTable - if thrown by a parameter