public class TableFilter extends Object implements ColumnResolver
Modifier and Type | Class and Description |
---|---|
static interface |
TableFilter.TableFilterVisitor
A visitor for table filters.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
joinOuterIndirect
Whether this is a direct or indirect (nested) outer join
|
protected Session |
session |
Constructor and Description |
---|
TableFilter(Session session,
Table table,
String alias,
boolean rightsChecked,
Select select)
Create a new table filter object.
|
Modifier and Type | Method and Description |
---|---|
void |
addFilterCondition(Expression condition,
boolean isJoin)
Add a filter condition.
|
void |
addIndexCondition(IndexCondition condition)
Add an index condition.
|
void |
addJoin(TableFilter filter,
boolean outer,
boolean nested,
Expression on)
Add a joined table.
|
void |
addNaturalJoinColumn(Column c)
Add a column to the natural join key column list.
|
Row |
get()
Get the current row.
|
PlanItem |
getBestPlanItem(Session s,
int level)
Get the best plan item (index, cost) to use use for the current join
order.
|
Column[] |
getColumns()
Get the column list.
|
Expression |
getFilterCondition() |
Index |
getIndex() |
TableFilter |
getJoin() |
Expression |
getJoinCondition() |
TableFilter |
getNestedJoin() |
String |
getPlanSQL(boolean isJoin)
Get the query execution plan text to use for this table filter.
|
Column |
getRowIdColumn()
Get the row id pseudo column, if there is one.
|
String |
getSchemaName()
Get the schema name.
|
Select |
getSelect()
Get the select statement.
|
Session |
getSession() |
Column[] |
getSystemColumns()
Get the system columns that this table understands.
|
Table |
getTable() |
String |
getTableAlias()
Get the table alias name.
|
TableFilter |
getTableFilter()
Get the table filter.
|
Value |
getValue(Column column)
Get the value for the given column.
|
int |
hashCode() |
boolean |
hasInComparisons()
Are there any index conditions that involve IN(...).
|
boolean |
isEvaluatable() |
boolean |
isJoinOuter()
Whether this is an outer joined table.
|
boolean |
isJoinOuterIndirect()
Whether this is indirectly an outer joined table (nested within an inner
join).
|
boolean |
isNaturalJoinColumn(Column c)
Check if the given column is a natural join column.
|
boolean |
isUsed() |
void |
lock(Session s,
boolean exclusive,
boolean force)
Lock the table.
|
void |
lockRowAdd(ArrayList<Row> rows)
Add the current row to the array, if there is a current row.
|
void |
lockRows(ArrayList<Row> forUpdateRows)
Lock the given rows.
|
void |
mapAndAddFilter(Expression on)
Map the columns and add the join condition.
|
boolean |
next()
Check if there are more rows to read.
|
Expression |
optimize(ExpressionColumn expressionColumn,
Column column)
Get the expression that represents this column.
|
void |
prepare()
Prepare reading rows.
|
void |
removeFilterCondition()
Remove the filter condition.
|
void |
removeJoin()
Remove the joined table
|
void |
removeJoinCondition()
Remove the join condition.
|
void |
reset()
Reset to the current position.
|
void |
set(Row current)
Set the current row.
|
void |
setAlias(String alias) |
void |
setEvaluatable(boolean evaluatable) |
void |
setEvaluatable(TableFilter filter,
boolean b)
Update the filter and join conditions of this and all joined tables with
the information that the given table filter and all nested filter can now
return rows or not.
|
void |
setFullCondition(Expression condition) |
void |
setIndex(Index index) |
protected void |
setNullRow()
Set the state of this and all nested tables to the NULL row.
|
void |
setPlanItem(PlanItem item)
Set what plan item (index, cost) to use use.
|
void |
setUsed(boolean used) |
void |
startQuery(Session s)
Start the query.
|
String |
toString() |
void |
visit(TableFilter.TableFilterVisitor visitor)
Visit this and all joined or nested table filters.
|
protected Session session
protected boolean joinOuterIndirect
public TableFilter(Session session, Table table, String alias, boolean rightsChecked, Select select)
session
- the sessiontable
- the table from where to read dataalias
- the alias namerightsChecked
- true if rights are already checkedselect
- the select statementpublic Select getSelect()
ColumnResolver
getSelect
in interface ColumnResolver
public Table getTable()
public void lock(Session s, boolean exclusive, boolean force)
s
- the sessionexclusive
- true if an exclusive lock is requiredforce
- lock even in the MVCC modepublic PlanItem getBestPlanItem(Session s, int level)
s
- the sessionlevel
- 1 for the first table in a join, 2 for the second, and so onpublic void setPlanItem(PlanItem item)
item
- the plan itempublic void prepare()
public void startQuery(Session s)
s
- the sessionpublic void reset()
public boolean next()
protected void setNullRow()
public Row get()
public void set(Row current)
current
- the current rowpublic String getTableAlias()
getTableAlias
in interface ColumnResolver
public void addIndexCondition(IndexCondition condition)
condition
- the index conditionpublic void addFilterCondition(Expression condition, boolean isJoin)
condition
- the conditionisJoin
- if this is in fact a join conditionpublic void addJoin(TableFilter filter, boolean outer, boolean nested, Expression on)
filter
- the joined table filterouter
- if this is an outer joinnested
- if this is a nested joinon
- the join conditionpublic void mapAndAddFilter(Expression on)
on
- the conditionpublic TableFilter getJoin()
public boolean isJoinOuter()
public boolean isJoinOuterIndirect()
public String getPlanSQL(boolean isJoin)
isJoin
- if this is a joined tablepublic Index getIndex()
public void setIndex(Index index)
public void setUsed(boolean used)
public boolean isUsed()
public void removeJoin()
public Expression getJoinCondition()
public void removeJoinCondition()
public Expression getFilterCondition()
public void removeFilterCondition()
public void setFullCondition(Expression condition)
public void setEvaluatable(TableFilter filter, boolean b)
filter
- the table filterb
- the new flagpublic void setEvaluatable(boolean evaluatable)
public String getSchemaName()
ColumnResolver
getSchemaName
in interface ColumnResolver
public Column[] getColumns()
ColumnResolver
getColumns
in interface ColumnResolver
public Column[] getSystemColumns()
getSystemColumns
in interface ColumnResolver
public Column getRowIdColumn()
ColumnResolver
getRowIdColumn
in interface ColumnResolver
public Value getValue(Column column)
ColumnResolver
getValue
in interface ColumnResolver
column
- the columnpublic TableFilter getTableFilter()
ColumnResolver
getTableFilter
in interface ColumnResolver
public void setAlias(String alias)
public Expression optimize(ExpressionColumn expressionColumn, Column column)
ColumnResolver
optimize
in interface ColumnResolver
expressionColumn
- the expression columncolumn
- the columnpublic void addNaturalJoinColumn(Column c)
c
- the column to addpublic boolean isNaturalJoinColumn(Column c)
c
- the column to checkpublic boolean hasInComparisons()
public void lockRowAdd(ArrayList<Row> rows)
rows
- the rows to lockpublic void lockRows(ArrayList<Row> forUpdateRows)
forUpdateRows
- the rows to lockpublic TableFilter getNestedJoin()
public void visit(TableFilter.TableFilterVisitor visitor)
visitor
- the visitorpublic boolean isEvaluatable()
public Session getSession()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.