Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
73cd2b87
提交
73cd2b87
authored
10月 09, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small improvements.
上级
c940fbb4
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
11 行删除
+15
-11
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+12
-8
IndexCursor.java
h2/src/main/org/h2/index/IndexCursor.java
+1
-1
PageBtreeIndex.java
h2/src/main/org/h2/index/PageBtreeIndex.java
+2
-2
没有找到文件。
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
73cd2b87
...
@@ -55,8 +55,9 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -55,8 +55,9 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
if
(
newIndexColumns
!=
null
)
{
if
(
newIndexColumns
!=
null
)
{
this
.
indexColumns
=
newIndexColumns
;
this
.
indexColumns
=
newIndexColumns
;
columns
=
new
Column
[
newIndexColumns
.
length
];
columns
=
new
Column
[
newIndexColumns
.
length
];
columnIds
=
new
int
[
columns
.
length
];
int
len
=
columns
.
length
;
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
columnIds
=
new
int
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
Column
col
=
newIndexColumns
[
i
].
column
;
Column
col
=
newIndexColumns
[
i
].
column
;
columns
[
i
]
=
col
;
columns
[
i
]
=
col
;
columnIds
[
i
]
=
col
.
getColumnId
();
columnIds
[
i
]
=
col
.
getColumnId
();
...
@@ -202,7 +203,10 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -202,7 +203,10 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
long
cost
=
rowCount
;
long
cost
=
rowCount
;
long
rows
=
rowCount
;
long
rows
=
rowCount
;
int
totalSelectivity
=
0
;
int
totalSelectivity
=
0
;
for
(
int
i
=
0
;
masks
!=
null
&&
i
<
columns
.
length
;
i
++)
{
if
(
masks
==
null
)
{
return
cost
;
}
for
(
int
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++)
{
Column
column
=
columns
[
i
];
Column
column
=
columns
[
i
];
int
index
=
column
.
getColumnId
();
int
index
=
column
.
getColumnId
();
int
mask
=
masks
[
index
];
int
mask
=
masks
[
index
];
...
@@ -235,7 +239,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -235,7 +239,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
}
}
public
int
compareRows
(
SearchRow
rowData
,
SearchRow
compare
)
{
public
int
compareRows
(
SearchRow
rowData
,
SearchRow
compare
)
{
for
(
int
i
=
0
;
i
<
indexColumns
.
length
;
i
++)
{
for
(
int
i
=
0
,
len
=
indexColumns
.
length
;
i
<
len
;
i
++)
{
int
index
=
columnIds
[
i
];
int
index
=
columnIds
[
i
];
Value
v
=
compare
.
getValue
(
index
);
Value
v
=
compare
.
getValue
(
index
);
if
(
v
==
null
)
{
if
(
v
==
null
)
{
...
@@ -287,11 +291,11 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -287,11 +291,11 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
}
}
private
int
compareValues
(
Value
a
,
Value
b
,
int
sortType
)
{
private
int
compareValues
(
Value
a
,
Value
b
,
int
sortType
)
{
boolean
aNull
=
a
==
null
,
bNull
=
b
==
null
;
if
(
a
==
b
)
{
if
(
aNull
||
bNull
)
{
if
(
aNull
==
bNull
)
{
return
0
;
return
0
;
}
}
boolean
aNull
=
a
==
null
,
bNull
=
b
==
null
;
if
(
aNull
||
bNull
)
{
return
SortOrder
.
compareNull
(
aNull
,
bNull
,
sortType
);
return
SortOrder
.
compareNull
(
aNull
,
bNull
,
sortType
);
}
}
int
comp
=
table
.
compareTypeSave
(
a
,
b
);
int
comp
=
table
.
compareTypeSave
(
a
,
b
);
...
@@ -302,7 +306,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -302,7 +306,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
}
}
public
int
getColumnIndex
(
Column
col
)
{
public
int
getColumnIndex
(
Column
col
)
{
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
for
(
int
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++)
{
if
(
columns
[
i
]
==
col
)
{
if
(
columns
[
i
]
==
col
)
{
return
i
;
return
i
;
}
}
...
...
h2/src/main/org/h2/index/IndexCursor.java
浏览文件 @
73cd2b87
...
@@ -49,7 +49,7 @@ public class IndexCursor implements Cursor {
...
@@ -49,7 +49,7 @@ public class IndexCursor implements Cursor {
indexColumns
=
new
IndexColumn
[
columns
.
length
];
indexColumns
=
new
IndexColumn
[
columns
.
length
];
IndexColumn
[]
idxCols
=
index
.
getIndexColumns
();
IndexColumn
[]
idxCols
=
index
.
getIndexColumns
();
if
(
idxCols
!=
null
)
{
if
(
idxCols
!=
null
)
{
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
for
(
int
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++)
{
int
idx
=
index
.
getColumnIndex
(
columns
[
i
]);
int
idx
=
index
.
getColumnIndex
(
columns
[
i
]);
if
(
idx
>=
0
)
{
if
(
idx
>=
0
)
{
indexColumns
[
i
]
=
idxCols
[
idx
];
indexColumns
[
i
]
=
idxCols
[
idx
];
...
...
h2/src/main/org/h2/index/PageBtreeIndex.java
浏览文件 @
73cd2b87
...
@@ -124,8 +124,8 @@ public class PageBtreeIndex extends PageIndex {
...
@@ -124,8 +124,8 @@ public class PageBtreeIndex extends PageIndex {
private
SearchRow
getSearchRow
(
Row
row
)
{
private
SearchRow
getSearchRow
(
Row
row
)
{
SearchRow
r
=
table
.
getTemplateSimpleRow
(
columns
.
length
==
1
);
SearchRow
r
=
table
.
getTemplateSimpleRow
(
columns
.
length
==
1
);
r
.
setKeyAndVersion
(
row
);
r
.
setKeyAndVersion
(
row
);
for
(
int
j
=
0
;
j
<
columns
.
length
;
j
++
)
{
for
(
Column
c
:
columns
)
{
int
idx
=
c
olumns
[
j
]
.
getColumnId
();
int
idx
=
c
.
getColumnId
();
r
.
setValue
(
idx
,
row
.
getValue
(
idx
));
r
.
setValue
(
idx
,
row
.
getValue
(
idx
));
}
}
return
r
;
return
r
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论