提交 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,13 +203,17 @@ public class IndexCursor implements Cursor { ...@@ -203,13 +203,17 @@ 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++];
if (v != ValueNull.INSTANCE) {
find(v); 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];
if (v != ValueNull.INSTANCE) {
v = inColumn.convert(v); v = inColumn.convert(v);
if (inResultTested.add(v)) { if (inResultTested.add(v)) {
find(v); find(v);
...@@ -218,6 +222,7 @@ public class IndexCursor implements Cursor { ...@@ -218,6 +222,7 @@ public class IndexCursor implements Cursor {
} }
} }
} }
}
private void find(Value v) { private void find(Value v) {
v = inColumn.convert(v); v = inColumn.convert(v);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论