Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f6c2de67
提交
f6c2de67
authored
5月 01, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Require expected values in TestScript
上级
ad96fd7c
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
63 行增加
和
22 行删除
+63
-22
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+10
-4
enum.sql
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
+12
-7
timestamp-with-timezone.sql
...org/h2/test/scripts/datatypes/timestamp-with-timezone.sql
+1
-3
mergeUsing.sql
h2/src/test/org/h2/test/scripts/dml/mergeUsing.sql
+2
-3
array-agg.sql
...est/org/h2/test/scripts/functions/aggregate/array-agg.sql
+1
-0
avg.sql
h2/src/test/org/h2/test/scripts/functions/aggregate/avg.sql
+1
-0
bit-and.sql
.../test/org/h2/test/scripts/functions/aggregate/bit-and.sql
+1
-0
bit-or.sql
...c/test/org/h2/test/scripts/functions/aggregate/bit-or.sql
+1
-0
count.sql
...rc/test/org/h2/test/scripts/functions/aggregate/count.sql
+1
-0
group-concat.sql
.../org/h2/test/scripts/functions/aggregate/group-concat.sql
+1
-0
max.sql
h2/src/test/org/h2/test/scripts/functions/aggregate/max.sql
+1
-0
median.sql
...c/test/org/h2/test/scripts/functions/aggregate/median.sql
+2
-0
min.sql
h2/src/test/org/h2/test/scripts/functions/aggregate/min.sql
+1
-0
sum.sql
h2/src/test/org/h2/test/scripts/functions/aggregate/sum.sql
+1
-0
char.sql
h2/src/test/org/h2/test/scripts/functions/string/char.sql
+1
-1
concat.sql
h2/src/test/org/h2/test/scripts/functions/string/concat.sql
+1
-0
difference.sql
.../test/org/h2/test/scripts/functions/string/difference.sql
+1
-2
regex-replace.sql
...st/org/h2/test/scripts/functions/string/regex-replace.sql
+2
-0
soundex.sql
h2/src/test/org/h2/test/scripts/functions/string/soundex.sql
+1
-1
rownum.sql
h2/src/test/org/h2/test/scripts/functions/system/rownum.sql
+1
-1
set.sql
h2/src/test/org/h2/test/scripts/functions/system/set.sql
+4
-0
joins.sql
h2/src/test/org/h2/test/scripts/joins.sql
+15
-0
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+1
-0
没有找到文件。
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
f6c2de67
...
...
@@ -494,10 +494,7 @@ public class TestScript extends TestBase {
if
(
reconnectOften
&&
sql
.
toUpperCase
().
startsWith
(
"EXPLAIN"
))
{
return
;
}
errors
.
append
(
fileName
).
append
(
'\n'
);
errors
.
append
(
"line: "
).
append
(
in
.
getLineNumber
()).
append
(
'\n'
);
errors
.
append
(
"exp: "
).
append
(
compare
).
append
(
'\n'
);
errors
.
append
(
"got: "
).
append
(
s
).
append
(
'\n'
);
addWriteResultError
(
compare
,
s
);
if
(
ex
!=
null
)
{
TestBase
.
logError
(
"script"
,
ex
);
}
...
...
@@ -508,11 +505,20 @@ public class TestScript extends TestBase {
}
}
}
else
{
addWriteResultError
(
"<nothing>"
,
s
);
TestBase
.
logErrorMessage
(
errors
.
toString
());
putBack
=
compare
;
}
write
(
s
);
}
private
void
addWriteResultError
(
String
expected
,
String
got
)
{
errors
.
append
(
fileName
).
append
(
'\n'
);
errors
.
append
(
"line: "
).
append
(
in
.
getLineNumber
()).
append
(
'\n'
);
errors
.
append
(
"exp: "
).
append
(
expected
).
append
(
'\n'
);
errors
.
append
(
"got: "
).
append
(
got
).
append
(
'\n'
);
}
private
void
write
(
String
s
)
{
outputLineNo
++;
out
.
println
(
s
);
...
...
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
浏览文件 @
f6c2de67
...
...
@@ -24,6 +24,7 @@ select * from card;
>
0
clubs
>
3
hearts
>
4
null
>
rows
:
3
select
*
from
card
order
by
suit
;
>
RANK
SUIT
...
...
@@ -31,6 +32,7 @@ select * from card order by suit;
>
4
null
>
3
hearts
>
0
clubs
>
rows
(
ordered
):
3
insert
into
card
(
rank
,
suit
)
values
(
8
,
'diamonds'
),
(
10
,
'clubs'
),
(
7
,
'hearts'
);
>
update
count
:
3
...
...
@@ -42,17 +44,13 @@ select suit, count(rank) from card group by suit order by suit, count(rank);
>
hearts
2
>
clubs
2
>
diamonds
1
>
rows
(
ordered
):
4
select
rank
from
card
where
suit
=
'diamonds'
;
>
RANK
>
----
>
8
>>
8
select
column_type
from
information_schema
.
columns
where
COLUMN_NAME
=
'SUIT'
;
>
COLUMN_TYPE
>
------------------------------------------
>
ENUM
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
)
>
rows
:
1
>>
ENUM
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
)
--- ENUM integer-based operations
...
...
@@ -61,6 +59,7 @@ select rank from card where suit = 1;
>
----
>
0
>
10
>
rows
:
2
insert
into
card
(
rank
,
suit
)
values
(
5
,
2
);
>
update
count
:
1
...
...
@@ -69,6 +68,7 @@ select * from card where rank = 5;
>
RANK
SUIT
>
---- ------
>
5
spades
>
rows
:
1
--- ENUM edge cases
...
...
@@ -100,6 +100,7 @@ select * from card;
>
---- ------
>
0
clubs
>
3
hearts
>
rows
:
2
drop
table
card
;
>
ok
...
...
@@ -125,6 +126,7 @@ select rank from card where suit = 'clubs';
>
----
>
0
>
1
>
rows
:
2
drop
table
card
;
>
ok
...
...
@@ -143,18 +145,21 @@ insert into card (rank, suit) values (0, 'clubs'), (3, 'hearts'), (1, 'clubs');
>
update
count
:
3
create
index
idx_card_suite
on
card
(
`suit`
);
>
ok
select
rank
from
card
where
suit
=
'clubs'
;
>
RANK
>
----
>
0
>
1
>
rows
:
2
select
rank
from
card
where
suit
in
(
'clubs'
);
>
RANK
>
----
>
0
>
1
>
rows
:
2
drop
table
card
;
>
ok
...
...
h2/src/test/org/h2/test/scripts/datatypes/timestamp-with-timezone.sql
浏览文件 @
f6c2de67
...
...
@@ -10,9 +10,7 @@ INSERT INTO tab_with_timezone(x) VALUES ('2017-01-01');
>
update
count
:
1
SELECT
"Query"
.
*
FROM
(
select
*
from
tab_with_timezone
where
x
>
'2016-01-01'
)
AS
"Query"
;
>
X
>
----------------------
>
2017
-
01
-
01
00
:
00
:
00
+
00
>>
2017
-
01
-
01
00
:
00
:
00
+
00
DELETE
FROM
tab_with_timezone
;
>
update
count
:
1
...
...
h2/src/test/org/h2/test/scripts/dml/mergeUsing.sql
浏览文件 @
f6c2de67
...
...
@@ -19,6 +19,7 @@ SELECT * FROM PARENT;
>
-- -----
>
1
Coco1
>
2
Coco2
>
rows
:
2
EXPLAIN
PLAN
MERGE
INTO
PARENT
AS
P
...
...
@@ -28,9 +29,7 @@ EXPLAIN PLAN
UPDATE
SET
P
.
NAME
=
S
.
NAME
WHERE
2
=
2
WHEN
NOT
MATCHED
THEN
INSERT
(
ID
,
NAME
)
VALUES
(
S
.
ID
,
S
.
NAME
);
>
PLAN
>
---------------------------------------------------------------------------------------------------------------------------------
>
MERGE
INTO
PUBLIC
.
PARENT
(
ID
,
NAME
)
KEY
(
ID
)
SELECT
X
AS
ID
,
(
'Coco'
||
X
)
AS
NAME
FROM
SYSTEM_RANGE
(
1
,
2
)
/* PUBLIC.RANGE_INDEX */
>>
MERGE
INTO
PUBLIC
.
PARENT
(
ID
,
NAME
)
KEY
(
ID
)
SELECT
X
AS
ID
,
(
'Coco'
||
X
)
AS
NAME
FROM
SYSTEM_RANGE
(
1
,
2
)
/* PUBLIC.RANGE_INDEX */
DROP
TABLE
PARENT
;
>
ok
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/array-agg.sql
浏览文件 @
f6c2de67
...
...
@@ -20,6 +20,7 @@ select array_agg(v order by v asc),
>
rows
(
ordered
):
1
create
index
test_idx
on
test
(
v
);
>
ok
select
ARRAY_AGG
(
v
order
by
v
asc
),
ARRAY_AGG
(
v
order
by
v
desc
)
filter
(
where
v
>=
'4'
)
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/avg.sql
浏览文件 @
f6c2de67
...
...
@@ -18,6 +18,7 @@ select avg(v), avg(v) filter (where v >= 40) from test where v <= 100;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
avg
(
v
),
avg
(
v
)
filter
(
where
v
>=
40
)
from
test
where
v
<=
100
;
>
AVG
(
V
)
AVG
(
V
)
FILTER
(
WHERE
(
V
>=
40
))
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/bit-and.sql
浏览文件 @
f6c2de67
...
...
@@ -21,6 +21,7 @@ select bit_and(v), bit_and(v) filter (where v <= 0xffffffff0fff) from test where
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
bit_and
(
v
),
bit_and
(
v
)
filter
(
where
v
<=
0
xffffffff0fff
)
from
test
where
v
>=
0
xff0fffffffff
;
>
BIT_AND
(
V
)
BIT_AND
(
V
)
FILTER
(
WHERE
(
V
<=
281474976649215
))
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/bit-or.sql
浏览文件 @
f6c2de67
...
...
@@ -20,6 +20,7 @@ select bit_or(v), bit_or(v) filter (where v >= 8) from test where v <= 512;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
bit_or
(
v
),
bit_or
(
v
)
filter
(
where
v
>=
8
)
from
test
where
v
<=
512
;
>
BIT_OR
(
V
)
BIT_OR
(
V
)
FILTER
(
WHERE
(
V
>=
8
))
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/count.sql
浏览文件 @
f6c2de67
...
...
@@ -18,6 +18,7 @@ select count(v), count(v) filter (where v >= 4) from test where v <= 10;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
count
(
v
),
count
(
v
)
filter
(
where
v
>=
4
)
from
test
where
v
<=
10
;
>
COUNT
(
V
)
COUNT
(
V
)
FILTER
(
WHERE
(
V
>=
4
))
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/group-concat.sql
浏览文件 @
f6c2de67
...
...
@@ -20,6 +20,7 @@ select group_concat(v order by v asc separator '-'),
>
rows
(
ordered
):
1
create
index
test_idx
on
test
(
v
);
>
ok
select
group_concat
(
v
order
by
v
asc
separator
'-'
),
group_concat
(
v
order
by
v
desc
separator
'-'
)
filter
(
where
v
>=
'4'
)
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/max.sql
浏览文件 @
f6c2de67
...
...
@@ -18,6 +18,7 @@ select max(v), max(v) filter (where v <= 8) from test where v <= 10;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
max
(
v
),
max
(
v
)
filter
(
where
v
<=
8
)
from
test
where
v
<=
10
;
>
MAX
(
V
)
MAX
(
V
)
FILTER
(
WHERE
(
V
<=
8
))
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/median.sql
浏览文件 @
f6c2de67
...
...
@@ -598,6 +598,7 @@ select median(v), median(v) filter (where v >= 40) from test where v <= 100;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
median
(
v
),
median
(
v
)
filter
(
where
v
>=
40
)
from
test
where
v
<=
100
;
>
MEDIAN
(
V
)
MEDIAN
(
V
)
FILTER
(
WHERE
(
V
>=
40
))
...
...
@@ -623,6 +624,7 @@ insert into test values
(
'First'
,
10
),
(
'First'
,
10
),
(
'First'
,
20
),
(
'First'
,
30
),
(
'First'
,
30
),
(
'Second'
,
5
),
(
'Second'
,
4
),
(
'Second'
,
20
),
(
'Second'
,
22
),
(
'Second'
,
300
),
(
'Third'
,
3
),
(
'Third'
,
100
),
(
'Third'
,
150
),
(
'Third'
,
170
),
(
'Third'
,
400
);
>
update
count
:
15
select
dept
,
median
(
amount
)
from
test
group
by
dept
order
by
dept
;
>
DEPT
MEDIAN
(
AMOUNT
)
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/min.sql
浏览文件 @
f6c2de67
...
...
@@ -18,6 +18,7 @@ select min(v), min(v) filter (where v >= 4) from test where v >= 2;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
min
(
v
),
min
(
v
)
filter
(
where
v
>=
4
)
from
test
where
v
>=
2
;
>
MIN
(
V
)
MIN
(
V
)
FILTER
(
WHERE
(
V
>=
4
))
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/sum.sql
浏览文件 @
f6c2de67
...
...
@@ -18,6 +18,7 @@ select sum(v), sum(v) filter (where v >= 4) from test where v <= 10;
>
rows
:
1
create
index
test_idx
on
test
(
v
);
>
ok
select
sum
(
v
),
sum
(
v
)
filter
(
where
v
>=
4
)
from
test
where
v
<=
10
;
>
SUM
(
V
)
SUM
(
V
)
FILTER
(
WHERE
(
V
>=
4
))
...
...
h2/src/test/org/h2/test/scripts/functions/string/char.sql
浏览文件 @
f6c2de67
...
...
@@ -7,10 +7,10 @@ create memory table test(id int primary key, name varchar(255));
>
ok
insert
into
test
values
(
1
,
'Hello'
);
>
update
count
:
1
select
char
(
null
)
en
,
char
(
65
)
ea
from
test
;
>
EN
EA
>
---- --
>
null
A
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/string/concat.sql
浏览文件 @
f6c2de67
...
...
@@ -6,6 +6,7 @@ create memory table test(id int primary key, name varchar(255));
>
ok
insert
into
test
values
(
1
,
'Hello'
);
>
update
count
:
1
select
concat
(
null
,
null
)
en
,
concat
(
null
,
'a'
)
ea
,
concat
(
'b'
,
null
)
eb
,
concat
(
'ab'
,
'c'
)
abc
from
test
;
>
EN
EA
EB
ABC
...
...
h2/src/test/org/h2/test/scripts/functions/string/difference.sql
浏览文件 @
f6c2de67
...
...
@@ -7,6 +7,7 @@ create memory table test(id int primary key, name varchar(255));
>
ok
insert
into
test
values
(
1
,
'Hello'
);
>
update
count
:
1
select
difference
(
null
,
null
)
en
,
difference
(
'a'
,
null
)
en1
,
difference
(
null
,
'a'
)
en2
from
test
;
>
EN
EN1
EN2
...
...
@@ -19,5 +20,3 @@ select difference('abc', 'abc') e0, difference('Thomas', 'Tom') e1 from test;
>
-- --
>
4
3
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/string/regex-replace.sql
浏览文件 @
f6c2de67
...
...
@@ -13,6 +13,7 @@ select regexp_replace('Sylvain', 'S..', 'TOTO', 'mni');
>> TOTOvain
set mode oracle;
> ok
select regexp_replace('
first
last
', '
(
\
w
+
)
(
\
w
+
)
', '
\
2
\
1
');
>> last first
...
...
@@ -27,6 +28,7 @@ select regexp_replace('first last', '(\w+) (\w+)', '$2 $1');
>> $2 $1
set mode regular;
> ok
select regexp_replace('
first
last
', '
(
\
w
+
)
(
\
w
+
)
', '
\
2
\
1
');
>> 2 1
...
...
h2/src/test/org/h2/test/scripts/functions/string/soundex.sql
浏览文件 @
f6c2de67
...
...
@@ -7,6 +7,7 @@ create memory table test(id int primary key, name varchar(255));
>
ok
insert
into
test
values
(
1
,
'Hello'
);
>
update
count
:
1
select
soundex
(
null
)
en
,
soundex
(
'tom'
)
et
from
test
;
>
EN
ET
...
...
@@ -23,4 +24,3 @@ soundex('VanDeusen') V532, soundex('Ashcraft') A261 from test;
>
---- ---- ---- ---- ---- ---- ---- ----
>
W252
L000
G362
P236
J250
T522
V532
A261
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/system/rownum.sql
浏览文件 @
f6c2de67
...
...
@@ -11,7 +11,7 @@ select row_number() over () as rnum, str from test where str = 'A';
>
RNUM
STR
>
---- ---
>
1
A
>
rows
:
1
drop
table
test
;
>
ok
h2/src/test/org/h2/test/scripts/functions/system/set.sql
浏览文件 @
f6c2de67
...
...
@@ -24,6 +24,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID_VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _12345678
>
VERY_VERY_VERY_LONG_ID_VERY_VE
_123456789012345
SUMX1
SUMX147
x
noName6
noName7
>
------------------------------ ---------------- ----- ------- - ------- -------
>
1
4
4
51
x
!!!
!!!!
>
rows
:
1
SET
COLUMN_NAME_RULES
=
EMULATE
=
'Oracle'
;
>
ok
...
...
@@ -33,6 +34,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM
>
VERY_VERY_VERY_LONG_ID
_123456789012345
SUMX1
SUMX147
x
_UNNAMED_6
_UNNAMED_7
>
---------------------- ---------------- ----- ------- - ---------- ----------
>
1
4
4
51
x
!!!
!!!!
>
rows
:
1
SET
COLUMN_NAME_RULES
=
EMULATE
=
'Oracle'
;
>
ok
...
...
@@ -42,6 +44,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM
>
VERY_VERY_VERY_LONG_ID
_123456789012345
SUMX1
SUMX147
x
_UNNAMED_6
_UNNAMED_7
_23456789012345678901234567890XXX
>
---------------------- ---------------- ----- ------- - ---------- ---------- ---------------------------------
>
1
4
4
51
x
!!!
!!!!
Very
Long
>
rows
:
1
SET
COLUMN_NAME_RULES
=
EMULATE
=
'PostgreSQL'
;
>
ok
...
...
@@ -51,6 +54,7 @@ SELECT 1 AS VERY_VERY_VERY_LONG_ID, SUM(X)+1 AS _123456789012345, SUM(X)+1 , SUM
>
VERY_VERY_VERY_LONG_ID
_123456789012345
SUMX1
SUMX147
x
_UNNAMED_6
_UNNAMED_7
QuotedColumnId
>
---------------------- ---------------- ----- ------- - ---------- ---------- --------------
>
1
4
4
51
x
!!!
!!!!
999
>
rows
:
1
SET
COLUMN_NAME_RULES
=
DEFAULT
;
>
ok
...
...
h2/src/test/org/h2/test/scripts/joins.sql
浏览文件 @
f6c2de67
...
...
@@ -764,21 +764,36 @@ DROP TABLE C;
>
ok
CREATE
TABLE
T1
(
X1
INT
);
>
ok
CREATE
TABLE
T2
(
X2
INT
);
>
ok
CREATE
TABLE
T3
(
X3
INT
);
>
ok
CREATE
TABLE
T4
(
X4
INT
);
>
ok
CREATE
TABLE
T5
(
X5
INT
);
>
ok
INSERT
INTO
T1
VALUES
(
1
);
>
update
count
:
1
INSERT
INTO
T1
VALUES
(
NULL
);
>
update
count
:
1
INSERT
INTO
T2
VALUES
(
1
);
>
update
count
:
1
INSERT
INTO
T2
VALUES
(
NULL
);
>
update
count
:
1
INSERT
INTO
T3
VALUES
(
1
);
>
update
count
:
1
INSERT
INTO
T3
VALUES
(
NULL
);
>
update
count
:
1
INSERT
INTO
T4
VALUES
(
1
);
>
update
count
:
1
INSERT
INTO
T4
VALUES
(
NULL
);
>
update
count
:
1
INSERT
INTO
T5
VALUES
(
1
);
>
update
count
:
1
INSERT
INTO
T5
VALUES
(
NULL
);
>
update
count
:
1
SELECT
T1
.
X1
,
T2
.
X2
,
T3
.
X3
,
T4
.
X4
,
T5
.
X5
FROM
(
T1
INNER
JOIN
(
...
...
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
f6c2de67
...
...
@@ -8452,6 +8452,7 @@ select * from test where year in (select distinct year from test order by year d
>
---- ---------
>
2016
order
>
2016
execution
>
rows
(
ordered
):
2
drop
table
test
;
>
ok
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论