Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.store.access
Interface Qualifier  view Qualifier download Qualifier.java


public interface Qualifier

A structure which is used to "qualify" a column. Specifies that the column value in a given column identified by column id is to be compared via a specific operator to a particular DataValueDescriptor value.

The implementation of this interface is provided by the client; the methods of Qualifier are the methods the access code uses to use it.

Arrays of qualifiers are provided to restrict the rows returned by scans. A row is returned from a scan if all qualifications in the array return true.

A qualification returns true if in the following pseudo-code compare_result is true.

  if (qualifier.negateCompareResult())
  {
      
      compare_result = 
      row[(qualifier.getColumnId())].compare(
      
        qualifier.getOperator(), 
        qualifier.getOrderable(),
        qualifier.getOrderedNulls(), 
        qualifier.getUnknownRV()) 
      
if (qualifier.negateCompareResult()) {
          compare_result = !(compare_result);
          
}
} Qualifiers are often passed through interfaces as a set of Qualifiers, rather than one at a time, for example see the qualifier argument in


Field Summary
static int CONSTANT
           
static int QUERY_INVARIANT
           
static int SCAN_INVARIANT
           
static int VARIANT
          The DataValueDescriptor can be 1 of 4 types: VARIANT - cannot be cached as its value can vary within a scan SCAN_INVARIANT - can be cached within a scan as its value will not change within a scan QUERY_INVARIANT- can be cached across the life of the query as its value will never change CONSTANT - can be cached across executions.
 
Method Summary
 void clearOrderableCache()
          Clear the DataValueDescriptor cache, if one exists.
 int getColumnId()
          Get the (zero based) id of the column to be qualified.
 int getOperator()
          Get the operator to use in the comparison.
 org.apache.derby.iapi.types.DataValueDescriptor getOrderable()
          Get the value that the column is to be compared to.
 boolean getOrderedNulls()
          Get the getOrderedNulls argument to use in the comparison.
 boolean getUnknownRV()
          Get the getOrderedNulls argument to use in the comparison.
 boolean negateCompareResult()
          Determine if the result from the compare operation should be negated.
 void reinitialize()
          This method reinitializes all the state of the Qualifier.
 

Field Detail

VARIANT

public static final int VARIANT
The DataValueDescriptor can be 1 of 4 types:
  • VARIANT - cannot be cached as its value can vary within a scan
  • SCAN_INVARIANT - can be cached within a scan as its value will not change within a scan
  • QUERY_INVARIANT- can be cached across the life of the query as its value will never change
  • CONSTANT - can be cached across executions.

NOTE: the following is guaranteed: VARIANT < SCAN_INVARIANT < QUERY_INVARIANT < CONSTANT

See Also:
Constant Field Values

SCAN_INVARIANT

public static final int SCAN_INVARIANT
See Also:
Constant Field Values

QUERY_INVARIANT

public static final int QUERY_INVARIANT
See Also:
Constant Field Values

CONSTANT

public static final int CONSTANT
See Also:
Constant Field Values
Method Detail

getColumnId

public int getColumnId()
Get the (zero based) id of the column to be qualified.

This id is the column number of the column in the table, no matter whether a partial column set is being retrieved by the actual fetch. Note that the column being specified in the qualifier must appear in the column list being fetched.


getOrderable

public org.apache.derby.iapi.types.DataValueDescriptor getOrderable()
                                                             throws org.apache.derby.iapi.error.StandardException
Get the value that the column is to be compared to.


getOperator

public int getOperator()
Get the operator to use in the comparison.


negateCompareResult

public boolean negateCompareResult()
Determine if the result from the compare operation should be negated. If true then only rows which fail the compare operation will qualify.


getOrderedNulls

public boolean getOrderedNulls()
Get the getOrderedNulls argument to use in the comparison.


getUnknownRV

public boolean getUnknownRV()
Get the getOrderedNulls argument to use in the comparison.


clearOrderableCache

public void clearOrderableCache()
Clear the DataValueDescriptor cache, if one exists. (The DataValueDescriptor can be 1 of 3 types: o VARIANT - cannot be cached as its value can vary within a scan o SCAN_INVARIANT - can be cached within a scan as its value will not change within a scan o QUERY_INVARIANT- can be cached across the life of the query as its value will never change


reinitialize

public void reinitialize()
This method reinitializes all the state of the Qualifier. It is used to distinguish between resetting something that is query invariant and something that is constant over every execution of a query. Basically, clearOrderableCache() will only clear out its cache if it is a VARIANT or SCAN_INVARIANT value. However, each time a query is executed, the QUERY_INVARIANT qualifiers need to be reset.