: Class Operator_Exists

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ModSQL
Class Operator_Exists

    java.lang.Object
      |
      +--ModSQL.AbstractFunction
            |
            +--ModSQL.Operator
                  |
                  +--ModSQL.Operator_Exists

All Implemented Interfaces:
  Function

final class Operator_Exists
extends Operator

Implementation of EXISTS operator.

Author:
  chris.studholme@utoronto.ca

Field Summary
`private Boolean` | `constant_result` If is_constant, this variable holds the constant result.
`private boolean` | `is_constant` True if operator returns a constant value (table is constant).
`private Table` | `table` Table to scan.

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
`(package private)` | `Operator_Exists()`

Method Summary
`Object` | `evaluate(boolean aggregate)` Evaluate table and compute the function.
`Object` | `evaluate(int match_op, Object match_value)` Evaluate table and compute the function.
`String` | `functionName()` Returns "#EXISTS".
`int` | `getMaxResultSize()` Returns -1 as this operator will never return a String object.
`int` | `getSQLType()` Returns Types.BIT.
`boolean` | `isConstant()` Returns true if the table is constant.
`void` | `optimize()` Prepare the function for use.
`String` | `postfixParameters()` Returns table as string if set.
`void` | `registerWith(Object o)` Since the table is not a regular parameter, this method is need to ensure the table can register itself with objects as needed.
`void` | `setTable(Table table)` Specify the table to be scanned.

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, prefixParameters, reset, toString`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait`

Field Detail

### table

    private Table table

  Table to scan.

### is_constant

    private boolean is_constant

  True if operator returns a constant value (table is constant).

### constant_result

    private Boolean constant_result

  If is_constant, this variable holds the constant result.

Constructor Detail

### Operator_Exists

    Operator_Exists()

Method Detail

### setTable

    public void setTable(Table table)

  Specify the table to be scanned.
  Parameters:
    `table` - table to scan

### registerWith

    public void registerWith(Object o)
                      throws SQLException

  Since the table is not a regular parameter, this method is need to ensure the table can register itself with objects as needed.
  Overrides:
    `registerWith` in class `AbstractFunction`
  Parameters:
    `o` - object to register with
  Throws:
    `SQLException` - if a database error occurs

### optimize

    public void optimize()
                  throws SQLException

  Prepare the function for use. This method ensures that there are no parameters (except the table). If the table is constant, it is checked for rows and the result is stored.

  Overrides:
    `optimize` in class `AbstractFunction`
  Throws:
    `SQLException` - if the parameters are invalid

### functionName

    public String functionName()

  Returns "#EXISTS".
  Overrides:
    `functionName` in class `AbstractFunction`
  Returns:
    name of function

### postfixParameters

    public String postfixParameters()

  Returns table as string if set.
  Overrides:
    `postfixParameters` in class `AbstractFunction`
  Returns:
    table as string

### isConstant

    public boolean isConstant()

  Returns true if the table is constant.
  Overrides:
    `isConstant` in class `AbstractFunction`
  Returns:
    true if the value returned is constant

### getSQLType

    public int getSQLType()

  Returns Types.BIT.
  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 table and compute the function.
  Parameters:
    `aggregate` - ignored
  Returns:
    result object
  Throws:
    `SQLException` - if a database-access error occurs
    `EndOfTable` - if thrown by a parameter

### evaluate

    public Object evaluate(int match_op,
                           Object match_value)
                    throws SQLException,
                           EndOfTable

  Evaluate table and compute the function.
  Overrides:
    `evaluate` in class `AbstractFunction`
  Parameters:
    `match_op` - how the value should be matched
    `match_value` - desired value
  Returns:
    result object
  Throws:
    `SQLException` - if a database-access error occurs
    `EndOfTable` - if thrown by a parameter

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD