org.h2.expression
Class ExpressionVisitor

java.lang.Object
  extended by org.h2.expression.ExpressionVisitor

public class ExpressionVisitor
extends java.lang.Object

The visitor pattern is used to iterate through all expressions of a query to optimize a statement.


Field Summary
static int DETERMINISTIC
          Does the expression return the same results for the same parameters?
static int EVALUATABLE
          Can the expression be evaluated, that means are all columns set to 'evaluatable'?
static int GET_DEPENDENCIES
          Request to get the set of dependencies.
static int INDEPENDENT
          Is the value independent on unset parameters or on columns of a higher level query, or sequence values (that means can it be evaluated right now)?
static int NOT_FROM_RESOLVER
          Does an expression have no relation to the given table filter (getResolver)?
static int OPTIMIZABLE_MIN_MAX_COUNT_ALL
          Are all aggregates MIN(column), MAX(column), or COUNT(*) for the given table (getTable)?
static int READONLY
          Does the expression have no side effects (change the data)?
static int SET_MAX_DATA_MODIFICATION_ID
          Request to set the latest modification id.
 
Method Summary
 void addDataModificationId(long value)
          Update the field maxDataModificationId if this value is higher than the current value.
 void addDependency(DbObject obj)
          Add a new dependency to the set of dependencies.
static ExpressionVisitor get(int type)
          Create a new visitor object with the given type.
 java.util.HashSet<DbObject> getDependencies()
          Get the dependency set.
 long getMaxDataModificationId()
          Get the last data modification.
 ColumnResolver getResolver()
          Get the column resolver.
 Table getTable()
          Get the table.
 int getType()
          Get the visitor type.
 void incrementQueryLevel(int offset)
          Increment or decrement the query level.
 void setDependencies(java.util.HashSet<DbObject> dependencies)
          Set all dependencies.
 void setResolver(ColumnResolver resolver)
          Set the column resolver.
 void setTable(Table table)
          Set the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEPENDENT

public static final int INDEPENDENT
Is the value independent on unset parameters or on columns of a higher level query, or sequence values (that means can it be evaluated right now)?

See Also:
Constant Field Values

OPTIMIZABLE_MIN_MAX_COUNT_ALL

public static final int OPTIMIZABLE_MIN_MAX_COUNT_ALL
Are all aggregates MIN(column), MAX(column), or COUNT(*) for the given table (getTable)?

See Also:
Constant Field Values

DETERMINISTIC

public static final int DETERMINISTIC
Does the expression return the same results for the same parameters?

See Also:
Constant Field Values

EVALUATABLE

public static final int EVALUATABLE
Can the expression be evaluated, that means are all columns set to 'evaluatable'?

See Also:
Constant Field Values

SET_MAX_DATA_MODIFICATION_ID

public static final int SET_MAX_DATA_MODIFICATION_ID
Request to set the latest modification id.

See Also:
Constant Field Values

READONLY

public static final int READONLY
Does the expression have no side effects (change the data)?

See Also:
Constant Field Values

NOT_FROM_RESOLVER

public static final int NOT_FROM_RESOLVER
Does an expression have no relation to the given table filter (getResolver)?

See Also:
Constant Field Values

GET_DEPENDENCIES

public static final int GET_DEPENDENCIES
Request to get the set of dependencies.

See Also:
Constant Field Values
Method Detail

get

public static ExpressionVisitor get(int type)
Create a new visitor object with the given type.

Parameters:
type - the visitor type
Returns:
the new visitor

addDependency

public void addDependency(DbObject obj)
Add a new dependency to the set of dependencies. This is used for GET_DEPENDENCIES visitors.

Parameters:
obj - the additional dependency.

getDependencies

public java.util.HashSet<DbObject> getDependencies()
Get the dependency set. This is used for GET_DEPENDENCIES visitors.

Returns:
the set

setDependencies

public void setDependencies(java.util.HashSet<DbObject> dependencies)
Set all dependencies. This is used for GET_DEPENDENCIES visitors.

Parameters:
dependencies - the dependency set

incrementQueryLevel

public void incrementQueryLevel(int offset)
Increment or decrement the query level.

Parameters:
offset - 1 to increment, -1 to decrement

getResolver

public ColumnResolver getResolver()
Get the column resolver. This is used for NOT_FROM_RESOLVER visitors.

Returns:
the column resolver

setResolver

public void setResolver(ColumnResolver resolver)
Set the column resolver. This is used for NOT_FROM_RESOLVER visitors.

Parameters:
resolver - the column resolver

addDataModificationId

public void addDataModificationId(long value)
Update the field maxDataModificationId if this value is higher than the current value. This is used for SET_MAX_DATA_MODIFICATION_ID visitors.

Parameters:
value - the data modification id

getMaxDataModificationId

public long getMaxDataModificationId()
Get the last data modification. This is used for SET_MAX_DATA_MODIFICATION_ID visitors.

Returns:
the maximum modification id

setTable

public void setTable(Table table)
Set the table. This is used for OPTIMIZABLE_MIN_MAX_COUNT_ALL visitors.

Parameters:
table - the table

getTable

public Table getTable()
Get the table. This is used for OPTIMIZABLE_MIN_MAX_COUNT_ALL visitors.

Returns:
the table

getType

public int getType()
Get the visitor type.

Returns:
the type