Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
fe655e2b
提交
fe655e2b
authored
6月 02, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract TRUNCATE TABLE tests into own script
上级
c6c72d96
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
58 行增加
和
55 行删除
+58
-55
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+1
-1
truncateTable.sql
h2/src/test/org/h2/test/scripts/ddl/truncateTable.sql
+57
-0
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+0
-54
没有找到文件。
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
fe655e2b
...
@@ -117,7 +117,7 @@ public class TestScript extends TestBase {
...
@@ -117,7 +117,7 @@ public class TestScript extends TestBase {
}
}
for
(
String
s
:
new
String
[]
{
"alterTableAdd"
,
"alterTableDropColumn"
,
for
(
String
s
:
new
String
[]
{
"alterTableAdd"
,
"alterTableDropColumn"
,
"createAlias"
,
"createSynonym"
,
"createView"
,
"createTable"
,
"createTrigger"
,
"createAlias"
,
"createSynonym"
,
"createView"
,
"createTable"
,
"createTrigger"
,
"dropSchema"
})
{
"dropSchema"
,
"truncateTable"
})
{
testScript
(
"ddl/"
+
s
+
".sql"
);
testScript
(
"ddl/"
+
s
+
".sql"
);
}
}
for
(
String
s
:
new
String
[]
{
"error_reporting"
,
"insertIgnore"
,
for
(
String
s
:
new
String
[]
{
"error_reporting"
,
"insertIgnore"
,
...
...
h2/src/test/org/h2/test/scripts/ddl/truncateTable.sql
0 → 100644
浏览文件 @
fe655e2b
-- Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0,
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
--
create
table
FOO
(
id
integer
primary
key
);
>
ok
create
table
BAR
(
fooId
integer
);
>
ok
alter
table
bar
add
foreign
key
(
fooId
)
references
foo
(
id
);
>
ok
truncate
table
bar
;
>
ok
truncate
table
foo
;
>
exception
CANNOT_TRUNCATE_1
drop
table
bar
,
foo
;
>
ok
CREATE
TABLE
TEST
(
ID
INT
PRIMARY
KEY
,
NAME
VARCHAR
);
>
ok
INSERT
INTO
TEST
VALUES
(
1
,
'Hello'
),
(
2
,
'World'
);
>
update
count
:
2
TRUNCATE
TABLE
TEST
;
>
ok
SELECT
*
FROM
TEST
;
>
ID
NAME
>
-- ----
>
rows
:
0
DROP
TABLE
TEST
;
>
ok
CREATE
TABLE
PARENT
(
ID
INT
PRIMARY
KEY
,
NAME
VARCHAR
);
>
ok
CREATE
TABLE
CHILD
(
PARENTID
INT
,
FOREIGN
KEY
(
PARENTID
)
REFERENCES
PARENT
(
ID
),
NAME
VARCHAR
);
>
ok
TRUNCATE
TABLE
CHILD
;
>
ok
TRUNCATE
TABLE
PARENT
;
>
exception
CANNOT_TRUNCATE_1
DROP
TABLE
CHILD
;
>
ok
DROP
TABLE
PARENT
;
>
ok
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
fe655e2b
...
@@ -2161,24 +2161,6 @@ drop all objects;
...
@@ -2161,24 +2161,6 @@ drop all objects;
call abc;
call abc;
> exception COLUMN_NOT_FOUND_1
> exception COLUMN_NOT_FOUND_1
create table FOO(id integer primary key);
> ok
create table BAR(fooId integer);
> ok
alter table bar add foreign key (fooId) references foo (id);
> ok
truncate table bar;
> ok
truncate table foo;
> exception CANNOT_TRUNCATE_1
drop table bar, foo;
> ok
CREATE TABLE test (family_name VARCHAR_IGNORECASE(63) NOT NULL);
CREATE TABLE test (family_name VARCHAR_IGNORECASE(63) NOT NULL);
> ok
> ok
...
@@ -4265,42 +4247,6 @@ SELECT "ROWNUM", ROWNUM, "SELECT" "AS", "PRIMARY" AS "X", "KEY", "NEXTVAL", "IND
...
@@ -4265,42 +4247,6 @@ SELECT "ROWNUM", ROWNUM, "SELECT" "AS", "PRIMARY" AS "X", "KEY", "NEXTVAL", "IND
DROP TABLE "CREATE";
DROP TABLE "CREATE";
> ok
> ok
--- truncate table ---------------------------------------------------------------------------------------------
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR);
> ok
INSERT INTO TEST VALUES(1, '
Hello
'), (2, '
World
');
> update count: 2
TRUNCATE TABLE TEST;
> ok
SELECT * FROM TEST;
> ID NAME
> -- ----
> rows: 0
DROP TABLE TEST;
> ok
CREATE TABLE PARENT(ID INT PRIMARY KEY, NAME VARCHAR);
> ok
CREATE TABLE CHILD(PARENTID INT, FOREIGN KEY(PARENTID) REFERENCES PARENT(ID), NAME VARCHAR);
> ok
TRUNCATE TABLE CHILD;
> ok
TRUNCATE TABLE PARENT;
> exception CANNOT_TRUNCATE_1
DROP TABLE CHILD;
> ok
DROP TABLE PARENT;
> ok
--- test case for number like string ---------------------------------------------------------------------------------------------
--- test case for number like string ---------------------------------------------------------------------------------------------
CREATE TABLE test (one bigint primary key, two bigint, three bigint);
CREATE TABLE test (one bigint primary key, two bigint, three bigint);
> ok
> ok
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论