Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6b67928a
提交
6b67928a
authored
7 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename mayHaveDuplicates() to mayHaveNullDuplicates()
上级
859576ee
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
7 行增加
和
6 行删除
+7
-6
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+3
-2
PageBtree.java
h2/src/main/org/h2/index/PageBtree.java
+1
-1
TreeIndex.java
h2/src/main/org/h2/index/TreeIndex.java
+1
-1
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+2
-2
没有找到文件。
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
6b67928a
...
...
@@ -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
mayHave
Null
Duplicates
(
SearchRow
searchRow
)
{
switch
(
database
.
getMode
().
uniqueIndexNullsHandling
)
{
case
ALLOW_DUPLICATES_WITH_ANY_NULL:
for
(
int
index
:
columnIds
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageBtree.java
浏览文件 @
6b67928a
...
...
@@ -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
.
mayHave
Null
Duplicates
(
compare
))
{
throw
index
.
getDuplicateKeyException
(
compare
.
toString
());
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/TreeIndex.java
浏览文件 @
6b67928a
...
...
@@ -66,7 +66,7 @@ public class TreeIndex extends BaseIndex {
int
compare
=
compareRows
(
row
,
r
);
if
(
compare
==
0
)
{
if
(
indexType
.
isUnique
())
{
if
(!
mayHaveDuplicates
(
row
))
{
if
(!
mayHave
Null
Duplicates
(
row
))
{
throw
getDuplicateKeyException
(
row
.
toString
());
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
6b67928a
...
...
@@ -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
(!
mayHave
Null
Duplicates
(
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
(
mayHave
Null
Duplicates
(
row
))
{
// No further unique checks required
unique
=
null
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论