提交 fa7e3dda authored 作者: Thomas Mueller's avatar Thomas Mueller

Queries with multiple IN(...) conditions sometimes return the wrong results when…

Queries with multiple IN(...) conditions sometimes return the wrong results when there was a multi-column index for the column.
上级 802e33f2
...@@ -142,7 +142,7 @@ public class IndexCursor implements Cursor { ...@@ -142,7 +142,7 @@ public class IndexCursor implements Cursor {
// or it must be a VIEW index (where the column is null). // or it must be a VIEW index (where the column is null).
// Multiple IN conditions with views are not supported, see // Multiple IN conditions with views are not supported, see
// IndexCondition.getMask. // IndexCondition.getMask.
IndexColumn idxCol = indexColumns[0]; IndexColumn idxCol = index.getIndexColumns()[0];
return idxCol == null || idxCol.column == column; return idxCol == null || idxCol.column == column;
} }
...@@ -203,17 +203,22 @@ public class IndexCursor implements Cursor { ...@@ -203,17 +203,22 @@ public class IndexCursor implements Cursor {
private void nextCursor() { private void nextCursor() {
if (inList != null) { if (inList != null) {
if (inListIndex < inList.length) { while (inListIndex < inList.length) {
Value v = inList[inListIndex++]; Value v = inList[inListIndex++];
find(v); if (v != ValueNull.INSTANCE) {
find(v);
break;
}
} }
} else if (inResult != null) { } else if (inResult != null) {
while (inResult.next()) { while (inResult.next()) {
Value v = inResult.currentRow()[0]; Value v = inResult.currentRow()[0];
v = inColumn.convert(v); if (v != ValueNull.INSTANCE) {
if (inResultTested.add(v)) { v = inColumn.convert(v);
find(v); if (inResultTested.add(v)) {
break; find(v);
break;
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论