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

Get rid of DbSettings.optimizeIsNull

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