提交 6cf69f57 authored 作者: Thomas Mueller's avatar Thomas Mueller

An optimization for IN(..) and IN(SELECT...) using the system property h2.optimizeInList

上级 fe4a8bec
...@@ -40,10 +40,6 @@ public class IndexCursor implements Cursor { ...@@ -40,10 +40,6 @@ public class IndexCursor implements Cursor {
private LocalResult inResult; private LocalResult inResult;
private HashSet<Value> inResultTested; private HashSet<Value> inResultTested;
public IndexCursor(Session session) {
this.session = session;
}
public void setIndex(Index index) { public void setIndex(Index index) {
this.index = index; this.index = index;
this.table = index.getTable(); this.table = index.getTable();
...@@ -65,7 +61,8 @@ public class IndexCursor implements Cursor { ...@@ -65,7 +61,8 @@ public class IndexCursor implements Cursor {
* *
* @param indexConditions the index conditions * @param indexConditions the index conditions
*/ */
public void find(ObjectArray<IndexCondition> indexConditions) throws SQLException { public void find(Session session, ObjectArray<IndexCondition> indexConditions) throws SQLException {
this.session = session;
alwaysFalse = false; alwaysFalse = false;
start = end = null; start = end = null;
inList = null; inList = null;
......
...@@ -92,7 +92,7 @@ public class TableFilter implements ColumnResolver { ...@@ -92,7 +92,7 @@ public class TableFilter implements ColumnResolver {
this.table = table; this.table = table;
this.alias = alias; this.alias = alias;
this.select = select; this.select = select;
this.cursor = new IndexCursor(session); this.cursor = new IndexCursor();
if (!rightsChecked) { if (!rightsChecked) {
session.getUser().checkRight(table, Right.SELECT); session.getUser().checkRight(table, Right.SELECT);
} }
...@@ -246,7 +246,7 @@ public class TableFilter implements ColumnResolver { ...@@ -246,7 +246,7 @@ public class TableFilter implements ColumnResolver {
if (state == AFTER_LAST) { if (state == AFTER_LAST) {
return false; return false;
} else if (state == BEFORE_FIRST) { } else if (state == BEFORE_FIRST) {
cursor.find(indexConditions); cursor.find(session, indexConditions);
if (!cursor.isAlwaysFalse()) { if (!cursor.isAlwaysFalse()) {
if (join != null) { if (join != null) {
join.reset(); join.reset();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论