Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
236daa35
提交
236daa35
authored
4月 19, 2018
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the script-based unit testing to check the error code of the exception thrown.
上级
7db8f19e
全部展开
显示空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
216 行增加
和
195 行删除
+216
-195
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+28
-9
double.sql
h2/src/test/org/h2/test/scripts/datatypes/double.sql
+1
-1
enum.sql
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
+4
-4
real.sql
h2/src/test/org/h2/test/scripts/datatypes/real.sql
+1
-1
time.sql
h2/src/test/org/h2/test/scripts/datatypes/time.sql
+1
-1
timestamp-with-timezone.sql
...org/h2/test/scripts/datatypes/timestamp-with-timezone.sql
+1
-1
timestamp.sql
h2/src/test/org/h2/test/scripts/datatypes/timestamp.sql
+3
-3
alterTableAdd.sql
h2/src/test/org/h2/test/scripts/ddl/alterTableAdd.sql
+5
-5
alterTableDropColumn.sql
h2/src/test/org/h2/test/scripts/ddl/alterTableDropColumn.sql
+4
-4
createAlias.sql
h2/src/test/org/h2/test/scripts/ddl/createAlias.sql
+6
-6
dropSchema.sql
h2/src/test/org/h2/test/scripts/ddl/dropSchema.sql
+6
-6
derived-column-names.sql
h2/src/test/org/h2/test/scripts/derived-column-names.sql
+4
-4
error_reporting.sql
h2/src/test/org/h2/test/scripts/dml/error_reporting.sql
+1
-1
insertIgnore.sql
h2/src/test/org/h2/test/scripts/dml/insertIgnore.sql
+1
-1
hash.sql
h2/src/test/org/h2/test/scripts/functions/numeric/hash.sql
+2
-2
ora-hash.sql
...c/test/org/h2/test/scripts/functions/numeric/ora-hash.sql
+3
-3
regex-replace.sql
...st/org/h2/test/scripts/functions/string/regex-replace.sql
+1
-1
regexp-like.sql
...test/org/h2/test/scripts/functions/string/regexp-like.sql
+1
-1
cast.sql
h2/src/test/org/h2/test/scripts/functions/system/cast.sql
+1
-1
date_trunc.sql
.../org/h2/test/scripts/functions/timeanddate/date_trunc.sql
+4
-4
dateadd.sql
...est/org/h2/test/scripts/functions/timeanddate/dateadd.sql
+1
-1
joins.sql
h2/src/test/org/h2/test/scripts/joins.sql
+2
-2
range_table.sql
h2/src/test/org/h2/test/scripts/range_table.sql
+4
-4
testScript.sql
h2/src/test/org/h2/test/scripts/testScript.sql
+129
-129
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
236daa35
...
@@ -21,6 +21,8 @@ Change Log
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
Improve the script-based unit testing to check the error code of the exception thrown.
</li>
<li>
Issue #1003: Decrypting database with incorrect password renders the database corrupt
<li>
Issue #1003: Decrypting database with incorrect password renders the database corrupt
</li>
</li>
<li>
Issue #873: No error when `=` in equal condition when column is not of array type
<li>
Issue #873: No error when `=` in equal condition when column is not of array type
...
...
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
236daa35
...
@@ -11,6 +11,8 @@ import java.io.InputStream;
...
@@ -11,6 +11,8 @@ 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.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
...
@@ -18,7 +20,10 @@ import java.sql.ResultSetMetaData;
...
@@ -18,7 +20,10 @@ import java.sql.ResultSetMetaData;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.SysProperties
;
import
org.h2.engine.SysProperties
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
...
@@ -454,16 +459,30 @@ public class TestScript extends TestBase {
...
@@ -454,16 +459,30 @@ public class TestScript extends TestBase {
return
buff
.
toString
();
return
buff
.
toString
();
}
}
private
void
writeException
(
String
sql
,
SQLException
e
)
throws
Exception
{
/** Convert the error code to a symbolic name from ErrorCode. */
writeResult
(
sql
,
"exception"
,
e
);
private
static
final
Map
<
Integer
,
String
>
ERROR_CODE_TO_NAME
=
new
HashMap
<>();
static
{
try
{
for
(
Field
field
:
ErrorCode
.
class
.
getDeclaredFields
())
{
if
(
Modifier
.
isStatic
(
field
.
getModifiers
()))
{
ERROR_CODE_TO_NAME
.
put
(
field
.
getInt
(
null
),
field
.
getName
());
}
}
}
catch
(
IllegalAccessException
ex
)
{
throw
new
RuntimeException
(
ex
);
}
}
private
void
writeException
(
String
sql
,
SQLException
ex
)
throws
Exception
{
writeResult
(
sql
,
"exception "
+
ERROR_CODE_TO_NAME
.
get
(
ex
.
getErrorCode
()),
ex
);
}
}
private
void
writeResult
(
String
sql
,
String
s
,
SQLException
e
)
throws
Exception
{
private
void
writeResult
(
String
sql
,
String
s
,
SQLException
e
x
)
throws
Exception
{
writeResult
(
sql
,
s
,
e
,
"> "
);
writeResult
(
sql
,
s
,
e
x
,
"> "
);
}
}
private
void
writeResult
(
String
sql
,
String
s
,
SQLException
e
,
String
prefix
)
throws
Exception
{
private
void
writeResult
(
String
sql
,
String
s
,
SQLException
e
x
,
String
prefix
)
throws
Exception
{
assertKnownException
(
sql
,
e
);
assertKnownException
(
sql
,
e
x
);
s
=
(
prefix
+
s
).
trim
();
s
=
(
prefix
+
s
).
trim
();
String
compare
=
readLine
();
String
compare
=
readLine
();
if
(
compare
!=
null
&&
compare
.
startsWith
(
">"
))
{
if
(
compare
!=
null
&&
compare
.
startsWith
(
">"
))
{
...
@@ -472,11 +491,11 @@ public class TestScript extends TestBase {
...
@@ -472,11 +491,11 @@ public class TestScript extends TestBase {
return
;
return
;
}
}
errors
.
append
(
fileName
).
append
(
'\n'
);
errors
.
append
(
fileName
).
append
(
'\n'
);
errors
.
append
(
"line: "
).
append
(
outputLineNo
).
append
(
'\n'
);
errors
.
append
(
"line: "
).
append
(
in
.
getLineNumber
()
).
append
(
'\n'
);
errors
.
append
(
"exp: "
).
append
(
compare
).
append
(
'\n'
);
errors
.
append
(
"exp: "
).
append
(
compare
).
append
(
'\n'
);
errors
.
append
(
"got: "
).
append
(
s
).
append
(
'\n'
);
errors
.
append
(
"got: "
).
append
(
s
).
append
(
'\n'
);
if
(
e
!=
null
)
{
if
(
e
x
!=
null
)
{
TestBase
.
logError
(
"script"
,
e
);
TestBase
.
logError
(
"script"
,
e
x
);
}
}
TestBase
.
logErrorMessage
(
errors
.
toString
());
TestBase
.
logErrorMessage
(
errors
.
toString
());
if
(
failFast
)
{
if
(
failFast
)
{
...
...
h2/src/test/org/h2/test/scripts/datatypes/double.sql
浏览文件 @
236daa35
...
@@ -7,7 +7,7 @@ CREATE MEMORY TABLE TEST(D1 DOUBLE, D2 DOUBLE PRECISION, D3 FLOAT, D4 FLOAT(25),
...
@@ -7,7 +7,7 @@ CREATE MEMORY TABLE TEST(D1 DOUBLE, D2 DOUBLE PRECISION, D3 FLOAT, D4 FLOAT(25),
>
ok
>
ok
ALTER
TABLE
TEST
ADD
COLUMN
D6
FLOAT
(
54
);
ALTER
TABLE
TEST
ADD
COLUMN
D6
FLOAT
(
54
);
>
exception
>
exception
INVALID_VALUE_SCALE_PRECISION
SELECT
COLUMN_NAME
,
DATA_TYPE
,
TYPE_NAME
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
SELECT
COLUMN_NAME
,
DATA_TYPE
,
TYPE_NAME
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
...
...
h2/src/test/org/h2/test/scripts/datatypes/enum.sql
浏览文件 @
236daa35
...
@@ -73,13 +73,13 @@ select * from card where rank = 5;
...
@@ -73,13 +73,13 @@ select * from card where rank = 5;
--- ENUM edge cases
--- ENUM edge cases
insert
into
card
(
rank
,
suit
)
values
(
6
,
' '
);
insert
into
card
(
rank
,
suit
)
values
(
6
,
' '
);
>
exception
>
exception
ENUM_VALUE_NOT_PERMITTED
alter
table
card
alter
column
suit
enum
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
,
'clubs'
);
alter
table
card
alter
column
suit
enum
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
,
'clubs'
);
>
exception
>
exception
ENUM_DUPLICATE
alter
table
card
alter
column
suit
enum
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
,
''
);
alter
table
card
alter
column
suit
enum
(
'hearts'
,
'clubs'
,
'spades'
,
'diamonds'
,
''
);
>
exception
>
exception
ENUM_EMPTY
drop
table
card
;
drop
table
card
;
>
ok
>
ok
...
@@ -118,7 +118,7 @@ insert into card (rank, suit) values (0, 'clubs'), (3, 'hearts'), (1, 'clubs');
...
@@ -118,7 +118,7 @@ insert into card (rank, suit) values (0, 'clubs'), (3, 'hearts'), (1, 'clubs');
>
update
count
:
3
>
update
count
:
3
insert
into
card
(
rank
,
suit
)
values
(
0
,
'clubs'
);
insert
into
card
(
rank
,
suit
)
values
(
0
,
'clubs'
);
>
exception
>
exception
DUPLICATE_KEY_1
select
rank
from
card
where
suit
=
'clubs'
;
select
rank
from
card
where
suit
=
'clubs'
;
>
RANK
>
RANK
...
...
h2/src/test/org/h2/test/scripts/datatypes/real.sql
浏览文件 @
236daa35
...
@@ -7,7 +7,7 @@ CREATE MEMORY TABLE TEST(D1 REAL, D2 FLOAT4, D3 FLOAT(0), D4 FLOAT(24));
...
@@ -7,7 +7,7 @@ CREATE MEMORY TABLE TEST(D1 REAL, D2 FLOAT4, D3 FLOAT(0), D4 FLOAT(24));
>
ok
>
ok
ALTER
TABLE
TEST
ADD
COLUMN
D5
FLOAT
(
-
1
);
ALTER
TABLE
TEST
ADD
COLUMN
D5
FLOAT
(
-
1
);
>
exception
>
exception
INVALID_VALUE_2
SELECT
COLUMN_NAME
,
DATA_TYPE
,
TYPE_NAME
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
SELECT
COLUMN_NAME
,
DATA_TYPE
,
TYPE_NAME
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
...
...
h2/src/test/org/h2/test/scripts/datatypes/time.sql
浏览文件 @
236daa35
...
@@ -37,7 +37,7 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
...
@@ -37,7 +37,7 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
>
rows
(
ordered
):
4
>
rows
(
ordered
):
4
ALTER
TABLE
TEST
ADD
T5
TIME
(
10
);
ALTER
TABLE
TEST
ADD
T5
TIME
(
10
);
>
exception
>
exception
INVALID_VALUE_SCALE_PRECISION
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
...
...
h2/src/test/org/h2/test/scripts/datatypes/timestamp-with-timezone.sql
浏览文件 @
236daa35
...
@@ -49,7 +49,7 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
...
@@ -49,7 +49,7 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
>
rows
(
ordered
):
3
>
rows
(
ordered
):
3
ALTER
TABLE
TEST
ADD
T4
TIMESTAMP
(
10
)
WITH
TIME
ZONE
;
ALTER
TABLE
TEST
ADD
T4
TIMESTAMP
(
10
)
WITH
TIME
ZONE
;
>
exception
>
exception
INVALID_VALUE_SCALE_PRECISION
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
...
...
h2/src/test/org/h2/test/scripts/datatypes/timestamp.sql
浏览文件 @
236daa35
...
@@ -34,13 +34,13 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
...
@@ -34,13 +34,13 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE, NUMERIC_SCALE FROM INFORM
>
rows
(
ordered
):
8
>
rows
(
ordered
):
8
ALTER
TABLE
TEST
ADD
T5
TIMESTAMP
(
10
);
ALTER
TABLE
TEST
ADD
T5
TIMESTAMP
(
10
);
>
exception
>
exception
INVALID_VALUE_SCALE_PRECISION
ALTER
TABLE
TEST
ADD
DT4
DATETIME
(
10
);
ALTER
TABLE
TEST
ADD
DT4
DATETIME
(
10
);
>
exception
>
exception
INVALID_VALUE_SCALE_PRECISION
ALTER
TABLE
TEST
ADD
STD2
SMALLDATETIME
(
1
);
ALTER
TABLE
TEST
ADD
STD2
SMALLDATETIME
(
1
);
>
exception
>
exception
SYNTAX_ERROR_1
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
...
...
h2/src/test/org/h2/test/scripts/ddl/alterTableAdd.sql
浏览文件 @
236daa35
...
@@ -52,7 +52,7 @@ CREATE TABLE TEST(A INT NOT NULL, B INT);
...
@@ -52,7 +52,7 @@ CREATE TABLE TEST(A INT NOT NULL, B INT);
-- column B may be null
-- column B may be null
ALTER
TABLE
TEST
ADD
(
CONSTRAINT
PK_B
PRIMARY
KEY
(
B
));
ALTER
TABLE
TEST
ADD
(
CONSTRAINT
PK_B
PRIMARY
KEY
(
B
));
>
exception
>
exception
COLUMN_MUST_NOT_BE_NULLABLE_1
ALTER
TABLE
TEST
ADD
(
CONSTRAINT
PK_A
PRIMARY
KEY
(
A
));
ALTER
TABLE
TEST
ADD
(
CONSTRAINT
PK_A
PRIMARY
KEY
(
A
));
>
ok
>
ok
...
@@ -70,16 +70,16 @@ SELECT * FROM TEST;
...
@@ -70,16 +70,16 @@ SELECT * FROM TEST;
>
rows
:
1
>
rows
:
1
INSERT
INTO
TEST
VALUES
(
11
,
20
,
30
,
40
);
INSERT
INTO
TEST
VALUES
(
11
,
20
,
30
,
40
);
>
exception
>
exception
DUPLICATE_KEY_1
INSERT
INTO
TEST
VALUES
(
10
,
12
,
30
,
40
);
INSERT
INTO
TEST
VALUES
(
10
,
12
,
30
,
40
);
>
exception
>
exception
DUPLICATE_KEY_1
INSERT
INTO
TEST
VALUES
(
10
,
20
,
1
,
40
);
INSERT
INTO
TEST
VALUES
(
10
,
20
,
1
,
40
);
>
exception
>
exception
DUPLICATE_KEY_1
INSERT
INTO
TEST
VALUES
(
10
,
20
,
30
,
14
);
INSERT
INTO
TEST
VALUES
(
10
,
20
,
30
,
14
);
>
exception
>
exception
DUPLICATE_KEY_1
INSERT
INTO
TEST
VALUES
(
10
,
20
,
30
,
40
);
INSERT
INTO
TEST
VALUES
(
10
,
20
,
30
,
40
);
>
update
count
:
1
>
update
count
:
1
...
...
h2/src/test/org/h2/test/scripts/ddl/alterTableDropColumn.sql
浏览文件 @
236daa35
...
@@ -16,7 +16,7 @@ ALTER TABLE IF EXISTS TEST DROP COLUMN A;
...
@@ -16,7 +16,7 @@ ALTER TABLE IF EXISTS TEST DROP COLUMN A;
>
ok
>
ok
ALTER
TABLE
TEST
DROP
COLUMN
A
;
ALTER
TABLE
TEST
DROP
COLUMN
A
;
>
exception
>
exception
TABLE_OR_VIEW_NOT_FOUND_1
CREATE
TABLE
TEST
(
A
INT
,
B
INT
,
C
INT
,
D
INT
,
E
INT
,
F
INT
,
G
INT
,
H
INT
,
I
INT
,
J
INT
);
CREATE
TABLE
TEST
(
A
INT
,
B
INT
,
C
INT
,
D
INT
,
E
INT
,
F
INT
,
G
INT
,
H
INT
,
I
INT
,
J
INT
);
>
ok
>
ok
...
@@ -25,7 +25,7 @@ ALTER TABLE TEST DROP COLUMN IF EXISTS J;
...
@@ -25,7 +25,7 @@ ALTER TABLE TEST DROP COLUMN IF EXISTS J;
>
ok
>
ok
ALTER
TABLE
TEST
DROP
COLUMN
J
;
ALTER
TABLE
TEST
DROP
COLUMN
J
;
>
exception
>
exception
COLUMN_NOT_FOUND_1
ALTER
TABLE
TEST
DROP
COLUMN
B
;
ALTER
TABLE
TEST
DROP
COLUMN
B
;
>
ok
>
ok
...
@@ -39,7 +39,7 @@ SELECT * FROM TEST;
...
@@ -39,7 +39,7 @@ SELECT * FROM TEST;
>
rows
:
0
>
rows
:
0
ALTER
TABLE
TEST
DROP
COLUMN
B
,
D
;
ALTER
TABLE
TEST
DROP
COLUMN
B
,
D
;
>
exception
>
exception
COLUMN_NOT_FOUND_1
ALTER
TABLE
TEST
DROP
COLUMN
IF
EXISTS
B
,
D
;
ALTER
TABLE
TEST
DROP
COLUMN
IF
EXISTS
B
,
D
;
>
ok
>
ok
...
@@ -58,7 +58,7 @@ SELECT * FROM TEST;
...
@@ -58,7 +58,7 @@ SELECT * FROM TEST;
>
rows
:
0
>
rows
:
0
ALTER
TABLE
TEST
DROP
COLUMN
(
B
,
H
);
ALTER
TABLE
TEST
DROP
COLUMN
(
B
,
H
);
>
exception
>
exception
COLUMN_NOT_FOUND_1
ALTER
TABLE
TEST
DROP
COLUMN
IF
EXISTS
(
B
,
H
);
ALTER
TABLE
TEST
DROP
COLUMN
IF
EXISTS
(
B
,
H
);
>
ok
>
ok
...
...
h2/src/test/org/h2/test/scripts/ddl/createAlias.sql
浏览文件 @
236daa35
...
@@ -4,13 +4,13 @@
...
@@ -4,13 +4,13 @@
--
--
create
alias
"SYSDATE"
for
"java.lang.Integer.parseInt(java.lang.String)"
;
create
alias
"SYSDATE"
for
"java.lang.Integer.parseInt(java.lang.String)"
;
>
exception
>
exception
FUNCTION_ALIAS_ALREADY_EXISTS_1
create
alias
"MIN"
for
"java.lang.Integer.parseInt(java.lang.String)"
;
create
alias
"MIN"
for
"java.lang.Integer.parseInt(java.lang.String)"
;
>
exception
>
exception
FUNCTION_ALIAS_ALREADY_EXISTS_1
create
alias
"CAST"
for
"java.lang.Integer.parseInt(java.lang.String)"
;
create
alias
"CAST"
for
"java.lang.Integer.parseInt(java.lang.String)"
;
>
exception
>
exception
FUNCTION_ALIAS_ALREADY_EXISTS_1
--- function alias ---------------------------------------------------------------------------------------------
--- function alias ---------------------------------------------------------------------------------------------
CREATE
ALIAS
MY_SQRT
FOR
"java.lang.Math.sqrt"
;
CREATE
ALIAS
MY_SQRT
FOR
"java.lang.Math.sqrt"
;
...
@@ -54,13 +54,13 @@ CREATE SCHEMA TEST_SCHEMA;
...
@@ -54,13 +54,13 @@ CREATE SCHEMA TEST_SCHEMA;
>
ok
>
ok
CREATE
ALIAS
TRUNC
FOR
"java.lang.Math.floor(double)"
;
CREATE
ALIAS
TRUNC
FOR
"java.lang.Math.floor(double)"
;
>
exception
>
exception
FUNCTION_ALIAS_ALREADY_EXISTS_1
CREATE
ALIAS
PUBLIC
.
TRUNC
FOR
"java.lang.Math.floor(double)"
;
CREATE
ALIAS
PUBLIC
.
TRUNC
FOR
"java.lang.Math.floor(double)"
;
>
exception
>
exception
FUNCTION_ALIAS_ALREADY_EXISTS_1
CREATE
ALIAS
TEST_SCHEMA
.
TRUNC
FOR
"java.lang.Math.round(double)"
;
CREATE
ALIAS
TEST_SCHEMA
.
TRUNC
FOR
"java.lang.Math.round(double)"
;
>
exception
>
exception
FUNCTION_ALIAS_ALREADY_EXISTS_1
SET
BUILTIN_ALIAS_OVERRIDE
=
1
;
SET
BUILTIN_ALIAS_OVERRIDE
=
1
;
>
ok
>
ok
...
...
h2/src/test/org/h2/test/scripts/ddl/dropSchema.sql
浏览文件 @
236daa35
...
@@ -16,7 +16,7 @@ CREATE TABLE TEST_SCHEMA.TEST();
...
@@ -16,7 +16,7 @@ CREATE TABLE TEST_SCHEMA.TEST();
>
ok
>
ok
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
>
exception
>
exception
CANNOT_DROP_2
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
>
ok
>
ok
...
@@ -28,7 +28,7 @@ CREATE VIEW TEST_SCHEMA.TEST AS SELECT 1;
...
@@ -28,7 +28,7 @@ CREATE VIEW TEST_SCHEMA.TEST AS SELECT 1;
>
ok
>
ok
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
>
exception
>
exception
CANNOT_DROP_2
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
>
ok
>
ok
...
@@ -43,7 +43,7 @@ CREATE SYNONYM TEST_SCHEMA.TEST FOR PUBLIC.SRC;
...
@@ -43,7 +43,7 @@ CREATE SYNONYM TEST_SCHEMA.TEST FOR PUBLIC.SRC;
>
ok
>
ok
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
>
exception
>
exception
CANNOT_DROP_2
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
>
ok
>
ok
...
@@ -58,7 +58,7 @@ CREATE SEQUENCE TEST_SCHEMA.TEST;
...
@@ -58,7 +58,7 @@ CREATE SEQUENCE TEST_SCHEMA.TEST;
>
ok
>
ok
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
>
exception
>
exception
CANNOT_DROP_2
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
>
ok
>
ok
...
@@ -70,7 +70,7 @@ CREATE CONSTANT TEST_SCHEMA.TEST VALUE 1;
...
@@ -70,7 +70,7 @@ CREATE CONSTANT TEST_SCHEMA.TEST VALUE 1;
>
ok
>
ok
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
>
exception
>
exception
CANNOT_DROP_2
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
>
ok
>
ok
...
@@ -82,7 +82,7 @@ CREATE ALIAS TEST_SCHEMA.TEST FOR "java.lang.System.currentTimeMillis";
...
@@ -82,7 +82,7 @@ CREATE ALIAS TEST_SCHEMA.TEST FOR "java.lang.System.currentTimeMillis";
>
ok
>
ok
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
DROP
SCHEMA
TEST_SCHEMA
RESTRICT
;
>
exception
>
exception
CANNOT_DROP_2
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
DROP
SCHEMA
TEST_SCHEMA
CASCADE
;
>
ok
>
ok
h2/src/test/org/h2/test/scripts/derived-column-names.sql
浏览文件 @
236daa35
...
@@ -34,16 +34,16 @@ SELECT A AS A1, B AS B1 FROM (VALUES(1, 2)) AS T(A, B) WHERE A <> B;
...
@@ -34,16 +34,16 @@ SELECT A AS A1, B AS B1 FROM (VALUES(1, 2)) AS T(A, B) WHERE A <> B;
>
rows
:
1
>
rows
:
1
SELECT
A
AS
A1
,
B
AS
B1
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
,
B
)
WHERE
A1
<>
B1
;
SELECT
A
AS
A1
,
B
AS
B1
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
,
B
)
WHERE
A1
<>
B1
;
>
exception
>
exception
COLUMN_NOT_FOUND_1
SELECT
*
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
);
SELECT
*
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
);
>
exception
>
exception
COLUMN_COUNT_DOES_NOT_MATCH
SELECT
*
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
,
a
);
SELECT
*
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
,
a
);
>
exception
>
exception
DUPLICATE_COLUMN_NAME_1
SELECT
*
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
,
B
,
C
);
SELECT
*
FROM
(
VALUES
(
1
,
2
))
AS
T
(
A
,
B
,
C
);
>
exception
>
exception
COLUMN_COUNT_DOES_NOT_MATCH
SELECT
V
AS
V1
,
A
AS
A1
,
B
AS
B1
FROM
(
VALUES
(
1
))
T1
(
V
)
INNER
JOIN
(
VALUES
(
1
,
2
))
T2
(
A
,
B
)
ON
V
=
A
;
SELECT
V
AS
V1
,
A
AS
A1
,
B
AS
B1
FROM
(
VALUES
(
1
))
T1
(
V
)
INNER
JOIN
(
VALUES
(
1
,
2
))
T2
(
A
,
B
)
ON
V
=
A
;
>
V1
A1
B1
>
V1
A1
B1
...
...
h2/src/test/org/h2/test/scripts/dml/error_reporting.sql
浏览文件 @
236daa35
...
@@ -7,7 +7,7 @@ CREATE TABLE test (id INT NOT NULL, name VARCHAR);
...
@@ -7,7 +7,7 @@ CREATE TABLE test (id INT NOT NULL, name VARCHAR);
>
ok
>
ok
select
*
from
test
where
id
=
(
1
,
2
);
select
*
from
test
where
id
=
(
1
,
2
);
>
exception
>
exception
COMPARING_ARRAY_TO_SCALAR
drop
table
test
;
drop
table
test
;
>
ok
>
ok
\ No newline at end of file
h2/src/test/org/h2/test/scripts/dml/insertIgnore.sql
浏览文件 @
236daa35
...
@@ -13,7 +13,7 @@ INSERT INTO TEST VALUES (1, 10), (2, 20), (3, 30), (4, 40);
...
@@ -13,7 +13,7 @@ INSERT INTO TEST VALUES (1, 10), (2, 20), (3, 30), (4, 40);
>
update
count
:
4
>
update
count
:
4
INSERT
INTO
TEST
VALUES
(
3
,
31
),
(
5
,
51
);
INSERT
INTO
TEST
VALUES
(
3
,
31
),
(
5
,
51
);
>
exception
>
exception
DUPLICATE_KEY_1
SELECT
*
FROM
TEST
ORDER
BY
ID
;
SELECT
*
FROM
TEST
ORDER
BY
ID
;
>
ID
VALUE
>
ID
VALUE
...
...
h2/src/test/org/h2/test/scripts/functions/numeric/hash.sql
浏览文件 @
236daa35
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
--
--
call
hash
(
'SHA256'
,
'Hello'
,
0
);
call
hash
(
'SHA256'
,
'Hello'
,
0
);
>
exception
>
exception
INVALID_VALUE_2
call
hash
(
'SHA256'
,
'Hello'
);
call
hash
(
'SHA256'
,
'Hello'
);
>>
185
f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
>>
185
f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
...
@@ -22,4 +22,4 @@ CALL HASH('SHA256', STRINGTOUTF8('Password'), 1000);
...
@@ -22,4 +22,4 @@ CALL HASH('SHA256', STRINGTOUTF8('Password'), 1000);
>>
c644a176ce920bde361ac336089b06cc2f1514dfa95ba5aabfe33f9a22d577f0
>>
c644a176ce920bde361ac336089b06cc2f1514dfa95ba5aabfe33f9a22d577f0
call
hash
(
'unknown'
,
'Hello'
,
1
);
call
hash
(
'unknown'
,
'Hello'
,
1
);
>
exception
>
exception
INVALID_VALUE_2
h2/src/test/org/h2/test/scripts/functions/numeric/ora-hash.sql
浏览文件 @
236daa35
...
@@ -16,7 +16,7 @@ SELECT ORA_HASH(1);
...
@@ -16,7 +16,7 @@ SELECT ORA_HASH(1);
>>
3509391659
>>
3509391659
SELECT
ORA_HASH
(
1
,
-
1
);
SELECT
ORA_HASH
(
1
,
-
1
);
>
exception
>
exception
INVALID_VALUE_2
SELECT
ORA_HASH
(
1
,
0
);
SELECT
ORA_HASH
(
1
,
0
);
>>
0
>>
0
...
@@ -28,7 +28,7 @@ SELECT ORA_HASH(1, 4294967296)
...
@@ -28,7 +28,7 @@ SELECT ORA_HASH(1, 4294967296)
>
exception
>
exception
SELECT
ORA_HASH
(
1
,
4294967295
,
-
1
);
SELECT
ORA_HASH
(
1
,
4294967295
,
-
1
);
>
exception
>
exception
SYNTAX_ERROR_1
SELECT
ORA_HASH
(
1
,
4294967295
,
0
);
SELECT
ORA_HASH
(
1
,
4294967295
,
0
);
>>
3509391659
>>
3509391659
...
@@ -40,7 +40,7 @@ SELECT ORA_HASH(1, 4294967295, 4294967295);
...
@@ -40,7 +40,7 @@ SELECT ORA_HASH(1, 4294967295, 4294967295);
>>
3501171530
>>
3501171530
SELECT
ORA_HASH
(
1
,
4294967295
,
4294967296
);
SELECT
ORA_HASH
(
1
,
4294967295
,
4294967296
);
>
exception
>
exception
INVALID_VALUE_2
CREATE
TABLE
TEST
(
I
BINARY
,
B
BLOB
,
S
VARCHAR
,
C
CLOB
);
CREATE
TABLE
TEST
(
I
BINARY
,
B
BLOB
,
S
VARCHAR
,
C
CLOB
);
>
ok
>
ok
...
...
h2/src/test/org/h2/test/scripts/functions/string/regex-replace.sql
浏览文件 @
236daa35
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
--
--
call
regexp_replace
(
'x'
,
'x'
,
'
\'
);
call
regexp_replace
(
'x'
,
'x'
,
'
\'
);
> exception
> exception
LIKE_ESCAPE_ERROR_1
CALL REGEXP_REPLACE('
abckaboooom
', '
o
+
', '
o
');
CALL REGEXP_REPLACE('
abckaboooom
', '
o
+
', '
o
');
>> abckabom
>> abckabom
...
...
h2/src/test/org/h2/test/scripts/functions/string/regexp-like.sql
浏览文件 @
236daa35
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
--
--
call
select
1
from
dual
where
regexp_like
(
'x'
,
'x'
,
'
\'
);
call
select
1
from
dual
where
regexp_like
(
'x'
,
'x'
,
'
\'
);
> exception
> exception
INVALID_VALUE_2
select x from dual where REGEXP_LIKE('
A
', '
[
a
-
z
]
', '
i
');
select x from dual where REGEXP_LIKE('
A
', '
[
a
-
z
]
', '
i
');
>> 1
>> 1
...
...
h2/src/test/org/h2/test/scripts/functions/system/cast.sql
浏览文件 @
236daa35
...
@@ -89,7 +89,7 @@ select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary);
...
@@ -89,7 +89,7 @@ select cast(cast('01020304-0506-0708-090a-0b0c0d0e0f00' as uuid) as binary);
>>
0102030405060708090
a0b0c0d0e0f00
>>
0102030405060708090
a0b0c0d0e0f00
call
cast
(
'null'
as
uuid
);
call
cast
(
'null'
as
uuid
);
>
exception
>
exception
DATA_CONVERSION_ERROR_1
select
cast
(
'12345678123456781234567812345678'
as
uuid
);
select
cast
(
'12345678123456781234567812345678'
as
uuid
);
>>
12345678
-
1234
-
5678
-
1234
-
567812345678
>>
12345678
-
1234
-
5678
-
1234
-
567812345678
...
...
h2/src/test/org/h2/test/scripts/functions/timeanddate/date_trunc.sql
浏览文件 @
236daa35
...
@@ -1063,14 +1063,14 @@ SELECT DATE_TRUNC('MILLENNIUM', '2000-05-29 15:14:13');
...
@@ -1063,14 +1063,14 @@ SELECT DATE_TRUNC('MILLENNIUM', '2000-05-29 15:14:13');
-- Test unhandled time unit and bad date
-- Test unhandled time unit and bad date
--
--
SELECT
DATE_TRUNC
(
'---'
,
'2015-05-29 15:14:13'
);
SELECT
DATE_TRUNC
(
'---'
,
'2015-05-29 15:14:13'
);
>
exception
>
exception
INVALID_VALUE_2
SELECT
DATE_TRUNC
(
''
,
'2015-05-29 15:14:13'
);
SELECT
DATE_TRUNC
(
''
,
'2015-05-29 15:14:13'
);
>
exception
>
exception
INVALID_VALUE_2
SELECT
DATE_TRUNC
(
''
,
''
);
SELECT
DATE_TRUNC
(
''
,
''
);
>
exception
>
exception
INVALID_VALUE_2
SELECT
DATE_TRUNC
(
'YEAR'
,
''
);
SELECT
DATE_TRUNC
(
'YEAR'
,
''
);
>
exception
>
exception
INVALID_DATETIME_CONSTANT_2
h2/src/test/org/h2/test/scripts/functions/timeanddate/dateadd.sql
浏览文件 @
236daa35
...
@@ -88,7 +88,7 @@ SELECT DATEADD('MINUTE', 30, TIME '12:30:55');
...
@@ -88,7 +88,7 @@ SELECT DATEADD('MINUTE', 30, TIME '12:30:55');
>>
13
:
00
:
55
>>
13
:
00
:
55
SELECT
DATEADD
(
'DAY'
,
1
,
TIME
'12:30:55'
);
SELECT
DATEADD
(
'DAY'
,
1
,
TIME
'12:30:55'
);
>
exception
>
exception
INVALID_VALUE_2
SELECT
DATEADD
(
'QUARTER'
,
1
,
DATE
'2010-11-16'
);
SELECT
DATEADD
(
'QUARTER'
,
1
,
DATE
'2010-11-16'
);
>>
2011
-
02
-
16
>>
2011
-
02
-
16
...
...
h2/src/test/org/h2/test/scripts/joins.sql
浏览文件 @
236daa35
...
@@ -84,7 +84,7 @@ INSERT INTO PARENT VALUES(1);
...
@@ -84,7 +84,7 @@ INSERT INTO PARENT VALUES(1);
>
update
count
:
1
>
update
count
:
1
SELECT
*
FROM
PARENT
P
LEFT
OUTER
JOIN
CHILD
C
ON
C
.
PARENTID
=
P
.
ID
;
SELECT
*
FROM
PARENT
P
LEFT
OUTER
JOIN
CHILD
C
ON
C
.
PARENTID
=
P
.
ID
;
>
exception
>
exception
COLUMN_NOT_FOUND_1
DROP
TABLE
PARENT
,
CHILD
;
DROP
TABLE
PARENT
,
CHILD
;
>
ok
>
ok
...
@@ -380,7 +380,7 @@ select * from left_hand left join right_hand on left_hand.id=right_hand.id where
...
@@ -380,7 +380,7 @@ select * from left_hand left join right_hand on left_hand.id=right_hand.id where
-- h2: 0 (2 cols); postgresql: 0 (1 col), mysql: exception; derby, hsqldb: no natural join
-- h2: 0 (2 cols); postgresql: 0 (1 col), mysql: exception; derby, hsqldb: no natural join
select
*
from
left_hand
natural
join
right_hand
where
left_hand
.
id
=
1
having
right_hand
.
id
=
2
;
select
*
from
left_hand
natural
join
right_hand
where
left_hand
.
id
=
1
having
right_hand
.
id
=
2
;
>
exception
>
exception
MUST_GROUP_BY_COLUMN_1
-- h2, mysql, hsqldb: 0 rows; postgresql, derby: exception
-- h2, mysql, hsqldb: 0 rows; postgresql, derby: exception
select
*
from
left_hand
left
outer
join
right_hand
on
left_hand
.
id
=
right_hand
.
id
where
left_hand
.
id
=
1
group
by
left_hand
.
id
having
right_hand
.
id
=
2
;
select
*
from
left_hand
left
outer
join
right_hand
on
left_hand
.
id
=
right_hand
.
id
where
left_hand
.
id
=
1
group
by
left_hand
.
id
having
right_hand
.
id
=
2
;
...
...
h2/src/test/org/h2/test/scripts/range_table.sql
浏览文件 @
236daa35
...
@@ -182,16 +182,16 @@ SELECT COUNT(*) FROM SYSTEM_RANGE(2, 1, 2);
...
@@ -182,16 +182,16 @@ SELECT COUNT(*) FROM SYSTEM_RANGE(2, 1, 2);
>>
0
>>
0
SELECT
*
FROM
SYSTEM_RANGE
(
1
,
2
,
0
);
SELECT
*
FROM
SYSTEM_RANGE
(
1
,
2
,
0
);
>
exception
>
exception
STEP_SIZE_MUST_NOT_BE_ZERO
SELECT
COUNT
(
*
)
FROM
SYSTEM_RANGE
(
1
,
2
,
0
);
SELECT
COUNT
(
*
)
FROM
SYSTEM_RANGE
(
1
,
2
,
0
);
>
exception
>
exception
STEP_SIZE_MUST_NOT_BE_ZERO
SELECT
*
FROM
SYSTEM_RANGE
(
2
,
1
,
0
);
SELECT
*
FROM
SYSTEM_RANGE
(
2
,
1
,
0
);
>
exception
>
exception
STEP_SIZE_MUST_NOT_BE_ZERO
SELECT
COUNT
(
*
)
FROM
SYSTEM_RANGE
(
2
,
1
,
0
);
SELECT
COUNT
(
*
)
FROM
SYSTEM_RANGE
(
2
,
1
,
0
);
>
exception
>
exception
STEP_SIZE_MUST_NOT_BE_ZERO
SELECT
*
FROM
SYSTEM_RANGE
(
1
,
8
,
2
);
SELECT
*
FROM
SYSTEM_RANGE
(
1
,
8
,
2
);
>
X
>
X
...
...
h2/src/test/org/h2/test/scripts/testScript.sql
浏览文件 @
236daa35
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论