Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
1cd6ee15
Unverified
提交
1cd6ee15
authored
2月 27, 2019
作者:
Evgenij Ryazanov
提交者:
GitHub
2月 27, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1772 from katzyn/tests
Fix newlines in test scripts
上级
58a8b8bf
dc35938e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
44 个修改的文件
包含
496 行增加
和
96 行删除
+496
-96
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+58
-3
altertable-fk.sql
h2/src/test/org/h2/test/scripts/altertable-fk.sql
+0
-1
default-and-on_update.sql
h2/src/test/org/h2/test/scripts/default-and-on_update.sql
+0
-1
select.sql
h2/src/test/org/h2/test/scripts/dml/select.sql
+0
-1
with.sql
h2/src/test/org/h2/test/scripts/dml/with.sql
+1
-1
count.sql
...rc/test/org/h2/test/scripts/functions/aggregate/count.sql
+0
-1
acos.sql
h2/src/test/org/h2/test/scripts/functions/numeric/acos.sql
+0
-1
asin.sql
h2/src/test/org/h2/test/scripts/functions/numeric/asin.sql
+0
-1
atan.sql
h2/src/test/org/h2/test/scripts/functions/numeric/atan.sql
+0
-1
atan2.sql
h2/src/test/org/h2/test/scripts/functions/numeric/atan2.sql
+0
-2
bitand.sql
h2/src/test/org/h2/test/scripts/functions/numeric/bitand.sql
+0
-4
bitget.sql
h2/src/test/org/h2/test/scripts/functions/numeric/bitget.sql
+0
-1
bitor.sql
h2/src/test/org/h2/test/scripts/functions/numeric/bitor.sql
+0
-4
bitxor.sql
h2/src/test/org/h2/test/scripts/functions/numeric/bitxor.sql
+0
-4
ceil.sql
h2/src/test/org/h2/test/scripts/functions/numeric/ceil.sql
+0
-5
compress.sql
...c/test/org/h2/test/scripts/functions/numeric/compress.sql
+0
-1
cos.sql
h2/src/test/org/h2/test/scripts/functions/numeric/cos.sql
+0
-2
cosh.sql
h2/src/test/org/h2/test/scripts/functions/numeric/cosh.sql
+0
-1
cot.sql
h2/src/test/org/h2/test/scripts/functions/numeric/cot.sql
+0
-2
exp.sql
h2/src/test/org/h2/test/scripts/functions/numeric/exp.sql
+0
-3
floor.sql
h2/src/test/org/h2/test/scripts/functions/numeric/floor.sql
+0
-6
length.sql
h2/src/test/org/h2/test/scripts/functions/numeric/length.sql
+0
-5
log.sql
h2/src/test/org/h2/test/scripts/functions/numeric/log.sql
+0
-6
mod.sql
h2/src/test/org/h2/test/scripts/functions/numeric/mod.sql
+0
-4
power.sql
h2/src/test/org/h2/test/scripts/functions/numeric/power.sql
+0
-4
round.sql
h2/src/test/org/h2/test/scripts/functions/numeric/round.sql
+0
-3
sin.sql
h2/src/test/org/h2/test/scripts/functions/numeric/sin.sql
+0
-2
sqrt.sql
h2/src/test/org/h2/test/scripts/functions/numeric/sqrt.sql
+0
-3
tan.sql
h2/src/test/org/h2/test/scripts/functions/numeric/tan.sql
+0
-3
ascii.sql
h2/src/test/org/h2/test/scripts/functions/string/ascii.sql
+0
-4
hextoraw.sql
...rc/test/org/h2/test/scripts/functions/string/hextoraw.sql
+0
-1
insert.sql
h2/src/test/org/h2/test/scripts/functions/string/insert.sql
+0
-1
length.sql
h2/src/test/org/h2/test/scripts/functions/string/length.sql
+1
-1
cast.sql
h2/src/test/org/h2/test/scripts/functions/system/cast.sql
+0
-1
csvwrite.sql
...rc/test/org/h2/test/scripts/functions/system/csvwrite.sql
+0
-1
ifnull.sql
h2/src/test/org/h2/test/scripts/functions/system/ifnull.sql
+0
-1
current-time.sql
...rg/h2/test/scripts/functions/timeanddate/current-time.sql
+0
-1
current_date.sql
...rg/h2/test/scripts/functions/timeanddate/current_date.sql
+1
-1
date_trunc.sql
.../org/h2/test/scripts/functions/timeanddate/date_trunc.sql
+0
-4
nth_value.sql
...c/test/org/h2/test/scripts/functions/window/nth_value.sql
+0
-1
row_number.sql
.../test/org/h2/test/scripts/functions/window/row_number.sql
+0
-2
joins.sql
h2/src/test/org/h2/test/scripts/joins.sql
+13
-0
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+1
-1
testSimple.sql
h2/src/test/org/h2/test/scripts/testSimple.sql
+421
-0
没有找到文件。
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
1cd6ee15
...
@@ -5,12 +5,14 @@
...
@@ -5,12 +5,14 @@
*/
*/
package
org
.
h2
.
test
.
scripts
;
package
org
.
h2
.
test
.
scripts
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.LineNumberReader
;
import
java.io.LineNumberReader
;
import
java.io.PrintStream
;
import
java.io.PrintStream
;
import
java.io.RandomAccessFile
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Modifier
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
...
@@ -47,6 +49,8 @@ public class TestScript extends TestDb {
...
@@ -47,6 +49,8 @@ public class TestScript extends TestDb {
private
static
final
String
BASE_DIR
=
"org/h2/test/scripts/"
;
private
static
final
String
BASE_DIR
=
"org/h2/test/scripts/"
;
private
static
final
boolean
FIX_OUTPUT
=
false
;
private
static
final
Field
COMMAND
;
private
static
final
Field
COMMAND
;
private
static
final
Field
PREPARED
;
private
static
final
Field
PREPARED
;
...
@@ -232,7 +236,16 @@ public class TestScript extends TestDb {
...
@@ -232,7 +236,16 @@ public class TestScript extends TestDb {
if
(
statements
==
null
)
{
if
(
statements
==
null
)
{
println
(
"Running commands in "
+
scriptFileName
);
println
(
"Running commands in "
+
scriptFileName
);
}
}
final
String
outFile
=
"test.out.txt"
;
String
outFile
;
if
(
FIX_OUTPUT
)
{
outFile
=
scriptFileName
;
int
idx
=
outFile
.
lastIndexOf
(
'/'
);
if
(
idx
>=
0
)
{
outFile
=
outFile
.
substring
(
idx
+
1
);
}
}
else
{
outFile
=
"test.out.txt"
;
}
conn
=
getConnection
(
"script"
);
conn
=
getConnection
(
"script"
);
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
out
=
new
PrintStream
(
new
FileOutputStream
(
outFile
));
out
=
new
PrintStream
(
new
FileOutputStream
(
outFile
));
...
@@ -240,10 +253,31 @@ public class TestScript extends TestDb {
...
@@ -240,10 +253,31 @@ public class TestScript extends TestDb {
testFile
(
BASE_DIR
+
scriptFileName
);
testFile
(
BASE_DIR
+
scriptFileName
);
conn
.
close
();
conn
.
close
();
out
.
close
();
out
.
close
();
if
(
FIX_OUTPUT
)
{
File
file
=
new
File
(
outFile
);
// If there are two trailing newline characters remove one
try
(
RandomAccessFile
r
=
new
RandomAccessFile
(
file
,
"rw"
))
{
byte
[]
separator
=
System
.
lineSeparator
().
getBytes
(
StandardCharsets
.
ISO_8859_1
);
int
separatorLength
=
separator
.
length
;
long
length
=
r
.
length
()
-
(
separatorLength
*
2
);
truncate:
if
(
length
>=
0
)
{
r
.
seek
(
length
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
for
(
int
j
=
0
;
j
<
separatorLength
;
j
++)
{
if
(
r
.
readByte
()
!=
separator
[
j
])
{
break
truncate
;
}
}
}
r
.
setLength
(
length
+
separatorLength
);
}
}
file
.
renameTo
(
new
File
(
"h2/src/test/org/h2/test/scripts/"
+
scriptFileName
));
return
;
}
if
(
errors
.
length
()
>
0
)
{
if
(
errors
.
length
()
>
0
)
{
throw
new
Exception
(
"errors in "
+
scriptFileName
+
" found"
);
throw
new
Exception
(
"errors in "
+
scriptFileName
+
" found"
);
}
}
// new File(outFile).delete();
}
}
private
String
readLine
()
throws
IOException
{
private
String
readLine
()
throws
IOException
{
...
@@ -253,6 +287,7 @@ public class TestScript extends TestDb {
...
@@ -253,6 +287,7 @@ public class TestScript extends TestDb {
private
String
readNextLine
()
throws
IOException
{
private
String
readNextLine
()
throws
IOException
{
String
s
;
String
s
;
boolean
comment
=
false
;
while
((
s
=
in
.
readLine
())
!=
null
)
{
while
((
s
=
in
.
readLine
())
!=
null
)
{
if
(
s
.
startsWith
(
"#"
))
{
if
(
s
.
startsWith
(
"#"
))
{
int
end
=
s
.
indexOf
(
'#'
,
1
);
int
end
=
s
.
indexOf
(
'#'
,
1
);
...
@@ -276,18 +311,32 @@ public class TestScript extends TestDb {
...
@@ -276,18 +311,32 @@ public class TestScript extends TestDb {
switch
(
flag
)
{
switch
(
flag
)
{
case
"mvStore"
:
case
"mvStore"
:
if
(
config
.
mvStore
==
val
)
{
if
(
config
.
mvStore
==
val
)
{
out
.
print
(
"#"
+
(
val
?
'+'
:
'-'
)
+
flag
+
'#'
);
break
;
break
;
}
else
{
}
else
{
if
(
FIX_OUTPUT
)
{
write
(
"#"
+
(
val
?
'+'
:
'-'
)
+
flag
+
'#'
+
s
);
}
continue
;
continue
;
}
}
default
:
default
:
fail
(
"Unknown flag \""
+
flag
+
'\"'
);
fail
(
"Unknown flag \""
+
flag
+
'\"'
);
}
}
}
else
if
(
s
.
startsWith
(
"--"
))
{
write
(
s
);
comment
=
true
;
continue
;
}
if
(!
FIX_OUTPUT
)
{
s
=
s
.
trim
();
}
}
s
=
s
.
trim
();
if
(!
s
.
isEmpty
())
{
if
(!
s
.
isEmpty
())
{
break
;
break
;
}
}
if
(
comment
)
{
write
(
""
);
comment
=
false
;
}
}
}
return
s
;
return
s
;
}
}
...
@@ -322,14 +371,20 @@ public class TestScript extends TestDb {
...
@@ -322,14 +371,20 @@ public class TestScript extends TestDb {
}
else
{
}
else
{
switch
(
sql
)
{
switch
(
sql
)
{
case
"@reconnect"
:
case
"@reconnect"
:
write
(
sql
);
write
(
""
);
if
(!
config
.
memory
)
{
if
(!
config
.
memory
)
{
reconnect
(
conn
.
getAutoCommit
());
reconnect
(
conn
.
getAutoCommit
());
}
}
break
;
break
;
case
"@reconnect on"
:
case
"@reconnect on"
:
write
(
sql
);
write
(
""
);
allowReconnect
=
true
;
allowReconnect
=
true
;
break
;
break
;
case
"@reconnect off"
:
case
"@reconnect off"
:
write
(
sql
);
write
(
""
);
allowReconnect
=
false
;
allowReconnect
=
false
;
break
;
break
;
default
:
default
:
...
...
h2/src/test/org/h2/test/scripts/altertable-fk.sql
浏览文件 @
1cd6ee15
...
@@ -24,4 +24,3 @@ INSERT INTO user_group (ID) VALUES (1);
...
@@ -24,4 +24,3 @@ INSERT INTO user_group (ID) VALUES (1);
DELETE
FROM
user_group
;
DELETE
FROM
user_group
;
>
update
count
:
1
>
update
count
:
1
h2/src/test/org/h2/test/scripts/default-and-on_update.sql
浏览文件 @
1cd6ee15
...
@@ -29,7 +29,6 @@ SELECT * FROM TEST ORDER BY ID;
...
@@ -29,7 +29,6 @@ SELECT * FROM TEST ORDER BY ID;
>
3
3000
>
3
3000
>
rows
(
ordered
):
2
>
rows
(
ordered
):
2
UPDATE
TEST
SET
V
=
3
WHERE
ID
=
3
;
UPDATE
TEST
SET
V
=
3
WHERE
ID
=
3
;
>
update
count
:
1
>
update
count
:
1
...
...
h2/src/test/org/h2/test/scripts/dml/select.sql
浏览文件 @
1cd6ee15
...
@@ -480,7 +480,6 @@ SELECT G / 10 G1, G / 10 G2, SUM(T.V) S FROM TEST T GROUP BY G / 10, G / 10;
...
@@ -480,7 +480,6 @@ SELECT G / 10 G1, G / 10 G2, SUM(T.V) S FROM TEST T GROUP BY G / 10, G / 10;
>
2
2
4
>
2
2
4
>
rows
:
2
>
rows
:
2
SELECT
G
/
10
G1
,
G
/
10
G2
,
SUM
(
T
.
V
)
S
FROM
TEST
T
GROUP
BY
G2
;
SELECT
G
/
10
G1
,
G
/
10
G2
,
SUM
(
T
.
V
)
S
FROM
TEST
T
GROUP
BY
G2
;
>
G1
G2
S
>
G1
G2
S
>
-- -- -
>
-- -- -
...
...
h2/src/test/org/h2/test/scripts/dml/with.sql
浏览文件 @
1cd6ee15
...
@@ -44,7 +44,6 @@ explain with recursive "r"(n) as (
...
@@ -44,7 +44,6 @@ explain with recursive "r"(n) as (
select
n
from
"r"
;
select
n
from
"r"
;
>>
WITH
RECURSIVE
PUBLIC
.
"r"
(
N
)
AS
(
(
SELECT
1
FROM
SYSTEM_RANGE
(
1
,
1
)
/* PUBLIC.RANGE_INDEX */
)
UNION
ALL
(
SELECT
(
N
+
1
)
FROM
PUBLIC
.
"r"
/* PUBLIC."r".tableScan */
WHERE
N
<
3
)
)
SELECT
N
FROM
PUBLIC
.
"r"
"r"
/* null */
>>
WITH
RECURSIVE
PUBLIC
.
"r"
(
N
)
AS
(
(
SELECT
1
FROM
SYSTEM_RANGE
(
1
,
1
)
/* PUBLIC.RANGE_INDEX */
)
UNION
ALL
(
SELECT
(
N
+
1
)
FROM
PUBLIC
.
"r"
/* PUBLIC."r".tableScan */
WHERE
N
<
3
)
)
SELECT
N
FROM
PUBLIC
.
"r"
"r"
/* null */
select
sum
(
n
)
from
(
select
sum
(
n
)
from
(
with
recursive
r
(
n
)
as
(
with
recursive
r
(
n
)
as
(
(
select
1
)
union
all
(
select
n
+
1
from
r
where
n
<
3
)
(
select
1
)
union
all
(
select
n
+
1
from
r
where
n
<
3
)
...
@@ -80,6 +79,7 @@ select 0 from (
...
@@ -80,6 +79,7 @@ select 0 from (
>
0
>
0
>
-
>
-
>
rows
:
0
>
rows
:
0
with
with
r0
(
n
,
k
)
as
(
select
-
1
,
0
),
r0
(
n
,
k
)
as
(
select
-
1
,
0
),
r1
(
n
,
k
)
as
((
select
1
,
0
)
union
all
(
select
n
+
1
,
k
+
1
from
r1
where
n
<=
3
)),
r1
(
n
,
k
)
as
((
select
1
,
0
)
union
all
(
select
n
+
1
,
k
+
1
from
r1
where
n
<=
3
)),
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/count.sql
浏览文件 @
1cd6ee15
...
@@ -23,7 +23,6 @@ select count(*), count(*) filter (where v >= 4) from test;
...
@@ -23,7 +23,6 @@ select count(*), count(*) filter (where v >= 4) from test;
>
13
9
>
13
9
>
rows
:
1
>
rows
:
1
select
count
(
*
),
count
(
*
)
filter
(
where
v
>=
4
)
from
test
where
v
<=
10
;
select
count
(
*
),
count
(
*
)
filter
(
where
v
>=
4
)
from
test
where
v
<=
10
;
>
COUNT
(
*
)
COUNT
(
*
)
FILTER
(
WHERE
(
V
>=
4
))
>
COUNT
(
*
)
COUNT
(
*
)
FILTER
(
WHERE
(
V
>=
4
))
>
-------- --------------------------------
>
-------- --------------------------------
...
...
h2/src/test/org/h2/test/scripts/functions/numeric/acos.sql
浏览文件 @
1cd6ee15
...
@@ -14,4 +14,3 @@ select acos(null) vn, acos(-1) r1 from test;
...
@@ -14,4 +14,3 @@ select acos(null) vn, acos(-1) r1 from test;
>
---- -----------------
>
---- -----------------
>
null
3
.
141592653589793
>
null
3
.
141592653589793
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/asin.sql
浏览文件 @
1cd6ee15
...
@@ -14,4 +14,3 @@ select asin(null) vn, asin(-1) r1 from test;
...
@@ -14,4 +14,3 @@ select asin(null) vn, asin(-1) r1 from test;
>
---- -------------------
>
---- -------------------
>
null
-
1
.
5707963267948966
>
null
-
1
.
5707963267948966
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/atan.sql
浏览文件 @
1cd6ee15
...
@@ -14,4 +14,3 @@ select atan(null) vn, atan(-1) r1 from test;
...
@@ -14,4 +14,3 @@ select atan(null) vn, atan(-1) r1 from test;
>
---- -------------------
>
---- -------------------
>
null
-
0
.
7853981633974483
>
null
-
0
.
7853981633974483
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/atan2.sql
浏览文件 @
1cd6ee15
...
@@ -14,5 +14,3 @@ select atan2(null, null) vn, atan2(10, 1) r1 from test;
...
@@ -14,5 +14,3 @@ select atan2(null, null) vn, atan2(10, 1) r1 from test;
>
---- ------------------
>
---- ------------------
>
null
1
.
4711276743037347
>
null
1
.
4711276743037347
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/bitand.sql
浏览文件 @
1cd6ee15
...
@@ -14,7 +14,3 @@ select bitand(null, 1) vn, bitand(1, null) vn1, bitand(null, null) vn2, bitand(3
...
@@ -14,7 +14,3 @@ select bitand(null, 1) vn, bitand(1, null) vn1, bitand(null, null) vn2, bitand(3
>
---- ---- ---- --
>
---- ---- ---- --
>
null
null
null
2
>
null
null
null
2
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/bitget.sql
浏览文件 @
1cd6ee15
...
@@ -2,4 +2,3 @@
...
@@ -2,4 +2,3 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
-- Initial Developer: H2 Group
--
--
h2/src/test/org/h2/test/scripts/functions/numeric/bitor.sql
浏览文件 @
1cd6ee15
...
@@ -14,7 +14,3 @@ select bitor(null, 1) vn, bitor(1, null) vn1, bitor(null, null) vn2, bitor(3, 6)
...
@@ -14,7 +14,3 @@ select bitor(null, 1) vn, bitor(1, null) vn1, bitor(null, null) vn2, bitor(3, 6)
>
---- ---- ---- --
>
---- ---- ---- --
>
null
null
null
7
>
null
null
null
7
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/bitxor.sql
浏览文件 @
1cd6ee15
...
@@ -14,7 +14,3 @@ select bitxor(null, 1) vn, bitxor(1, null) vn1, bitxor(null, null) vn2, bitxor(3
...
@@ -14,7 +14,3 @@ select bitxor(null, 1) vn, bitxor(1, null) vn1, bitxor(null, null) vn2, bitxor(3
>
---- ---- ---- --
>
---- ---- ---- --
>
null
null
null
5
>
null
null
null
5
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/ceil.sql
浏览文件 @
1cd6ee15
...
@@ -14,8 +14,3 @@ select ceil(null) vn, ceil(1) v1, ceiling(1.1) v2, ceil(-1.1) v3, ceiling(1.9) v
...
@@ -14,8 +14,3 @@ select ceil(null) vn, ceil(1) v1, ceiling(1.1) v2, ceil(-1.1) v3, ceiling(1.9) v
>
---- --- --- ---- --- ----
>
---- --- --- ---- --- ----
>
null
1
.
0
2
.
0
-
1
.
0
2
.
0
-
1
.
0
>
null
1
.
0
2
.
0
-
1
.
0
2
.
0
-
1
.
0
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/compress.sql
浏览文件 @
1cd6ee15
...
@@ -2,4 +2,3 @@
...
@@ -2,4 +2,3 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
-- Initial Developer: H2 Group
--
--
h2/src/test/org/h2/test/scripts/functions/numeric/cos.sql
浏览文件 @
1cd6ee15
...
@@ -14,5 +14,3 @@ select cos(null) vn, cos(-1) r1 from test;
...
@@ -14,5 +14,3 @@ select cos(null) vn, cos(-1) r1 from test;
>
---- ------------------
>
---- ------------------
>
null
0
.
5403023058681398
>
null
0
.
5403023058681398
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/cosh.sql
浏览文件 @
1cd6ee15
...
@@ -2,4 +2,3 @@
...
@@ -2,4 +2,3 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
-- Initial Developer: H2 Group
--
--
h2/src/test/org/h2/test/scripts/functions/numeric/cot.sql
浏览文件 @
1cd6ee15
...
@@ -14,5 +14,3 @@ select cot(null) vn, cot(-1) r1 from test;
...
@@ -14,5 +14,3 @@ select cot(null) vn, cot(-1) r1 from test;
>
---- -------------------
>
---- -------------------
>
null
-
0
.
6420926159343306
>
null
-
0
.
6420926159343306
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/exp.sql
浏览文件 @
1cd6ee15
...
@@ -14,6 +14,3 @@ select exp(null) vn, left(exp(1), 4) v1, left(exp(1.1), 4) v2, left(exp(-1.1), 4
...
@@ -14,6 +14,3 @@ select exp(null) vn, left(exp(1), 4) v1, left(exp(1.1), 4) v2, left(exp(-1.1), 4
>
---- ---- ---- ---- ---- ----
>
---- ---- ---- ---- ---- ----
>
null
2
.
71
3
.
00
0
.
33
6
.
68
0
.
14
>
null
2
.
71
3
.
00
0
.
33
6
.
68
0
.
14
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/floor.sql
浏览文件 @
1cd6ee15
...
@@ -14,9 +14,3 @@ select floor(null) vn, floor(1) v1, floor(1.1) v2, floor(-1.1) v3, floor(1.9) v4
...
@@ -14,9 +14,3 @@ select floor(null) vn, floor(1) v1, floor(1.1) v2, floor(-1.1) v3, floor(1.9) v4
>
---- --- --- ---- --- ----
>
---- --- --- ---- --- ----
>
null
1
.
0
1
.
0
-
2
.
0
1
.
0
-
2
.
0
>
null
1
.
0
1
.
0
-
2
.
0
1
.
0
-
2
.
0
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/length.sql
浏览文件 @
1cd6ee15
...
@@ -38,8 +38,3 @@ select octet_length(null) en, octet_length('') e0, octet_length('ab') e4 from te
...
@@ -38,8 +38,3 @@ select octet_length(null) en, octet_length('') e0, octet_length('ab') e4 from te
>
---- -- --
>
---- -- --
>
null
0
4
>
null
0
4
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/log.sql
浏览文件 @
1cd6ee15
...
@@ -26,9 +26,3 @@ select log(null) vn, log(1) v1, log(1.1) v2, log(-1.1) v3, log(1.9) v4, log(-1.9
...
@@ -26,9 +26,3 @@ select log(null) vn, log(1) v1, log(1.1) v2, log(-1.1) v3, log(1.9) v4, log(-1.9
>
---- --- ------------------- --- ------------------ ---
>
---- --- ------------------- --- ------------------ ---
>
null
0
.
0
0
.
09531017980432493
NaN
0
.
6418538861723947
NaN
>
null
0
.
0
0
.
09531017980432493
NaN
0
.
6418538861723947
NaN
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/mod.sql
浏览文件 @
1cd6ee15
...
@@ -14,7 +14,3 @@ select mod(null, 1) vn, mod(1, null) vn1, mod(null, null) vn2, mod(10, 2) e1 fro
...
@@ -14,7 +14,3 @@ select mod(null, 1) vn, mod(1, null) vn1, mod(null, null) vn2, mod(10, 2) e1 fro
>
---- ---- ---- --
>
---- ---- ---- --
>
null
null
null
0
>
null
null
null
0
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/power.sql
浏览文件 @
1cd6ee15
...
@@ -14,7 +14,3 @@ select power(null, null) en, power(2, 3) e8, power(16, 0.5) e4 from test;
...
@@ -14,7 +14,3 @@ select power(null, null) en, power(2, 3) e8, power(16, 0.5) e4 from test;
>
---- --- ---
>
---- --- ---
>
null
8
.
0
4
.
0
>
null
8
.
0
4
.
0
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/round.sql
浏览文件 @
1cd6ee15
...
@@ -26,6 +26,3 @@ select roundmagic(null) en, roundmagic(cast(3.11 as double) - 3.1) e001, roundma
...
@@ -26,6 +26,3 @@ select roundmagic(null) en, roundmagic(cast(3.11 as double) - 3.1) e001, roundma
>
---- ---- ---- ------
>
---- ---- ---- ------
>
null
0
.
01
0
.
0
2
.
0
E12
>
null
0
.
01
0
.
0
2
.
0
E12
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/sin.sql
浏览文件 @
1cd6ee15
...
@@ -14,5 +14,3 @@ select sin(null) vn, sin(-1) r1 from test;
...
@@ -14,5 +14,3 @@ select sin(null) vn, sin(-1) r1 from test;
>
---- -------------------
>
---- -------------------
>
null
-
0
.
8414709848078965
>
null
-
0
.
8414709848078965
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/sqrt.sql
浏览文件 @
1cd6ee15
...
@@ -14,6 +14,3 @@ select sqrt(null) vn, sqrt(0) e0, sqrt(1) e1, sqrt(4) e2, sqrt(100) e10, sqrt(0.
...
@@ -14,6 +14,3 @@ select sqrt(null) vn, sqrt(0) e0, sqrt(1) e1, sqrt(4) e2, sqrt(100) e10, sqrt(0.
>
---- --- --- --- ---- ---
>
---- --- --- --- ---- ---
>
null
0
.
0
1
.
0
2
.
0
10
.
0
0
.
5
>
null
0
.
0
1
.
0
2
.
0
10
.
0
0
.
5
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/numeric/tan.sql
浏览文件 @
1cd6ee15
...
@@ -14,6 +14,3 @@ select tan(null) vn, tan(-1) r1 from test;
...
@@ -14,6 +14,3 @@ select tan(null) vn, tan(-1) r1 from test;
>
---- -------------------
>
---- -------------------
>
null
-
1
.
5574077246549023
>
null
-
1
.
5574077246549023
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/string/ascii.sql
浏览文件 @
1cd6ee15
...
@@ -14,7 +14,3 @@ select ascii(null) en, ascii('') en, ascii('Abc') e65 from test;
...
@@ -14,7 +14,3 @@ select ascii(null) en, ascii('') en, ascii('Abc') e65 from test;
>
---- ---- ---
>
---- ---- ---
>
null
null
65
>
null
null
65
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/string/hextoraw.sql
浏览文件 @
1cd6ee15
...
@@ -14,4 +14,3 @@ select hextoraw(null) en, rawtohex(null) en1, hextoraw(rawtohex('abc')) abc from
...
@@ -14,4 +14,3 @@ select hextoraw(null) en, rawtohex(null) en1, hextoraw(rawtohex('abc')) abc from
>
---- ---- ---
>
---- ---- ---
>
null
null
abc
>
null
null
abc
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/string/insert.sql
浏览文件 @
1cd6ee15
...
@@ -20,4 +20,3 @@ select insert('World', 2, 4, 'e') welt, insert('Hello', 2, 1, 'a') hallo from te
...
@@ -20,4 +20,3 @@ select insert('World', 2, 4, 'e') welt, insert('Hello', 2, 1, 'a') hallo from te
>
---- -----
>
---- -----
>
We
Hallo
>
We
Hallo
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/string/length.sql
浏览文件 @
1cd6ee15
...
@@ -28,4 +28,4 @@ select len(null) en, len('MSSQLServer uses the len keyword') e_32 from test;
...
@@ -28,4 +28,4 @@ select len(null) en, len('MSSQLServer uses the len keyword') e_32 from test;
>
rows
:
1
>
rows
:
1
SET
MODE
Regular
;
SET
MODE
Regular
;
>
ok
>
ok
\ No newline at end of file
h2/src/test/org/h2/test/scripts/functions/system/cast.sql
浏览文件 @
1cd6ee15
...
@@ -9,7 +9,6 @@ create memory table test(id int primary key, name varchar(255));
...
@@ -9,7 +9,6 @@ create memory table test(id int primary key, name varchar(255));
insert
into
test
values
(
1
,
'Hello'
);
insert
into
test
values
(
1
,
'Hello'
);
>
update
count
:
1
>
update
count
:
1
select
cast
(
null
as
varchar
(
255
))
xn
,
cast
(
' 10'
as
int
)
x10
,
cast
(
' 20 '
as
int
)
x20
from
test
;
select
cast
(
null
as
varchar
(
255
))
xn
,
cast
(
' 10'
as
int
)
x10
,
cast
(
' 20 '
as
int
)
x20
from
test
;
>
XN
X10
X20
>
XN
X10
X20
>
---- --- ---
>
---- --- ---
...
...
h2/src/test/org/h2/test/scripts/functions/system/csvwrite.sql
浏览文件 @
1cd6ee15
...
@@ -2,4 +2,3 @@
...
@@ -2,4 +2,3 @@
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- and the EPL 1.0 (http://h2database.com/html/license.html).
-- Initial Developer: H2 Group
-- Initial Developer: H2 Group
--
--
h2/src/test/org/h2/test/scripts/functions/system/ifnull.sql
浏览文件 @
1cd6ee15
...
@@ -20,4 +20,3 @@ select isnull(null, '1') x1, isnull(null, null) xn, isnull('a', 'b') xa from tes
...
@@ -20,4 +20,3 @@ select isnull(null, '1') x1, isnull(null, null) xn, isnull('a', 'b') xa from tes
>
-- ---- --
>
-- ---- --
>
1
null
a
>
1
null
a
>
rows
:
1
>
rows
:
1
h2/src/test/org/h2/test/scripts/functions/timeanddate/current-time.sql
浏览文件 @
1cd6ee15
...
@@ -15,7 +15,6 @@ select length(curtime())>=8 c1, length(current_time())>=8 c2, substring(curtime(
...
@@ -15,7 +15,6 @@ select length(curtime())>=8 c1, length(current_time())>=8 c2, substring(curtime(
>
TRUE
TRUE
:
>
TRUE
TRUE
:
>
rows
:
1
>
rows
:
1
select
length
(
now
())
>
18
c1
,
length
(
current_timestamp
())
>
18
c2
,
length
(
now
(
0
))
>
18
c3
,
length
(
now
(
2
))
>
18
c4
from
test
;
select
length
(
now
())
>
18
c1
,
length
(
current_timestamp
())
>
18
c2
,
length
(
now
(
0
))
>
18
c3
,
length
(
now
(
2
))
>
18
c4
from
test
;
>
C1
C2
C3
C4
>
C1
C2
C3
C4
>
---- ---- ---- ----
>
---- ---- ---- ----
...
...
h2/src/test/org/h2/test/scripts/functions/timeanddate/current_date.sql
浏览文件 @
1cd6ee15
...
@@ -25,4 +25,4 @@ SELECT CURRENT_DATE = GETDATE();
...
@@ -25,4 +25,4 @@ SELECT CURRENT_DATE = GETDATE();
>>
TRUE
>>
TRUE
SET
MODE
Regular
;
SET
MODE
Regular
;
>
ok
>
ok
\ No newline at end of file
h2/src/test/org/h2/test/scripts/functions/timeanddate/date_trunc.sql
浏览文件 @
1cd6ee15
...
@@ -372,7 +372,6 @@ SELECT DATE_TRUNC('second', '2015-05-29 00:00:00');
...
@@ -372,7 +372,6 @@ SELECT DATE_TRUNC('second', '2015-05-29 00:00:00');
SELECT
DATE_TRUNC
(
'SECOND'
,
'2015-05-29 00:00:00'
);
SELECT
DATE_TRUNC
(
'SECOND'
,
'2015-05-29 00:00:00'
);
>>
2015
-
05
-
29
00
:
00
:
00
>>
2015
-
05
-
29
00
:
00
:
00
--
--
-- Test time unit 'MINUTE'
-- Test time unit 'MINUTE'
--
--
...
@@ -598,7 +597,6 @@ select DATE_TRUNC('day', '2015-05-29 15:14:13');
...
@@ -598,7 +597,6 @@ select DATE_TRUNC('day', '2015-05-29 15:14:13');
select
DATE_TRUNC
(
'DAY'
,
'2015-05-29 15:14:13'
);
select
DATE_TRUNC
(
'DAY'
,
'2015-05-29 15:14:13'
);
>>
2015
-
05
-
29
00
:
00
:
00
>>
2015
-
05
-
29
00
:
00
:
00
--
--
-- Test time unit 'WEEK'
-- Test time unit 'WEEK'
--
--
...
@@ -818,7 +816,6 @@ SELECT DATE_TRUNC('quarter', '2015-12-29 15:14:13');
...
@@ -818,7 +816,6 @@ SELECT DATE_TRUNC('quarter', '2015-12-29 15:14:13');
SELECT
DATE_TRUNC
(
'QUARTER'
,
'2015-12-29 15:14:13'
);
SELECT
DATE_TRUNC
(
'QUARTER'
,
'2015-12-29 15:14:13'
);
>>
2015
-
10
-
01
00
:
00
:
00
>>
2015
-
10
-
01
00
:
00
:
00
--
--
-- Test time unit 'YEAR'
-- Test time unit 'YEAR'
--
--
...
@@ -1073,4 +1070,3 @@ SELECT DATE_TRUNC('', '');
...
@@ -1073,4 +1070,3 @@ SELECT DATE_TRUNC('', '');
SELECT
DATE_TRUNC
(
'YEAR'
,
''
);
SELECT
DATE_TRUNC
(
'YEAR'
,
''
);
>
exception
INVALID_DATETIME_CONSTANT_2
>
exception
INVALID_DATETIME_CONSTANT_2
h2/src/test/org/h2/test/scripts/functions/window/nth_value.sql
浏览文件 @
1cd6ee15
...
@@ -87,7 +87,6 @@ SELECT *,
...
@@ -87,7 +87,6 @@ SELECT *,
NTH_VALUE
(
VALUE
,
2
)
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
UNBOUNDED
PRECEDING
AND
CURRENT
ROW
)
F_U_C
,
NTH_VALUE
(
VALUE
,
2
)
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
UNBOUNDED
PRECEDING
AND
CURRENT
ROW
)
F_U_C
,
NTH_VALUE
(
VALUE
,
2
)
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
CURRENT
ROW
AND
UNBOUNDED
FOLLOWING
)
F_C_U
,
NTH_VALUE
(
VALUE
,
2
)
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
CURRENT
ROW
AND
UNBOUNDED
FOLLOWING
)
F_C_U
,
NTH_VALUE
(
VALUE
,
2
)
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
UNBOUNDED
PRECEDING
AND
UNBOUNDED
FOLLOWING
)
F_U_U
,
NTH_VALUE
(
VALUE
,
2
)
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
UNBOUNDED
PRECEDING
AND
UNBOUNDED
FOLLOWING
)
F_U_U
,
NTH_VALUE
(
VALUE
,
2
)
FROM
LAST
OVER
(
ORDER
BY
ID
)
L
,
NTH_VALUE
(
VALUE
,
2
)
FROM
LAST
OVER
(
ORDER
BY
ID
)
L
,
NTH_VALUE
(
VALUE
,
2
)
FROM
LAST
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
UNBOUNDED
PRECEDING
AND
CURRENT
ROW
)
L_U_C
,
NTH_VALUE
(
VALUE
,
2
)
FROM
LAST
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
UNBOUNDED
PRECEDING
AND
CURRENT
ROW
)
L_U_C
,
NTH_VALUE
(
VALUE
,
2
)
FROM
LAST
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
CURRENT
ROW
AND
UNBOUNDED
FOLLOWING
)
L_C_U
,
NTH_VALUE
(
VALUE
,
2
)
FROM
LAST
OVER
(
ORDER
BY
ID
RANGE
BETWEEN
CURRENT
ROW
AND
UNBOUNDED
FOLLOWING
)
L_C_U
,
...
...
h2/src/test/org/h2/test/scripts/functions/window/row_number.sql
浏览文件 @
1cd6ee15
...
@@ -22,13 +22,11 @@ SELECT *,
...
@@ -22,13 +22,11 @@ SELECT *,
ROW_NUMBER
()
OVER
()
RN
,
ROW_NUMBER
()
OVER
()
RN
,
ROUND
(
PERCENT_RANK
()
OVER
(),
2
)
PR
,
ROUND
(
PERCENT_RANK
()
OVER
(),
2
)
PR
,
ROUND
(
CUME_DIST
()
OVER
(),
2
)
CD
,
ROUND
(
CUME_DIST
()
OVER
(),
2
)
CD
,
ROW_NUMBER
()
OVER
(
ORDER
BY
ID
)
RNO
,
ROW_NUMBER
()
OVER
(
ORDER
BY
ID
)
RNO
,
RANK
()
OVER
(
ORDER
BY
ID
)
RKO
,
RANK
()
OVER
(
ORDER
BY
ID
)
RKO
,
DENSE_RANK
()
OVER
(
ORDER
BY
ID
)
DRO
,
DENSE_RANK
()
OVER
(
ORDER
BY
ID
)
DRO
,
ROUND
(
PERCENT_RANK
()
OVER
(
ORDER
BY
ID
),
2
)
PRO
,
ROUND
(
PERCENT_RANK
()
OVER
(
ORDER
BY
ID
),
2
)
PRO
,
ROUND
(
CUME_DIST
()
OVER
(
ORDER
BY
ID
),
2
)
CDO
ROUND
(
CUME_DIST
()
OVER
(
ORDER
BY
ID
),
2
)
CDO
FROM
TEST
;
FROM
TEST
;
>
ID
CATEGORY
VALUE
RN
PR
CD
RNO
RKO
DRO
PRO
CDO
>
ID
CATEGORY
VALUE
RN
PR
CD
RNO
RKO
DRO
PRO
CDO
>
-- -------- ----- -- --- --- --- --- --- ---- ----
>
-- -------- ----- -- --- --- --- --- --- ---- ----
...
...
h2/src/test/org/h2/test/scripts/joins.sql
浏览文件 @
1cd6ee15
...
@@ -744,33 +744,46 @@ DROP TABLE C;
...
@@ -744,33 +744,46 @@ DROP TABLE C;
CREATE
TABLE
T1
(
X1
INT
);
CREATE
TABLE
T1
(
X1
INT
);
>
ok
>
ok
CREATE
TABLE
T2
(
X2
INT
);
CREATE
TABLE
T2
(
X2
INT
);
>
ok
>
ok
CREATE
TABLE
T3
(
X3
INT
);
CREATE
TABLE
T3
(
X3
INT
);
>
ok
>
ok
CREATE
TABLE
T4
(
X4
INT
);
CREATE
TABLE
T4
(
X4
INT
);
>
ok
>
ok
CREATE
TABLE
T5
(
X5
INT
);
CREATE
TABLE
T5
(
X5
INT
);
>
ok
>
ok
INSERT
INTO
T1
VALUES
(
1
);
INSERT
INTO
T1
VALUES
(
1
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T1
VALUES
(
NULL
);
INSERT
INTO
T1
VALUES
(
NULL
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T2
VALUES
(
1
);
INSERT
INTO
T2
VALUES
(
1
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T2
VALUES
(
NULL
);
INSERT
INTO
T2
VALUES
(
NULL
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T3
VALUES
(
1
);
INSERT
INTO
T3
VALUES
(
1
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T3
VALUES
(
NULL
);
INSERT
INTO
T3
VALUES
(
NULL
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T4
VALUES
(
1
);
INSERT
INTO
T4
VALUES
(
1
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T4
VALUES
(
NULL
);
INSERT
INTO
T4
VALUES
(
NULL
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T5
VALUES
(
1
);
INSERT
INTO
T5
VALUES
(
1
);
>
update
count
:
1
>
update
count
:
1
INSERT
INTO
T5
VALUES
(
NULL
);
INSERT
INTO
T5
VALUES
(
NULL
);
>
update
count
:
1
>
update
count
:
1
...
...
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
1cd6ee15
...
@@ -2523,6 +2523,7 @@ insert into address(id, name, name2) values(2, 'test@abc', 'test@acme');
...
@@ -2523,6 +2523,7 @@ insert into address(id, name, name2) values(2, 'test@abc', 'test@acme');
> exception CHECK_CONSTRAINT_VIOLATED_1
> exception CHECK_CONSTRAINT_VIOLATED_1
@reconnect
@reconnect
insert into address(id, name, name2) values(3, '
test_abc
', '
test
@
gmail
');
insert into address(id, name, name2) values(3, '
test_abc
', '
test
@
gmail
');
> exception CHECK_CONSTRAINT_VIOLATED_1
> exception CHECK_CONSTRAINT_VIOLATED_1
...
@@ -7954,4 +7955,3 @@ select * from test where year in (select distinct year from test order by year d
...
@@ -7954,4 +7955,3 @@ select * from test where year in (select distinct year from test order by year d
drop
table
test
;
drop
table
test
;
>
ok
>
ok
h2/src/test/org/h2/test/scripts/testSimple.sql
浏览文件 @
1cd6ee15
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论