Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
07252ecf
提交
07252ecf
authored
7 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
convert some indexOf to contains
上级
da0ff518
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
38 行增加
和
40 行删除
+38
-40
BenchCThread.java
h2/src/test/org/h2/test/bench/BenchCThread.java
+2
-2
TestRunscript.java
h2/src/test/org/h2/test/db/TestRunscript.java
+34
-35
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+0
-1
TestClearReferences.java
h2/src/test/org/h2/test/unit/TestClearReferences.java
+2
-2
没有找到文件。
h2/src/test/org/h2/test/bench/BenchCThread.java
浏览文件 @
07252ecf
...
...
@@ -194,8 +194,8 @@ public class BenchCThread {
rs
.
close
();
String
distInfo
=
dist
[(
dId
-
1
)
%
10
];
stock
[
number
-
1
]
=
sQuantity
;
if
(
(
data
.
indexOf
(
"original"
)
!=
-
1
)
&&
(
sData
.
indexOf
(
"original"
)
!=
-
1
))
{
if
(
data
.
contains
(
"original"
)
&&
sData
.
contains
(
"original"
))
{
bg
[
number
-
1
]
=
'B'
;
}
else
{
bg
[
number
-
1
]
=
'G'
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestRunscript.java
浏览文件 @
07252ecf
...
...
@@ -10,7 +10,6 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.Trigger
;
import
org.h2.store.fs.FileUtils
;
...
...
@@ -93,8 +92,8 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema include_schema1"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The schema 'exclude_schema1' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"exclude_schema1"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The schema 'exclude_schema1' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"exclude_schema1"
.
toUpperCase
())
);
}
rs
.
close
();
stat
.
execute
(
"create schema include_schema2"
);
...
...
@@ -122,24 +121,24 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script table a.test1"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The table 'a.test2' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"a.test2"
.
toUpperCase
())
==
-
1
);
assert
Tru
e
(
"The table 'b.test1' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"b.test1"
.
toUpperCase
())
==
-
1
);
assert
Tru
e
(
"The table 'b.test2' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"b.test2"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The table 'a.test2' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"a.test2"
.
toUpperCase
())
);
assert
Fals
e
(
"The table 'b.test1' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"b.test1"
.
toUpperCase
())
);
assert
Fals
e
(
"The table 'b.test2' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"b.test2"
.
toUpperCase
())
);
}
rs
.
close
();
stat
.
execute
(
"set schema b"
);
stat
.
execute
(
"script table test1"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The table 'a.test1' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"a.test1"
.
toUpperCase
())
==
-
1
);
assert
Tru
e
(
"The table 'a.test2' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"a.test2"
.
toUpperCase
())
==
-
1
);
assert
Tru
e
(
"The table 'b.test2' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"b.test2"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The table 'a.test1' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"a.test1"
.
toUpperCase
())
);
assert
Fals
e
(
"The table 'a.test2' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"a.test2"
.
toUpperCase
())
);
assert
Fals
e
(
"The table 'b.test2' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"b.test2"
.
toUpperCase
())
);
}
stat
.
execute
(
"script nosettings table a.test1, test2"
);
rs
=
stat
.
getResultSet
();
...
...
@@ -163,9 +162,9 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema b"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The function alias 'int_decode' "
+
assert
Fals
e
(
"The function alias 'int_decode' "
+
"should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"int_decode"
.
toUpperCase
())
==
-
1
);
rs
.
getString
(
1
).
contains
(
"int_decode"
.
toUpperCase
())
);
}
rs
.
close
();
conn
.
close
();
...
...
@@ -186,9 +185,9 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema b"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The constant 'default_email' "
+
assert
Fals
e
(
"The constant 'default_email' "
+
"should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"default_email"
.
toUpperCase
())
==
-
1
);
rs
.
getString
(
1
).
contains
(
"default_email"
.
toUpperCase
())
);
}
rs
.
close
();
conn
.
close
();
...
...
@@ -207,8 +206,8 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema b"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The sequence 'seq_id' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"seq_id"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The sequence 'seq_id' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"seq_id"
.
toUpperCase
())
);
}
rs
.
close
();
conn
.
close
();
...
...
@@ -229,18 +228,18 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema b"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The sequence 'unique_constraint' "
+
assert
Fals
e
(
"The sequence 'unique_constraint' "
+
"should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"unique_constraint"
.
toUpperCase
())
==
-
1
);
rs
.
getString
(
1
).
contains
(
"unique_constraint"
.
toUpperCase
())
);
}
rs
.
close
();
stat
.
execute
(
"create table a.test2(x varchar, y int)"
);
stat
.
execute
(
"script table a.test2"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The sequence 'unique_constraint' "
+
assert
Fals
e
(
"The sequence 'unique_constraint' "
+
"should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"unique_constraint"
.
toUpperCase
())
==
-
1
);
rs
.
getString
(
1
).
contains
(
"unique_constraint"
.
toUpperCase
())
);
}
rs
.
close
();
conn
.
close
();
...
...
@@ -261,16 +260,16 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema b"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The trigger 'trigger_insert' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"trigger_insert"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The trigger 'trigger_insert' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"trigger_insert"
.
toUpperCase
())
);
}
rs
.
close
();
stat
.
execute
(
"create table a.test2(x varchar, y int)"
);
stat
.
execute
(
"script table a.test2"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The trigger 'trigger_insert' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"trigger_insert"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The trigger 'trigger_insert' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"trigger_insert"
.
toUpperCase
())
);
}
rs
.
close
();
conn
.
close
();
...
...
@@ -294,8 +293,8 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script schema b"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The grant to 'USER_A1' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"to USER_A1"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The grant to 'USER_A1' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"to USER_A1"
.
toUpperCase
())
);
}
rs
.
close
();
stat
.
execute
(
"create user USER_A2 password 'test'"
);
...
...
@@ -304,10 +303,10 @@ public class TestRunscript extends TestBase implements Trigger {
stat
.
execute
(
"script table a.test2"
);
rs
=
stat
.
getResultSet
();
while
(
rs
.
next
())
{
assert
Tru
e
(
"The grant to 'USER_A1' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"to USER_A1"
.
toUpperCase
())
==
-
1
);
assert
Tru
e
(
"The grant to 'USER_B1' should not be present in the script"
,
rs
.
getString
(
1
).
indexOf
(
"to USER_B1"
.
toUpperCase
())
==
-
1
);
assert
Fals
e
(
"The grant to 'USER_A1' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"to USER_A1"
.
toUpperCase
())
);
assert
Fals
e
(
"The grant to 'USER_B1' should not be present in the script"
,
rs
.
getString
(
1
).
contains
(
"to USER_B1"
.
toUpperCase
())
);
}
rs
.
close
();
conn
.
close
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
07252ecf
...
...
@@ -19,7 +19,6 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.Random
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
import
org.h2.util.New
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestClearReferences.java
浏览文件 @
07252ecf
...
...
@@ -154,7 +154,7 @@ public class TestClearReferences extends TestBase {
throw
e
;
}
for
(
Field
field
:
fields
)
{
if
(
field
.
getType
().
isPrimitive
()
||
field
.
getName
().
indexOf
(
"$"
)
!=
-
1
)
{
if
(
field
.
getType
().
isPrimitive
()
||
field
.
getName
().
contains
(
"$"
)
)
{
continue
;
}
int
modifiers
=
field
.
getModifiers
();
...
...
@@ -182,7 +182,7 @@ public class TestClearReferences extends TestBase {
private
void
clearInstance
(
Object
instance
)
throws
Exception
{
for
(
Field
field
:
instance
.
getClass
().
getDeclaredFields
())
{
if
(
field
.
getType
().
isPrimitive
()
||
(
field
.
getName
().
indexOf
(
"$"
)
!=
-
1
))
{
if
(
field
.
getType
().
isPrimitive
()
||
field
.
getName
().
contains
(
"$"
))
{
continue
;
}
int
modifiers
=
field
.
getModifiers
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论