提交 fe6cf1ff authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Get rid of DbSettings.optimizeIsNull

上级 02911e9d
...@@ -206,12 +206,6 @@ public class DbSettings extends SettingsBase { ...@@ -206,12 +206,6 @@ public class DbSettings extends SettingsBase {
*/ */
public final boolean optimizeInSelect = get("OPTIMIZE_IN_SELECT", true); public final boolean optimizeInSelect = get("OPTIMIZE_IN_SELECT", true);
/**
* Database setting <code>OPTIMIZE_IS_NULL</code> (default: false).<br />
* Use an index for condition of the form columnName IS NULL.
*/
public final boolean optimizeIsNull = get("OPTIMIZE_IS_NULL", true);
/** /**
* Database setting <code>OPTIMIZE_OR</code> (default: true).<br /> * Database setting <code>OPTIMIZE_OR</code> (default: true).<br />
* Convert (C=? OR C=?) to (C IN(?, ?)). * Convert (C=? OR C=?) to (C IN(?, ?)).
......
...@@ -397,12 +397,8 @@ public class Comparison extends Condition { ...@@ -397,12 +397,8 @@ public class Comparison extends Condition {
if (l != null) { if (l != null) {
switch (compareType) { switch (compareType) {
case IS_NULL: case IS_NULL:
if (session.getDatabase().getSettings().optimizeIsNull) { filter.addIndexCondition(
filter.addIndexCondition( IndexCondition.get(Comparison.EQUAL_NULL_SAFE, l, ValueExpression.getNull()));
IndexCondition.get(
Comparison.EQUAL_NULL_SAFE, l,
ValueExpression.getNull()));
}
} }
} }
return; return;
......
...@@ -33,7 +33,6 @@ import org.h2.value.ValueNull; ...@@ -33,7 +33,6 @@ import org.h2.value.ValueNull;
*/ */
public class IndexCursor implements Cursor { public class IndexCursor implements Cursor {
private Session session;
private final TableFilter tableFilter; private final TableFilter tableFilter;
private Index index; private Index index;
private Table table; private Table table;
...@@ -75,7 +74,6 @@ public class IndexCursor implements Cursor { ...@@ -75,7 +74,6 @@ public class IndexCursor implements Cursor {
* @param indexConditions Index conditions. * @param indexConditions Index conditions.
*/ */
public void prepare(Session s, ArrayList<IndexCondition> indexConditions) { public void prepare(Session s, ArrayList<IndexCondition> indexConditions) {
this.session = s;
alwaysFalse = false; alwaysFalse = false;
start = end = null; start = end = null;
inList = null; inList = null;
...@@ -142,14 +140,6 @@ public class IndexCursor implements Cursor { ...@@ -142,14 +140,6 @@ public class IndexCursor implements Cursor {
inList = null; inList = null;
inResult = null; inResult = null;
} }
if (!session.getDatabase().getSettings().optimizeIsNull) {
if (isStart && isEnd) {
if (v == ValueNull.INSTANCE) {
// join on a column=NULL is always false
alwaysFalse = true;
}
}
}
} }
} }
if (inColumn != null) { if (inColumn != null) {
...@@ -239,13 +229,11 @@ public class IndexCursor implements Cursor { ...@@ -239,13 +229,11 @@ public class IndexCursor implements Cursor {
} else if (b == null) { } else if (b == null) {
return a; return a;
} }
if (session.getDatabase().getSettings().optimizeIsNull) { // IS NULL must be checked later
// IS NULL must be checked later if (a == ValueNull.INSTANCE) {
if (a == ValueNull.INSTANCE) { return b;
return b; } else if (b == ValueNull.INSTANCE) {
} else if (b == ValueNull.INSTANCE) { return a;
return a;
}
} }
int comp = table.getDatabase().compare(a, b); int comp = table.getDatabase().compare(a, b);
if (comp == 0) { if (comp == 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论