|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--ModSQL.AbstractFunction
|
+--ModSQL.Operator
|
+--ModSQL.Operator_Compare
SQL comparison operators.
| Field Summary | |
static int |
BETWEEN
Comparison operator (between). |
private int[] |
compare_type
Per column comparison type. |
static int |
EQU
Comparison operator (equal). |
static int |
GT
Comparison operator (greater than). |
static int |
GTE
Comparison operator (greater or equal). |
static int |
LT
Comparison operator (less than). |
static int |
LTE
Comparison operator (less or equal). |
private int |
ncolumns
Number of columns in row-constructor. |
static int |
NE
Comparison operator (not equal). |
private int |
op
Which operator? One of the above constants. |
private Object[][] |
row_value
Value of the parameters. |
private RowConstructor[] |
rows
One row per parameter (only if we have row-constructors). |
| Fields inherited from class ModSQL.AbstractFunction |
all_constant, constant_non_null, evaluate_order, evaluate_order_array, out_of_order, parameter_constant, parameter_value, parameters, parameters_array |
| Fields inherited from interface ModSQL.Function |
MATCH_BEGINS, MATCH_EQU, MATCH_GT, MATCH_GTE, MATCH_LT, MATCH_LTE, MATCH_NE |
| Constructor Summary | |
Operator_Compare(int op)
Constructor. |
|
| Method Summary | |
static int |
compare(Object v1,
Object v2,
int common_type)
Compare two objects by converting to a common type. |
static boolean |
equal(Object v1,
Object v2,
int common_type)
Check if two objects are equal by converting to a common type. |
Object |
evaluate(boolean aggregate)
Evaluate parameters and compare. |
Object |
evaluate(int match_op,
Object match_value)
Evaluate parameters and compare. |
String |
functionName()
Returns the name of this function for use by toString() method. |
int |
getMaxResultSize()
Returns -1 as this operator will never return String objects. |
int |
getSQLType()
Returns Types.BIT. |
void |
optimize()
Prepare the function for use. |
boolean |
test(Object v1,
Object v2)
|
static boolean |
test(Object v1,
Object v2,
int op,
int compare_type)
Compare two objects according to op. |
boolean |
test(Object v1,
Object v2,
Object v3)
|
static boolean |
test(Object v1,
Object v2,
Object v3,
int compare_type)
|
static Boolean |
testRow(Object[] r1,
Object[] r2,
int op,
int[] compare_type)
Compare two rows according to op and using compare_type array. |
static Boolean |
testRowInequality(Object[] r1,
Object[] r2,
int op,
int[] compare_type)
Compare two rows according to op (inequalities only) and using compare_type array. |
| Methods inherited from class ModSQL.Operator |
addAllParameters, addAllParametersNegate, addAllParametersNot, removeDoubleNegation, removeDoubleNot |
| Methods inherited from class ModSQL.AbstractFunction |
addParameter, convertToSQLType, evaluateConstantParameters, evaluateOrder, evaluateParameters, evaluateParameters, getCompatableType, getObjectSQLType, getParameter, getParameterCount, isAggregate, isConstant, postfixParameters, prefixParameters, registerWith, reset, toString |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int EQU
public static final int GT
public static final int GTE
public static final int LT
public static final int LTE
public static final int NE
public static final int BETWEEN
private int op
private int[] compare_type
private RowConstructor[] rows
private Object[][] row_value
private int ncolumns
| Constructor Detail |
public Operator_Compare(int op)
op - operator type| Method Detail |
public void optimize()
throws SQLException
Prepare the function for use. This method checks the parameters and figures out how the comparison will take place (what type to use).
optimize in class AbstractFunctionSQLException - if the parameters are invalidpublic String functionName()
functionName in class AbstractFunctionpublic int getSQLType()
public int getMaxResultSize()
public Object evaluate(boolean aggregate)
throws SQLException,
EndOfTable
aggregate - passed to parametersSQLException - if a database-access error occursEndOfTable - if thrown by a parameter
public Object evaluate(int match_op,
Object match_value)
throws SQLException,
EndOfTable
evaluate in class AbstractFunctionmatch_op - how the value should be matchedmatch_value - desired valueSQLException - if a database-access error occursEndOfTable - if thrown by a parameter
public static Boolean testRow(Object[] r1,
Object[] r2,
int op,
int[] compare_type)
throws SQLException
r1 - left rowr2 - right rowop - comparison operationcompare_type - type to convert to for comparisonSQLException - if op is invalid or on type mismatch
public static Boolean testRowInequality(Object[] r1,
Object[] r2,
int op,
int[] compare_type)
throws SQLException
r1 - left rowr2 - right rowop - comparison operationcompare_type - type to convert to for comparisonSQLException - if op is invalid or on type mismatch
public static boolean test(Object v1,
Object v2,
int op,
int compare_type)
throws SQLException
v1 - left valuev2 - right valueop - comparison operationcompare_type - type to convert to for comparisonSQLException - if op is invalid or on type mismatch
public boolean test(Object v1,
Object v2)
throws SQLException
public static boolean test(Object v1,
Object v2,
Object v3,
int compare_type)
throws SQLException
public boolean test(Object v1,
Object v2,
Object v3)
throws SQLException
public static boolean equal(Object v1,
Object v2,
int common_type)
v1 - left valuev2 - right valuecompare_type - type to convert to for comparison
public static int compare(Object v1,
Object v2,
int common_type)
throws SQLException
v1 - left valuev2 - right valuecompare_type - type to convert to for comparisonSQLException - if type mismatch
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||