2004.04.29


com.jdc.rdb.sql.dml.clause
Class Where

java.lang.Object
  |
  +--com.jdc.lang.Object
        |
        +--com.jdc.rdb.sql.SQLClause
              |
              +--com.jdc.rdb.sql.dml.DMLClause
                    |
                    +--com.jdc.rdb.sql.dml.clause.Where
All Implemented Interfaces:
Clause, DeleteClause, SelectClause, Serializable, UpdateClause

public class Where
extends DMLClause
implements SelectClause, UpdateClause, DeleteClause

Where represents a Select, Update, or Delete SQL statement WHERE clause. The WHERE clause specifies an intermediate result table that consists of those rows of RESULT for which the search-condition is true. RESULT is the result of the From clause of the subselect.

A search condition specifies a condition that is true, false, or unknown about a given row. The result of a search condition is derived by application of the specified logical operators (AND, OR, NOT) to the result of each specified predicate. If logical operators are not specified, the result of the search condition is the result of the specified predicate.

Reference:
IBM® DB2 Universal Database™ SQL Reference Volume 1 Version 8, Pages 225-229 and 568.

Version:
2.0
Author:
Jay Damon
See Also:
Select, Update, Delete, Serialized Form

Field Summary
 
Fields inherited from class com.jdc.rdb.sql.dml.DMLClause
sqlClause
 
Fields inherited from class com.jdc.lang.Object
string
 
Constructor Summary
Where()
          Constructs a new Where clause object.
Where(String value)
          Constructs a new Where clause object for the specified Where clause search condition.
 
Method Summary
 Where addCondition(String column, String comparison, Object value)
          Adds a search condition to this Where clause.
 Where addOperator(String logical)
          Adds a logical operator to this Where clause.
 Where closeParenthesis()
          Adds an close parenthesis to this Where clause.
 String getKeyword()
          Returns the Where clause keyword.
 String getValue()
          Returns the Where clause value.
 Where openParenthesis()
          Adds an open parenthesis to this Where clause.
 String toString()
          Returns a String representation of this Where clause.
 
Methods inherited from class com.jdc.rdb.sql.dml.DMLClause
getKeyword
 
Methods inherited from class com.jdc.rdb.sql.SQLClause
contains, setKeyword, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Where

public Where()
Constructs a new Where clause object.


Where

public Where(String value)
Constructs a new Where clause object for the specified Where clause search condition.

Throws:
SQLInvalidException - No WHERE clause search condition is specified.
Method Detail

addOperator

public Where addOperator(String logical)
Adds a logical operator to this Where clause. Refer to the Logical operator class for a list of valid logical operators.

Returns:
This Where clause object.
Throws:
SQLInvalidException - An invalid logical operator is specified.
See Also:
Logical

addCondition

public Where addCondition(String column,
                          String comparison,
                          Object value)
Adds a search condition to this Where clause. A column name and comparison operator are required. Refer to the Comparison operator class for a list of valid comparison operators.

Returns:
This Where clause object.
Throws:
SQLInvalidException - No column name is specified or an invalid comparison operator is specified.
See Also:
Comparison

closeParenthesis

public Where closeParenthesis()
Adds an close parenthesis to this Where clause. This is a convenience method to allow construction of complex Where clauses.

Returns:
This Where clause object.

openParenthesis

public Where openParenthesis()
Adds an open parenthesis to this Where clause. This is a convenience method to allow construction of complex Where clauses.

Returns:
This Where clause object.

getKeyword

public String getKeyword()
Returns the Where clause keyword.

Overrides:
getKeyword in class SQLClause
Returns:
The Where clause keyword.

getValue

public String getValue()
Returns the Where clause value.

Overrides:
getValue in class SQLClause
Returns:
The Where clause value.

toString

public String toString()
Returns a String representation of this Where clause.

Specified by:
toString in interface SelectClause
Overrides:
toString in class SQLClause
Returns:
A String representation of this Where clause.

2004.04.29



Copyright © 2004 J. Damon & Co.; All Rights Reserved WorldWide.