Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
761c70e8
提交
761c70e8
authored
7 年前
作者:
sylvain-ilm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove TestAll.stdDropTableRestrict, as requested
上级
efe8c198
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
14 行增加
和
25 行删除
+14
-25
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+0
-5
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+9
-6
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+5
-14
没有找到文件。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
761c70e8
...
...
@@ -11,7 +11,6 @@ import java.util.ArrayList;
import
java.util.Properties
;
import
java.util.TimerTask
;
import
java.util.concurrent.TimeUnit
;
import
org.h2.Driver
;
import
org.h2.engine.Constants
;
import
org.h2.store.fs.FilePathRec
;
...
...
@@ -432,8 +431,6 @@ java org.h2.test.TestAll timer
/** If not null the database should be opened with the collation parameter */
public
String
collation
;
public
boolean
stdDropTableRestrict
;
/**
* The AB-BA locking detector.
*/
...
...
@@ -620,7 +617,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
defrag
=
false
;
traceLevelFile
=
throttle
=
0
;
cipher
=
null
;
stdDropTableRestrict
=
false
;
// memory is a good match for multi-threaded, makes things happen
// faster, more chance of exposing race conditions
...
...
@@ -1130,7 +1126,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
appendIf
(
buff
,
defrag
,
"defrag"
);
appendIf
(
buff
,
splitFileSystem
,
"split"
);
appendIf
(
buff
,
collation
!=
null
,
collation
);
appendIf
(
buff
,
stdDropTableRestrict
,
"stdDropTableRestrict"
);
return
buff
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
761c70e8
...
...
@@ -34,7 +34,6 @@ import java.util.ArrayList;
import
java.util.LinkedList
;
import
java.util.SimpleTimeZone
;
import
java.util.concurrent.TimeUnit
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FilePath
;
...
...
@@ -167,8 +166,15 @@ public abstract class TestBase {
* @return the connection
*/
public
Connection
getConnection
(
String
name
)
throws
SQLException
{
return
getConnectionInternal
(
getURL
(
name
,
true
),
getUser
(),
getPassword
());
return
getConnection
(
name
,
null
);
}
public
Connection
getConnection
(
final
String
name
,
final
Boolean
stdDropTableRestrict
)
throws
SQLException
{
String
url
=
getURL
(
name
,
true
);
if
(
stdDropTableRestrict
!=
null
)
{
url
=
addOption
(
url
,
"STANDARD_DROP_TABLE_RESTRICT"
,
stdDropTableRestrict
.
toString
());
}
return
getConnectionInternal
(
url
,
getUser
(),
getPassword
());
}
/**
...
...
@@ -334,9 +340,6 @@ public abstract class TestBase {
if
(
config
.
collation
!=
null
)
{
url
=
addOption
(
url
,
"COLLATION"
,
config
.
collation
);
}
if
(
config
.
stdDropTableRestrict
)
{
url
=
addOption
(
url
,
"STANDARD_DROP_TABLE_RESTRICT"
,
"TRUE"
);
}
return
"jdbc:h2:"
+
url
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
761c70e8
...
...
@@ -19,7 +19,6 @@ import java.sql.Timestamp;
import
java.util.List
;
import
java.util.Random
;
import
java.util.concurrent.TimeUnit
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.store.fs.FileUtils
;
...
...
@@ -280,14 +279,8 @@ public class TestCases extends TestBase {
}
private
void
testDropTable
()
throws
SQLException
{
final
boolean
prevVal
=
config
.
stdDropTableRestrict
;
try
{
for
(
final
boolean
newVal
:
new
boolean
[]
{
true
,
false
})
{
config
.
stdDropTableRestrict
=
newVal
;
_testDropTable
();
}
}
finally
{
config
.
stdDropTableRestrict
=
prevVal
;
for
(
final
boolean
stdDropTableRestrict
:
new
boolean
[]
{
true
,
false
})
{
_testDropTable
(
stdDropTableRestrict
);
}
}
...
...
@@ -295,13 +288,13 @@ public class TestCases extends TestBase {
NONE
,
VIEW
,
FOREIGN_KEY
;
}
private
void
_testDropTable
()
throws
SQLException
{
private
void
_testDropTable
(
final
boolean
stdDropTableRestrict
)
throws
SQLException
{
trace
(
"testDrop"
);
for
(
final
boolean
restrict
:
new
boolean
[]
{
true
,
false
})
{
for
(
final
DropDependent
dropDep
:
DropDependent
.
values
())
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
,
stdDropTableRestrict
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int)"
);
if
(
dropDep
==
DropDependent
.
VIEW
)
{
...
...
@@ -314,9 +307,7 @@ public class TestCases extends TestBase {
// drop allowed if no references or cascade
final
boolean
expectedDropSuccess
=
dropDep
==
DropDependent
.
NONE
||
(!
config
.
stdDropTableRestrict
&&
dropDep
==
DropDependent
.
FOREIGN_KEY
)
||
!
restrict
;
||
(!
stdDropTableRestrict
&&
dropDep
==
DropDependent
.
FOREIGN_KEY
)
||
!
restrict
;
assertThrows
(
expectedDropSuccess
?
0
:
ErrorCode
.
CANNOT_DROP_2
,
stat
).
execute
(
"drop table test "
+
(
restrict
?
"restrict"
:
"cascade"
));
assertThrows
(
expectedDropSuccess
?
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
:
0
,
stat
).
execute
(
"select * from test"
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论