Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f89dd431
提交
f89dd431
authored
1月 06, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
41a063a1
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
42 行增加
和
12 行删除
+42
-12
ScanCursor.java
h2/src/main/org/h2/index/ScanCursor.java
+12
-9
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+1
-1
Permutations.java
h2/src/main/org/h2/util/Permutations.java
+17
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+0
-2
TestMvcc1.java
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
+12
-0
没有找到文件。
h2/src/main/org/h2/index/ScanCursor.java
浏览文件 @
f89dd431
...
@@ -45,22 +45,25 @@ public class ScanCursor implements Cursor {
...
@@ -45,22 +45,25 @@ public class ScanCursor implements Cursor {
public
boolean
next
()
throws
SQLException
{
public
boolean
next
()
throws
SQLException
{
if
(
multiVersion
)
{
if
(
multiVersion
)
{
while
(
true
)
{
while
(
true
)
{
if
(
delta
.
hasNext
())
{
if
(
delta
!=
null
)
{
if
(!
delta
.
hasNext
())
{
delta
=
null
;
row
=
null
;
continue
;
}
else
{
row
=
(
Row
)
delta
.
next
();
row
=
(
Row
)
delta
.
next
();
if
(!
row
.
getDeleted
()
||
row
.
getSessionId
()
==
session
.
getId
())
{
if
(!
row
.
getDeleted
()
||
row
.
getSessionId
()
==
session
.
getId
())
{
row
=
null
;
continue
;
continue
;
}
}
}
}
else
{
}
else
{
row
=
scan
.
getNextRow
(
session
,
row
);
row
=
scan
.
getNextRow
(
session
,
row
);
if
(
row
!=
null
&&
row
.
getSessionId
()
!=
0
&&
row
.
getSessionId
()
!=
session
.
getId
())
{
continue
;
}
}
if
(
row
==
null
)
{
break
;
}
}
if
(
row
.
getSessionId
()
==
0
||
row
.
getSessionId
()
==
session
.
getId
()
||
row
.
getDeleted
())
{
break
;
break
;
}
}
}
return
row
!=
null
;
return
row
!=
null
;
}
}
row
=
scan
.
getNextRow
(
session
,
row
);
row
=
scan
.
getNextRow
(
session
,
row
);
...
...
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
f89dd431
...
@@ -144,7 +144,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -144,7 +144,7 @@ public class ScanIndex extends BaseIndex {
public
void
commit
(
int
operation
,
Row
row
)
throws
SQLException
{
public
void
commit
(
int
operation
,
Row
row
)
throws
SQLException
{
if
(
database
.
isMultiVersion
())
{
if
(
database
.
isMultiVersion
())
{
if
(
delta
!=
null
&&
operation
==
UndoLogRecord
.
DELETE
)
{
if
(
delta
!=
null
)
{
delta
.
remove
(
row
);
delta
.
remove
(
row
);
}
}
incrementRowCount
(
row
.
getSessionId
(),
operation
==
UndoLogRecord
.
DELETE
?
1
:
-
1
);
incrementRowCount
(
row
.
getSessionId
(),
operation
==
UndoLogRecord
.
DELETE
?
1
:
-
1
);
...
...
h2/src/main/org/h2/util/Permutations.java
浏览文件 @
f89dd431
...
@@ -19,10 +19,23 @@ public class Permutations {
...
@@ -19,10 +19,23 @@ public class Permutations {
private
int
[]
index
;
private
int
[]
index
;
private
boolean
hasNext
=
true
;
private
boolean
hasNext
=
true
;
/**
* Create a new permutations object.
*
* @param in the source array
* @param out the target array
*/
public
Permutations
(
Object
[]
in
,
Object
[]
out
)
{
public
Permutations
(
Object
[]
in
,
Object
[]
out
)
{
this
(
in
,
out
,
in
.
length
);
this
(
in
,
out
,
in
.
length
);
}
}
/**
* Create a new permutations object.
*
* @param in the source array
* @param out the target array
* @param m the number of output elements to generate
*/
public
Permutations
(
Object
[]
in
,
Object
[]
out
,
int
m
)
{
public
Permutations
(
Object
[]
in
,
Object
[]
out
,
int
m
)
{
this
.
n
=
in
.
length
;
this
.
n
=
in
.
length
;
this
.
m
=
m
;
this
.
m
=
m
;
...
@@ -86,6 +99,8 @@ public class Permutations {
...
@@ -86,6 +99,8 @@ public class Permutations {
/**
/**
* Get the index of the first element from the right that is less
* Get the index of the first element from the right that is less
* than its neighbor on the right.
* than its neighbor on the right.
*
* @return the index or -1 if non is found
*/
*/
private
int
rightmostDip
()
{
private
int
rightmostDip
()
{
for
(
int
i
=
n
-
2
;
i
>=
0
;
i
--)
{
for
(
int
i
=
n
-
2
;
i
>=
0
;
i
--)
{
...
@@ -98,6 +113,8 @@ public class Permutations {
...
@@ -98,6 +113,8 @@ public class Permutations {
/**
/**
* Reverse the elements to the right of the specified index.
* Reverse the elements to the right of the specified index.
*
* @param i the index
*/
*/
private
void
reverseAfter
(
int
i
)
{
private
void
reverseAfter
(
int
i
)
{
int
start
=
i
+
1
;
int
start
=
i
+
1
;
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
f89dd431
...
@@ -154,8 +154,6 @@ java org.h2.test.TestAll timer
...
@@ -154,8 +154,6 @@ java org.h2.test.TestAll timer
/*
/*
Javadocs: abstract class (Table)
add tests with select distinct type (code coverage)
add tests with select distinct type (code coverage)
documentation: package.html
documentation: package.html
...
...
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
浏览文件 @
f89dd431
...
@@ -89,6 +89,18 @@ public class TestMvcc1 extends TestBase {
...
@@ -89,6 +89,18 @@ public class TestMvcc1 extends TestBase {
s2
.
execute
(
"drop table test"
);
s2
.
execute
(
"drop table test"
);
c2
.
rollback
();
c2
.
rollback
();
// table scan problem
s1
.
execute
(
"create table test(id int, name varchar)"
);
s1
.
execute
(
"insert into test values(1, 'A'), (2, 'B')"
);
c1
.
commit
();
test
(
s1
,
"select count(*) from test where name<>'C'"
,
"2"
);
s2
.
execute
(
"update test set name='B2' where id=2"
);
test
(
s1
,
"select count(*) from test where name<>'C'"
,
"2"
);
c2
.
commit
();
s2
.
execute
(
"drop table test"
);
c2
.
rollback
();
// referential integrity problem
// referential integrity problem
s1
.
execute
(
"create table a (id integer identity not null, code varchar(10) not null, primary key(id))"
);
s1
.
execute
(
"create table a (id integer identity not null, code varchar(10) not null, primary key(id))"
);
s1
.
execute
(
"create table b (name varchar(100) not null, a integer, primary key(name), foreign key(a) references a(id))"
);
s1
.
execute
(
"create table b (name varchar(100) not null, a integer, primary key(name), foreign key(a) references a(id))"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论