提交 6b67928a authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Rename mayHaveDuplicates() to mayHaveNullDuplicates()

上级 859576ee
......@@ -302,14 +302,15 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
/**
* Check if this row may have duplicates with the same indexed values in the
* current compatibility mode.
* current compatibility mode. Duplicates with {@code NULL} values are
* allowed in some modes.
*
* @param searchRow
* the row to check
* @return {@code true} if specified row may have duplicates,
* {@code false otherwise}
*/
protected boolean mayHaveDuplicates(SearchRow searchRow) {
protected boolean mayHaveNullDuplicates(SearchRow searchRow) {
switch (database.getMode().uniqueIndexNullsHandling) {
case ALLOW_DUPLICATES_WITH_ANY_NULL:
for (int index : columnIds) {
......
......@@ -116,7 +116,7 @@ public abstract class PageBtree extends Page {
comp = index.compareRows(row, compare);
if (comp == 0) {
if (add && index.indexType.isUnique()) {
if (!index.mayHaveDuplicates(compare)) {
if (!index.mayHaveNullDuplicates(compare)) {
throw index.getDuplicateKeyException(compare.toString());
}
}
......
......@@ -66,7 +66,7 @@ public class TreeIndex extends BaseIndex {
int compare = compareRows(row, r);
if (compare == 0) {
if (indexType.isUnique()) {
if (!mayHaveDuplicates(row)) {
if (!mayHaveNullDuplicates(row)) {
throw getDuplicateKeyException(row.toString());
}
}
......
......@@ -143,7 +143,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
array[keyColumns - 1] = ValueLong.get(Long.MIN_VALUE);
ValueArray unique = ValueArray.get(array);
SearchRow row = convertToSearchRow(rowData);
if (!mayHaveDuplicates(row)) {
if (!mayHaveNullDuplicates(row)) {
requireUnique(row, dataMap, unique);
}
}
......@@ -195,7 +195,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
// this will detect committed entries only
unique = convertToKey(row);
unique.getList()[keyColumns - 1] = ValueLong.get(Long.MIN_VALUE);
if (mayHaveDuplicates(row)) {
if (mayHaveNullDuplicates(row)) {
// No further unique checks required
unique = null;
} else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论