Top Description Inners Constructors Methods
org.apache.derby.vti

public abstract Class Restriction

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.apache.derby.vti.Restriction.AND, org.apache.derby.vti.Restriction.OR, org.apache.derby.vti.Restriction.ColumnQualifier
Imports
java.io.Serializable, org.apache.derby.iapi.util.IdUtil

An expression to be pushed into a Table Function so that the Table Function can short-circuit its processing and return fewer rows. A restriction is represented as a binary tree. The non-leaf nodes are ANDs and ORs. The leaf nodes are ColumnQualifiers. A ColumnQualifier is a simple expression comparing a constant value to a column in the Table Function.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Restriction.AND

An AND of two Restrictions

public static class
Restriction.ColumnQualifier

A simple comparison of a column to a constant value.

public static class
Restriction.OR

An OR of two Restrictions

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

the original string wrapped in parentheses
parenthesize
(String
The original string
raw
)

Utility method to parenthesize an expression

public abstract String

Returns:

this Restriction as a string suitable for use in a WHERE clause.
toSQL
()

Turn this Restriction into a string suitable for use in a WHERE clause.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Restrictionback to summary
public Restriction()

Method Detail

parenthesizeback to summary
protected String parenthesize(String raw)

Utility method to parenthesize an expression

Parameters
raw:String

The original string

Returns:String

the original string wrapped in parentheses

toSQLback to summary
public abstract String toSQL()

Turn this Restriction into a string suitable for use in a WHERE clause.

Returns:String

this Restriction as a string suitable for use in a WHERE clause.

org.apache.derby.vti back to summary

public Class Restriction.AND

extends Restriction
Class Inheritance

An AND of two Restrictions

Field Summary

Modifier and TypeField and Description
private Restriction
private Restriction
public static final long
serialVersionUID

Derby serializes these objects in PreparedStatements

Constructor Summary

AccessConstructor and Description
public
AND(Restriction
The first conjunct
leftChild
,
Restriction
The second conjunct
rightChild
)

AND together two other Restrictions

Method Summary

Modifier and TypeMethod and Description
public Restriction

Returns:

the first conjunct
getLeftChild
()

Get the left Restriction

public Restriction

Returns:

the second conjunct
getRightChild
()

Get the right Restriction

public String

Returns:

this Restriction as WHERE clause text
toSQL
()

Implements abstract org.apache.derby.vti.Restriction.toSQL.

Turn this Restriction into WHERE clause text.

Inherited from org.apache.derby.vti.Restriction:
parenthesize

Field Detail

_leftChildback to summary
private Restriction _leftChild
_rightChildback to summary
private Restriction _rightChild
serialVersionUIDback to summary
public static final long serialVersionUID

Derby serializes these objects in PreparedStatements

Constructor Detail

ANDback to summary
public AND(Restriction leftChild, Restriction rightChild)

AND together two other Restrictions

Parameters
leftChild:Restriction

The first conjunct

rightChild:Restriction

The second conjunct

Method Detail

getLeftChildback to summary
public Restriction getLeftChild()

Get the left Restriction

Returns:Restriction

the first conjunct

getRightChildback to summary
public Restriction getRightChild()

Get the right Restriction

Returns:Restriction

the second conjunct

toSQLback to summary
public String toSQL()

Implements abstract org.apache.derby.vti.Restriction.toSQL.

Turn this Restriction into WHERE clause text.

Returns:String

this Restriction as WHERE clause text

org.apache.derby.vti back to summary

public Class Restriction.ColumnQualifier

extends Restriction
Class Inheritance

A simple comparison of a column to a constant value. The comparison has the form:

column OP constant

where OP is one of the following:

 <     =     <=     >      >=    IS NULL    IS NOT NULL

Field Summary

Modifier and TypeField and Description
private String
_columnName

name of column being restricted

private int
_comparisonOperator

comparison operator, one of the ORDER_OP constants

private Object
_constantOperand

value to compare the column to

private String[]
public static final int
ORDER_OP_EQUALS

Ordering operation constant representing '='

public static final int
ORDER_OP_GREATEROREQUALS

Ordering operation constant representing '>='

public static final int
ORDER_OP_GREATERTHAN

Ordering operation constant representing '>'

public static final int
ORDER_OP_ISNOTNULL

Ordering operation constant representing 'IS NOT NULL'

public static final int
ORDER_OP_ISNULL

Ordering operation constant representing 'IS NULL'

public static final int
ORDER_OP_LESSOREQUALS

Ordering operation constant representing '<='

public static final int
ORDER_OP_LESSTHAN

Ordering operation constant representing '<'

public static final int
ORDER_OP_NOT_EQUALS

Ordering operation constant representing '!='

public static final long
serialVersionUID

Derby serializes these objects in PreparedStatements

Constructor Summary

AccessConstructor and Description
public
ColumnQualifier(String
Name of column as declared in the CREATE FUNCTION statement.
columnName
,
int
One of the ORDER_OP constants.
comparisonOperator
,
Object
Constant value to which the column should be compared.
constantOperand
)

Construct from pieces.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the name of the column being compared
getColumnName
()

The name of the column being compared.

public int

Returns:

an ORDER_OP representing the type of comparison to perform
getComparisonOperator
()

The type of comparison to perform.

public Object

Returns:

the constant with which the column is being compared
getConstantOperand
()

Get the constant value to which the column should be compared.

protected String
public String

Returns:

this Restriction as WHERE clause text
toSQL
()

Implements abstract org.apache.derby.vti.Restriction.toSQL.

Turn this Restriction into WHERE clause text.

Inherited from org.apache.derby.vti.Restriction:
parenthesize

Field Detail

_columnNameback to summary
private String _columnName

name of column being restricted

_comparisonOperatorback to summary
private int _comparisonOperator

comparison operator, one of the ORDER_OP constants

_constantOperandback to summary
private Object _constantOperand

value to compare the column to

OPERATOR_SYMBOLSback to summary
private String[] OPERATOR_SYMBOLS
ORDER_OP_EQUALSback to summary
public static final int ORDER_OP_EQUALS

Ordering operation constant representing '='

ORDER_OP_GREATEROREQUALSback to summary
public static final int ORDER_OP_GREATEROREQUALS

Ordering operation constant representing '>='

ORDER_OP_GREATERTHANback to summary
public static final int ORDER_OP_GREATERTHAN

Ordering operation constant representing '>'

ORDER_OP_ISNOTNULLback to summary
public static final int ORDER_OP_ISNOTNULL

Ordering operation constant representing 'IS NOT NULL'

ORDER_OP_ISNULLback to summary
public static final int ORDER_OP_ISNULL

Ordering operation constant representing 'IS NULL'

ORDER_OP_LESSOREQUALSback to summary
public static final int ORDER_OP_LESSOREQUALS

Ordering operation constant representing '<='

ORDER_OP_LESSTHANback to summary
public static final int ORDER_OP_LESSTHAN

Ordering operation constant representing '<'

ORDER_OP_NOT_EQUALSback to summary
public static final int ORDER_OP_NOT_EQUALS

Ordering operation constant representing '!='

serialVersionUIDback to summary
public static final long serialVersionUID

Derby serializes these objects in PreparedStatements

Constructor Detail

ColumnQualifierback to summary
public ColumnQualifier(String columnName, int comparisonOperator, Object constantOperand)

Construct from pieces.

Parameters
columnName:String

Name of column as declared in the CREATE FUNCTION statement.

comparisonOperator:int

One of the ORDER_OP constants.

constantOperand:Object

Constant value to which the column should be compared.

Method Detail

getColumnNameback to summary
public String getColumnName()

The name of the column being compared.

Returns:String

the name of the column being compared

getComparisonOperatorback to summary
public int getComparisonOperator()

The type of comparison to perform. This is one of the ORDER_OP constants defined above.

Returns:int

an ORDER_OP representing the type of comparison to perform

getConstantOperandback to summary
public Object getConstantOperand()

Get the constant value to which the column should be compared. The constant value must be an Object of the Java type which corresponds to the SQL type of the column. The column's SQL type was declared in the CREATE FUNCTION statement. The mapping of SQL types to Java types is defined in table 4 of chapter 14 of the original JDBC 1 specification (dated 1996). Bascially, these are the Java wrapper values you would expect. For instance, SQL INT maps to java.lang.Integer, SQL CHAR maps to java.lang.String, etc.. This object will be null if the comparison operator is ORDER_OP_ISNULL or ORDER_OP_ISNOTNULL.

Returns:Object

the constant with which the column is being compared

toEscapedStringback to summary
protected String toEscapedString(Object o)
toSQLback to summary
public String toSQL()

Implements abstract org.apache.derby.vti.Restriction.toSQL.

Turn this Restriction into WHERE clause text.

Returns:String

this Restriction as WHERE clause text

org.apache.derby.vti back to summary

public Class Restriction.OR

extends Restriction
Class Inheritance

An OR of two Restrictions

Field Summary

Modifier and TypeField and Description
private Restriction
private Restriction
public static final long
serialVersionUID

Derby serializes these objects in PreparedStatements

Constructor Summary

AccessConstructor and Description
public
OR(Restriction
The first disjunct
leftChild
,
Restriction
The second disjunct
rightChild
)

OR together two other Restrictions

Method Summary

Modifier and TypeMethod and Description
public Restriction

Returns:

the first disjunct
getLeftChild
()

Get the left Restriction

public Restriction

Returns:

the second disjunct
getRightChild
()

Get the right Restriction

public String

Returns:

this Restriction as WHERE clause text
toSQL
()

Implements abstract org.apache.derby.vti.Restriction.toSQL.

Turn this Restriction into WHERE clause text.

Inherited from org.apache.derby.vti.Restriction:
parenthesize

Field Detail

_leftChildback to summary
private Restriction _leftChild
_rightChildback to summary
private Restriction _rightChild
serialVersionUIDback to summary
public static final long serialVersionUID

Derby serializes these objects in PreparedStatements

Constructor Detail

ORback to summary
public OR(Restriction leftChild, Restriction rightChild)

OR together two other Restrictions

Parameters
leftChild:Restriction

The first disjunct

rightChild:Restriction

The second disjunct

Method Detail

getLeftChildback to summary
public Restriction getLeftChild()

Get the left Restriction

Returns:Restriction

the first disjunct

getRightChildback to summary
public Restriction getRightChild()

Get the right Restriction

Returns:Restriction

the second disjunct

toSQLback to summary
public String toSQL()

Implements abstract org.apache.derby.vti.Restriction.toSQL.

Turn this Restriction into WHERE clause text.

Returns:String

this Restriction as WHERE clause text