Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9752cf23
提交
9752cf23
authored
1月 06, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tests
上级
f0ab8c9e
显示空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
463 行增加
和
332 行删除
+463
-332
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-1
TestCompatibilityOracle.java
h2/src/test/org/h2/test/db/TestCompatibilityOracle.java
+155
-155
TestDrop.java
h2/src/test/org/h2/test/db/TestDrop.java
+4
-3
TestDuplicateKeyUpdate.java
h2/src/test/org/h2/test/db/TestDuplicateKeyUpdate.java
+58
-31
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+53
-7
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+1
-1
TestRights.java
h2/src/test/org/h2/test/db/TestRights.java
+4
-4
TestSequence.java
h2/src/test/org/h2/test/db/TestSequence.java
+4
-4
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+23
-11
TestCallableStatement.java
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
+16
-15
TestLobApi.java
h2/src/test/org/h2/test/jdbc/TestLobApi.java
+12
-12
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+1
-1
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+24
-7
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+14
-14
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+20
-1
TestUpdatableResultSet.java
h2/src/test/org/h2/test/jdbc/TestUpdatableResultSet.java
+19
-10
TestBenchmark.java
h2/src/test/org/h2/test/store/TestBenchmark.java
+13
-46
TestDataUtils.java
h2/src/test/org/h2/test/store/TestDataUtils.java
+1
-1
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+1
-1
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+1
-1
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+4
-4
TestBnf.java
h2/src/test/org/h2/test/unit/TestBnf.java
+30
-1
TestCollation.java
h2/src/test/org/h2/test/unit/TestCollation.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+3
-0
没有找到文件。
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/db/TestCompatibilityOracle.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/db/TestDrop.java
浏览文件 @
9752cf23
...
@@ -70,7 +70,8 @@ public class TestDrop extends TestBase {
...
@@ -70,7 +70,8 @@ public class TestDrop extends TestBase {
stat
.
execute
(
"set schema public"
);
stat
.
execute
(
"set schema public"
);
stat
.
execute
(
"create schema test_run"
);
stat
.
execute
(
"create schema test_run"
);
stat
.
execute
(
"set schema test_run"
);
stat
.
execute
(
"set schema test_run"
);
stat
.
execute
(
"create table test2 (vid int, address varchar(20), constraint a_cons check (vid in (select id from table_view.test1)))"
);
stat
.
execute
(
"create table test2 (id int, address varchar(20), "
+
"constraint a_cons check (id in (select id from table_view.test1)))"
);
stat
.
execute
(
"set schema public"
);
stat
.
execute
(
"set schema public"
);
stat
.
execute
(
"drop all objects"
);
stat
.
execute
(
"drop all objects"
);
}
}
...
...
h2/src/test/org/h2/test/db/TestDuplicateKeyUpdate.java
浏览文件 @
9752cf23
...
@@ -42,23 +42,31 @@ public class TestDuplicateKeyUpdate extends TestBase {
...
@@ -42,23 +42,31 @@ public class TestDuplicateKeyUpdate extends TestBase {
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE `table_test` (\n"
+
" `id` bigint(20) NOT NULL ,\n"
stat
.
execute
(
"CREATE TABLE `table_test` (\n"
+
+
" `a_text` varchar(254) NOT NULL,\n"
+
" `some_text` varchar(254) NULL,\n"
" `id` bigint(20) NOT NULL ,\n"
+
+
" PRIMARY KEY (`id`)\n"
+
") ;"
);
" `a_text` varchar(254) NOT NULL,\n"
+
" `some_text` varchar(254) NULL,\n"
+
stat
.
execute
(
"INSERT INTO table_test ( id, a_text, some_text ) VALUES (1, 'aaaaaaaaaa', 'aaaaaaaaaa')"
);
" PRIMARY KEY (`id`)\n"
+
stat
.
execute
(
"INSERT INTO table_test ( id, a_text, some_text ) VALUES (2, 'bbbbbbbbbb', 'bbbbbbbbbb')"
);
") ;"
);
stat
.
execute
(
"INSERT INTO table_test ( id, a_text, some_text ) VALUES (3, 'cccccccccc', 'cccccccccc')"
);
stat
.
execute
(
"INSERT INTO table_test ( id, a_text, some_text ) VALUES (4, 'dddddddddd', 'dddddddddd')"
);
stat
.
execute
(
"INSERT INTO table_test ( id, a_text, some_text ) VALUES "
+
stat
.
execute
(
"INSERT INTO table_test ( id, a_text, some_text ) VALUES (5, 'eeeeeeeeee', 'eeeeeeeeee')"
);
"(1, 'aaaaaaaaaa', 'aaaaaaaaaa'), "
+
"(2, 'bbbbbbbbbb', 'bbbbbbbbbb'), "
+
stat
.
execute
(
"INSERT INTO table_test ( id , a_text, some_text ) VALUES (1, 'zzzzzzzzzz', 'abcdefghij') ON DUPLICATE KEY UPDATE some_text='UPDATE'"
);
"(3, 'cccccccccc', 'cccccccccc'), "
+
"(4, 'dddddddddd', 'dddddddddd'), "
+
"(5, 'eeeeeeeeee', 'eeeeeeeeee')"
);
stat
.
execute
(
"INSERT INTO table_test ( id , a_text, some_text ) "
+
"VALUES (1, 'zzzzzzzzzz', 'abcdefghij') "
+
"ON DUPLICATE KEY UPDATE some_text='UPDATE'"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test where id = 1"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test where id = 1"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
"UPDATE"
,
rs
.
getNString
(
1
));
assertEquals
(
"UPDATE"
,
rs
.
getNString
(
1
));
stat
.
execute
(
"INSERT INTO table_test ( id , a_text, some_text ) VALUES (3, 'zzzzzzzzzz', 'SOME TEXT') ON DUPLICATE KEY UPDATE some_text=values(some_text)"
);
stat
.
execute
(
"INSERT INTO table_test ( id , a_text, some_text ) "
+
"VALUES (3, 'zzzzzzzzzz', 'SOME TEXT') "
+
"ON DUPLICATE KEY UPDATE some_text=values(some_text)"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test where id = 3"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test where id = 3"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
"SOME TEXT"
,
rs
.
getNString
(
1
));
assertEquals
(
"SOME TEXT"
,
rs
.
getNString
(
1
));
...
@@ -80,36 +88,47 @@ public class TestDuplicateKeyUpdate extends TestBase {
...
@@ -80,36 +88,47 @@ public class TestDuplicateKeyUpdate extends TestBase {
stat
.
execute
(
"INSERT INTO table_test2 ( a_text, some_text, updatable_text ) VALUES ('d', 'd', '4')"
);
stat
.
execute
(
"INSERT INTO table_test2 ( a_text, some_text, updatable_text ) VALUES ('d', 'd', '4')"
);
stat
.
execute
(
"INSERT INTO table_test2 ( a_text, some_text, updatable_text ) VALUES ('e', 'e', '5')"
);
stat
.
execute
(
"INSERT INTO table_test2 ( a_text, some_text, updatable_text ) VALUES ('e', 'e', '5')"
);
stat
.
execute
(
"INSERT INTO table_test2 ( a_text, some_text ) VALUES ('e', 'e') ON DUPLICATE KEY UPDATE updatable_text='UPDATE'"
);
stat
.
execute
(
"INSERT INTO table_test2 ( a_text, some_text ) "
+
"VALUES ('e', 'e') ON DUPLICATE KEY UPDATE updatable_text='UPDATE'"
);
rs
=
stat
.
executeQuery
(
"SELECT updatable_text FROM table_test2 where a_text = 'e'"
);
rs
=
stat
.
executeQuery
(
"SELECT updatable_text FROM table_test2 where a_text = 'e'"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
"UPDATE"
,
rs
.
getNString
(
1
));
assertEquals
(
"UPDATE"
,
rs
.
getNString
(
1
));
stat
.
execute
(
"INSERT INTO table_test2 (a_text, some_text, updatable_text ) VALUES ('b', 'b', 'jfno') ON DUPLICATE KEY UPDATE updatable_text=values(updatable_text)"
);
stat
.
execute
(
"INSERT INTO table_test2 (a_text, some_text, updatable_text ) "
+
"VALUES ('b', 'b', 'test') "
+
"ON DUPLICATE KEY UPDATE updatable_text=values(updatable_text)"
);
rs
=
stat
.
executeQuery
(
"SELECT updatable_text FROM table_test2 where a_text = 'b'"
);
rs
=
stat
.
executeQuery
(
"SELECT updatable_text FROM table_test2 where a_text = 'b'"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
"
jfno
"
,
rs
.
getNString
(
1
));
assertEquals
(
"
test
"
,
rs
.
getNString
(
1
));
}
}
private
void
testDuplicateCache
(
Connection
conn
)
throws
SQLException
{
private
void
testDuplicateCache
(
Connection
conn
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE `table_test3` (\n"
+
" `id` bigint(20) NOT NULL ,\n"
stat
.
execute
(
"CREATE TABLE `table_test3` (\n"
+
+
" `a_text` varchar(254) NOT NULL,\n"
+
" `some_text` varchar(254) NULL,\n"
" `id` bigint(20) NOT NULL ,\n"
+
+
" PRIMARY KEY (`id`)\n"
+
") ;"
);
" `a_text` varchar(254) NOT NULL,\n"
+
" `some_text` varchar(254) NULL,\n"
+
" PRIMARY KEY (`id`)\n"
+
") ;"
);
stat
.
execute
(
"INSERT INTO table_test3 ( id, a_text, some_text ) VALUES (1, 'aaaaaaaaaa', 'aaaaaaaaaa')"
);
stat
.
execute
(
"INSERT INTO table_test3 ( id, a_text, some_text ) "
+
"VALUES (1, 'aaaaaaaaaa', 'aaaaaaaaaa')"
);
stat
.
execute
(
"INSERT INTO table_test3 ( id , a_text, some_text ) VALUES (1, 'zzzzzzzzzz', 'SOME TEXT') ON DUPLICATE KEY UPDATE some_text=values(some_text)"
);
stat
.
execute
(
"INSERT INTO table_test3 ( id , a_text, some_text ) "
+
"VALUES (1, 'zzzzzzzzzz', 'SOME TEXT') "
+
"ON DUPLICATE KEY UPDATE some_text=values(some_text)"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test3 where id = 1"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test3 where id = 1"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
"SOME TEXT"
,
rs
.
getNString
(
1
));
assertEquals
(
"SOME TEXT"
,
rs
.
getNString
(
1
));
// Execute twice the same query to use the one from cache without
// Execute twice the same query to use the one from cache without
// parsing, caused the values parameter to be seen as ammbiguous
// parsing, caused the values parameter to be seen as ambiguous
stat
.
execute
(
"INSERT INTO table_test3 ( id , a_text, some_text ) VALUES (1, 'zzzzzzzzzz', 'SOME TEXT') ON DUPLICATE KEY UPDATE some_text=values(some_text)"
);
stat
.
execute
(
"INSERT INTO table_test3 ( id , a_text, some_text ) "
+
"VALUES (1, 'zzzzzzzzzz', 'SOME TEXT') "
+
"ON DUPLICATE KEY UPDATE some_text=values(some_text)"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test3 where id = 1"
);
rs
=
stat
.
executeQuery
(
"SELECT some_text FROM table_test3 where id = 1"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
"SOME TEXT"
,
rs
.
getNString
(
1
));
assertEquals
(
"SOME TEXT"
,
rs
.
getNString
(
1
));
...
@@ -119,16 +138,24 @@ public class TestDuplicateKeyUpdate extends TestBase {
...
@@ -119,16 +138,24 @@ public class TestDuplicateKeyUpdate extends TestBase {
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE `table_test4` (\n"
+
" `id` bigint(20) NOT NULL ,\n"
stat
.
execute
(
"CREATE TABLE `table_test4` (\n"
+
+
" `a_text` varchar(254) NOT NULL,\n"
+
" `some_value` int(10) NULL,\n"
+
" PRIMARY KEY (`id`)\n"
" `id` bigint(20) NOT NULL ,\n"
+
+
") ;"
);
" `a_text` varchar(254) NOT NULL,\n"
+
" `some_value` int(10) NULL,\n"
+
stat
.
execute
(
"INSERT INTO table_test4 ( id, a_text, some_value ) VALUES (1, 'aaaaaaaaaa', 5)"
);
" PRIMARY KEY (`id`)\n"
+
stat
.
execute
(
"INSERT INTO table_test4 ( id, a_text, some_value ) VALUES (2, 'aaaaaaaaaa', 5)"
);
") ;"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id , a_text, some_value ) VALUES (1, 'b', 1) ON DUPLICATE KEY UPDATE some_value=some_value + values(some_value)"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id, a_text, some_value ) "
+
stat
.
execute
(
"INSERT INTO table_test4 ( id , a_text, some_value ) VALUES (1, 'b', 1) ON DUPLICATE KEY UPDATE some_value=some_value + 100"
);
"VALUES (1, 'aaaaaaaaaa', 5)"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id , a_text, some_value ) VALUES (2, 'b', 1) ON DUPLICATE KEY UPDATE some_value=values(some_value) + 1"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id, a_text, some_value ) "
+
"VALUES (2, 'aaaaaaaaaa', 5)"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id , a_text, some_value ) VALUES (1, 'b', 1) "
+
"ON DUPLICATE KEY UPDATE some_value=some_value + values(some_value)"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id , a_text, some_value ) VALUES (1, 'b', 1) "
+
"ON DUPLICATE KEY UPDATE some_value=some_value + 100"
);
stat
.
execute
(
"INSERT INTO table_test4 ( id , a_text, some_value ) VALUES (2, 'b', 1) "
+
"ON DUPLICATE KEY UPDATE some_value=values(some_value) + 1"
);
rs
=
stat
.
executeQuery
(
"SELECT some_value FROM table_test4 where id = 1"
);
rs
=
stat
.
executeQuery
(
"SELECT some_value FROM table_test4 where id = 1"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
106
,
rs
.
getInt
(
1
));
assertEquals
(
106
,
rs
.
getInt
(
1
));
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
9752cf23
...
@@ -28,6 +28,7 @@ import java.util.ArrayList;
...
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Currency
;
import
java.util.Currency
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.TimeZone
;
import
java.util.TimeZone
;
...
@@ -702,7 +703,22 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -702,7 +703,22 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals
(
2
,
array
.
length
);
assertEquals
(
2
,
array
.
length
);
assertEquals
(
0
,
((
Integer
)
array
[
0
]).
intValue
());
assertEquals
(
0
,
((
Integer
)
array
[
0
]).
intValue
());
assertEquals
(
"Hello"
,
(
String
)
array
[
1
]);
assertEquals
(
"Hello"
,
(
String
)
array
[
1
]);
ResultSet
rs2
=
a
.
getResultSet
();
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
a
).
getArray
(
1
,
-
1
);
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
a
).
getArray
(
1
,
3
);
assertEquals
(
0
,
((
Object
[])
a
.
getArray
(
1
,
0
)).
length
);
assertEquals
(
0
,
((
Object
[])
a
.
getArray
(
2
,
0
)).
length
);
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
a
).
getArray
(
0
,
0
);
assertThrows
(
ErrorCode
.
INVALID_VALUE_2
,
a
).
getArray
(
3
,
0
);
HashMap
<
String
,
Class
<?>>
map
=
New
.
hashMap
();
assertEquals
(
0
,
((
Object
[])
a
.
getArray
(
1
,
0
,
map
)).
length
);
assertEquals
(
2
,
((
Object
[])
a
.
getArray
(
map
)).
length
);
assertEquals
(
2
,
((
Object
[])
a
.
getArray
(
null
)).
length
);
map
.
put
(
"x"
,
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
a
).
getArray
(
1
,
0
,
map
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
a
).
getArray
(
map
);
ResultSet
rs2
;
rs2
=
a
.
getResultSet
();
rs2
.
next
();
rs2
.
next
();
assertEquals
(
1
,
rs2
.
getInt
(
1
));
assertEquals
(
1
,
rs2
.
getInt
(
1
));
assertEquals
(
0
,
rs2
.
getInt
(
2
));
assertEquals
(
0
,
rs2
.
getInt
(
2
));
...
@@ -711,6 +727,36 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -711,6 +727,36 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals
(
"Hello"
,
rs2
.
getString
(
2
));
assertEquals
(
"Hello"
,
rs2
.
getString
(
2
));
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
map
.
clear
();
rs2
=
a
.
getResultSet
(
map
);
rs2
.
next
();
assertEquals
(
1
,
rs2
.
getInt
(
1
));
assertEquals
(
0
,
rs2
.
getInt
(
2
));
rs2
.
next
();
assertEquals
(
2
,
rs2
.
getInt
(
1
));
assertEquals
(
"Hello"
,
rs2
.
getString
(
2
));
assertFalse
(
rs
.
next
());
rs2
=
a
.
getResultSet
(
2
,
1
);
rs2
.
next
();
assertEquals
(
2
,
rs2
.
getInt
(
1
));
assertEquals
(
"Hello"
,
rs2
.
getString
(
2
));
assertFalse
(
rs
.
next
());
rs2
=
a
.
getResultSet
(
1
,
1
,
map
);
rs2
.
next
();
assertEquals
(
1
,
rs2
.
getInt
(
1
));
assertEquals
(
0
,
rs2
.
getInt
(
2
));
assertFalse
(
rs
.
next
());
map
.
put
(
"x"
,
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
a
).
getResultSet
(
map
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
a
).
getResultSet
(
0
,
1
,
map
);
a
.
free
();
assertThrows
(
ErrorCode
.
OBJECT_CLOSED
,
a
).
getArray
();
assertThrows
(
ErrorCode
.
OBJECT_CLOSED
,
a
).
getResultSet
();
stat
.
execute
(
"CREATE ALIAS ROOT FOR \""
+
getClass
().
getName
()
+
".root\""
);
stat
.
execute
(
"CREATE ALIAS ROOT FOR \""
+
getClass
().
getName
()
+
".root\""
);
rs
=
stat
.
executeQuery
(
"CALL ROOT(9)"
);
rs
=
stat
.
executeQuery
(
"CALL ROOT(9)"
);
rs
.
next
();
rs
.
next
();
...
@@ -1174,12 +1220,12 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1174,12 +1220,12 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertResult
(
" 230 "
,
stat
,
"SELECT TO_CHAR(230, '999PR') FROM DUAL"
);
assertResult
(
" 230 "
,
stat
,
"SELECT TO_CHAR(230, '999PR') FROM DUAL"
);
assertResult
(
"230"
,
stat
,
"SELECT TO_CHAR(230, 'FM999PR') FROM DUAL"
);
assertResult
(
"230"
,
stat
,
"SELECT TO_CHAR(230, 'FM999PR') FROM DUAL"
);
assertResult
(
"0"
,
stat
,
"SELECT TO_CHAR(0, 'fm999pr') FROM DUAL"
);
assertResult
(
"0"
,
stat
,
"SELECT TO_CHAR(0, 'fm999pr') FROM DUAL"
);
assertResult
(
"
CCXXXVIII"
,
stat
,
"SELECT TO_CHAR(238
, 'RN') FROM DUAL"
);
assertResult
(
"
XI"
,
stat
,
"SELECT TO_CHAR(11
, 'RN') FROM DUAL"
);
assertResult
(
"
CCXXXVIII"
,
stat
,
"SELECT TO_CHAR(238
, 'FMRN') FROM DUAL"
);
assertResult
(
"
XI"
,
stat
,
"SELECT TO_CHAR(11
, 'FMRN') FROM DUAL"
);
assertResult
(
"
cxlix"
,
stat
,
"SELECT TO_CHAR(149
, 'FMrN') FROM DUAL"
);
assertResult
(
"
xi"
,
stat
,
"SELECT TO_CHAR(11
, 'FMrN') FROM DUAL"
);
assertResult
(
"
MCMLXXIX"
,
stat
,
"SELECT TO_CHAR(1979
, 'RN') FROM DUAL;"
);
assertResult
(
"
XI"
,
stat
,
"SELECT TO_CHAR(11
, 'RN') FROM DUAL;"
);
assertResult
(
"
xliv"
,
stat
,
"SELECT TO_CHAR(44
, 'rN') FROM DUAL"
);
assertResult
(
"
xi"
,
stat
,
"SELECT TO_CHAR(11
, 'rN') FROM DUAL"
);
assertResult
(
"
mdcclxxvi"
,
stat
,
"SELECT TO_CHAR(1776
, 'rn') FROM DUAL"
);
assertResult
(
"
xi"
,
stat
,
"SELECT TO_CHAR(11
, 'rn') FROM DUAL"
);
assertResult
(
" +42"
,
stat
,
"SELECT TO_CHAR(42, 'S999') FROM DUAL"
);
assertResult
(
" +42"
,
stat
,
"SELECT TO_CHAR(42, 'S999') FROM DUAL"
);
assertResult
(
" +42"
,
stat
,
"SELECT TO_CHAR(42, 's999') FROM DUAL"
);
assertResult
(
" +42"
,
stat
,
"SELECT TO_CHAR(42, 's999') FROM DUAL"
);
assertResult
(
" 42+"
,
stat
,
"SELECT TO_CHAR(42, '999S') FROM DUAL"
);
assertResult
(
" 42+"
,
stat
,
"SELECT TO_CHAR(42, '999S') FROM DUAL"
);
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
9752cf23
...
@@ -1561,7 +1561,7 @@ public class TestLob extends TestBase {
...
@@ -1561,7 +1561,7 @@ public class TestLob extends TestBase {
buffer
[
count
]
=
ch
;
buffer
[
count
]
=
ch
;
}
}
}
else
if
(
ch
>=
56192
&&
ch
<=
56319
)
{
}
else
if
(
ch
>=
56192
&&
ch
<=
56319
)
{
// private high surrogate
, no effing
clue, so skip it
// private high surrogate
: no
clue, so skip it
count
++;
count
++;
}
else
{
}
else
{
buffer
[
count
]
=
ch
;
buffer
[
count
]
=
ch
;
...
...
h2/src/test/org/h2/test/db/TestRights.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/db/TestSequence.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
9752cf23
...
@@ -34,7 +34,7 @@ import org.h2.value.ValueGeometry;
...
@@ -34,7 +34,7 @@ import org.h2.value.ValueGeometry;
*/
*/
public
class
TestSpatial
extends
TestBase
{
public
class
TestSpatial
extends
TestBase
{
String
url
=
"spatial"
;
private
String
url
=
"spatial"
;
/**
/**
* Run just this test.
* Run just this test.
...
@@ -51,14 +51,19 @@ public class TestSpatial extends TestBase {
...
@@ -51,14 +51,19 @@ public class TestSpatial extends TestBase {
return
;
return
;
}
}
if
(
DataType
.
GEOMETRY_CLASS
!=
null
)
{
if
(
DataType
.
GEOMETRY_CLASS
!=
null
)
{
deleteDb
(
"spatial"
);
deleteDb
(
"spatial"
);
url
=
"spatial"
;
url
=
"spatial"
;
testSpatial
();
testSpatial
();
deleteDb
(
"spatial"
);
if
(!
config
.
mvcc
)
{
url
=
"spatial;MV_STORE=false"
;
url
=
"spatial;MV_STORE=false"
;
testSpatial
();
testSpatial
();
deleteDb
(
"spatial"
);
deleteDb
(
"spatial"
);
}
}
}
}
}
private
void
testSpatial
()
throws
SQLException
{
private
void
testSpatial
()
throws
SQLException
{
testSpatialValues
();
testSpatialValues
();
...
@@ -626,12 +631,19 @@ public class TestSpatial extends TestBase {
...
@@ -626,12 +631,19 @@ public class TestSpatial extends TestBase {
deleteDb
(
"spatial"
);
deleteDb
(
"spatial"
);
}
}
/**
* This method is called via reflection from the database.
*
* @param x the x position of the point
* @param y the y position of the point
* @return a result set with this point
*/
public
static
ResultSet
pointTable
(
double
x
,
double
y
)
{
public
static
ResultSet
pointTable
(
double
x
,
double
y
)
{
GeometryFactory
factory
=
new
GeometryFactory
();
GeometryFactory
factory
=
new
GeometryFactory
();
SimpleResultSet
s
rs
=
new
SimpleResultSet
();
SimpleResultSet
rs
=
new
SimpleResultSet
();
s
rs
.
addColumn
(
"THE_GEOM"
,
Types
.
JAVA_OBJECT
,
"GEOMETRY"
,
0
,
0
);
rs
.
addColumn
(
"THE_GEOM"
,
Types
.
JAVA_OBJECT
,
"GEOMETRY"
,
0
,
0
);
s
rs
.
addRow
(
factory
.
createPoint
(
new
Coordinate
(
x
,
y
)));
rs
.
addRow
(
factory
.
createPoint
(
new
Coordinate
(
x
,
y
)));
return
s
rs
;
return
rs
;
}
}
}
}
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
浏览文件 @
9752cf23
...
@@ -377,6 +377,7 @@ public class TestCallableStatement extends TestBase {
...
@@ -377,6 +377,7 @@ public class TestCallableStatement extends TestBase {
* @param a the value a
* @param a the value a
* @param b the value b
* @param b the value b
* @param c the value c
* @param c the value c
* @param d the value d
* @return a result set
* @return a result set
*/
*/
public
static
ResultSet
testCall
(
Connection
conn
,
int
a
,
String
b
,
Timestamp
c
,
Timestamp
d
)
throws
SQLException
{
public
static
ResultSet
testCall
(
Connection
conn
,
int
a
,
String
b
,
Timestamp
c
,
Timestamp
d
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/jdbc/TestLobApi.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
9752cf23
...
@@ -1034,24 +1034,41 @@ public class TestPreparedStatement extends TestBase {
...
@@ -1034,24 +1034,41 @@ public class TestPreparedStatement extends TestBase {
rs
.
next
();
rs
.
next
();
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
Statement
.
RETURN_GENERATED_KEYS
);
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
Statement
.
RETURN_GENERATED_KEYS
);
prep
.
execute
();
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
rs
.
next
();
assertEquals
(
2
,
rs
.
getInt
(
1
));
assertEquals
(
2
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
new
int
[]
{
1
});
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
new
int
[]
{
1
});
prep
.
execute
();
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
rs
.
next
();
assertEquals
(
3
,
rs
.
getInt
(
1
));
assertEquals
(
3
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
new
String
[]
{
"ID"
});
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
new
String
[]
{
"ID"
});
prep
.
execute
();
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
rs
.
next
();
assertEquals
(
4
,
rs
.
getInt
(
1
));
assertEquals
(
4
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
ResultSet
.
TYPE_FORWARD_ONLY
,
ResultSet
.
CONCUR_READ_ONLY
,
ResultSet
.
HOLD_CURSORS_OVER_COMMIT
);
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
assertEquals
(
5
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
9752cf23
...
@@ -8,14 +8,19 @@ package org.h2.test.jdbc;
...
@@ -8,14 +8,19 @@ package org.h2.test.jdbc;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLClientInfoException
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Savepoint
;
import
java.sql.Savepoint
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.HashMap
;
import
java.util.Properties
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.constant.SysProperties
;
import
org.h2.jdbc.JdbcStatement
;
import
org.h2.jdbc.JdbcStatement
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.util.New
;
/**
/**
* Tests for the Statement implementation.
* Tests for the Statement implementation.
...
@@ -52,6 +57,15 @@ public class TestStatement extends TestBase {
...
@@ -52,6 +57,15 @@ public class TestStatement extends TestBase {
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
stat
).
isWrapperFor
(
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
stat
).
isWrapperFor
(
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
stat
).
unwrap
(
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
stat
).
unwrap
(
Object
.
class
);
conn
.
setTypeMap
(
null
);
HashMap
<
String
,
Class
<?>>
map
=
New
.
hashMap
();
conn
.
setTypeMap
(
map
);
map
.
put
(
"x"
,
Object
.
class
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
conn
).
setTypeMap
(
map
);
assertThrows
(
SQLClientInfoException
.
class
,
conn
).
setClientInfo
(
"X"
,
"Y"
);
assertThrows
(
SQLClientInfoException
.
class
,
conn
).
setClientInfo
(
new
Properties
());
}
}
private
void
testTraceError
()
throws
Exception
{
private
void
testTraceError
()
throws
Exception
{
...
@@ -120,6 +134,7 @@ public class TestStatement extends TestBase {
...
@@ -120,6 +134,7 @@ public class TestStatement extends TestBase {
assertTrue
(
id1
!=
id2
);
assertTrue
(
id1
!=
id2
);
stat
.
execute
(
"UPDATE TEST SET NAME='Hallo' WHERE NAME='Hello'"
);
stat
.
execute
(
"UPDATE TEST SET NAME='Hallo' WHERE NAME='Hello'"
);
Savepoint
savepointTest
=
conn
.
setSavepoint
(
"Joe's"
);
Savepoint
savepointTest
=
conn
.
setSavepoint
(
"Joe's"
);
assertTrue
(
savepointTest
.
toString
().
endsWith
(
"name=Joe's"
));
stat
.
execute
(
"DELETE FROM TEST"
);
stat
.
execute
(
"DELETE FROM TEST"
);
assertEquals
(
savepointTest
.
getSavepointName
(),
"Joe's"
);
assertEquals
(
savepointTest
.
getSavepointName
(),
"Joe's"
);
assertThrows
(
ErrorCode
.
SAVEPOINT_IS_NAMED
,
savepointTest
).
assertThrows
(
ErrorCode
.
SAVEPOINT_IS_NAMED
,
savepointTest
).
...
@@ -145,6 +160,10 @@ public class TestStatement extends TestBase {
...
@@ -145,6 +160,10 @@ public class TestStatement extends TestBase {
conn
.
setHoldability
(
ResultSet
.
CLOSE_CURSORS_AT_COMMIT
);
conn
.
setHoldability
(
ResultSet
.
CLOSE_CURSORS_AT_COMMIT
);
assertEquals
(
ResultSet
.
CLOSE_CURSORS_AT_COMMIT
,
conn
.
getHoldability
());
assertEquals
(
ResultSet
.
CLOSE_CURSORS_AT_COMMIT
,
conn
.
getHoldability
());
assertFalse
(
stat
.
isPoolable
());
stat
.
setPoolable
(
true
);
assertFalse
(
stat
.
isPoolable
());
// ignored
// ignored
stat
.
setCursorName
(
"x"
);
stat
.
setCursorName
(
"x"
);
// fixed return value
// fixed return value
...
...
h2/src/test/org/h2/test/jdbc/TestUpdatableResultSet.java
浏览文件 @
9752cf23
...
@@ -502,7 +502,16 @@ public class TestUpdatableResultSet extends TestBase {
...
@@ -502,7 +502,16 @@ public class TestUpdatableResultSet extends TestBase {
for
(
int
i
=
0
;
i
<
max
;
i
++)
{
for
(
int
i
=
0
;
i
<
max
;
i
++)
{
stat
.
execute
(
"INSERT INTO TEST VALUES("
+
i
+
", 'Hello"
+
i
+
"')"
);
stat
.
execute
(
"INSERT INTO TEST VALUES("
+
i
+
", 'Hello"
+
i
+
"')"
);
}
}
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST ORDER BY ID"
);
rs
.
next
();
assertEquals
(
0
,
rs
.
getInt
(
1
));
rs
.
moveToInsertRow
();
rs
.
updateInt
(
1
,
100
);
rs
.
moveToCurrentRow
();
assertEquals
(
0
,
rs
.
getInt
(
1
));
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
int
j
=
max
;
int
j
=
max
;
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
int
id
=
rs
.
getInt
(
1
);
int
id
=
rs
.
getInt
(
1
);
...
...
h2/src/test/org/h2/test/store/TestBenchmark.java
浏览文件 @
9752cf23
...
@@ -9,15 +9,8 @@ import java.sql.Connection;
...
@@ -9,15 +9,8 @@ import java.sql.Connection;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
org.h2.mvstore.Chunk
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.Page
;
import
org.h2.mvstore.db.TransactionStore
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.util.Profiler
;
import
org.h2.value.ValueLong
;
import
org.h2.value.ValueString
;
/**
/**
* Tests performance and helps analyze bottlenecks.
* Tests performance and helps analyze bottlenecks.
...
@@ -44,6 +37,10 @@ public class TestBenchmark extends TestBase {
...
@@ -44,6 +37,10 @@ public class TestBenchmark extends TestBase {
}
}
private
void
test
(
boolean
mvStore
)
throws
Exception
{
private
void
test
(
boolean
mvStore
)
throws
Exception
{
;
// TODO this test is currently disabled
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
Connection
conn
;
Connection
conn
;
Statement
stat
;
Statement
stat
;
...
@@ -51,20 +48,18 @@ public class TestBenchmark extends TestBase {
...
@@ -51,20 +48,18 @@ public class TestBenchmark extends TestBase {
if
(
mvStore
)
{
if
(
mvStore
)
{
url
+=
";MV_STORE=TRUE;LOG=0"
;
url
+=
";MV_STORE=TRUE;LOG=0"
;
}
}
// 2033 mvstore
// 2313 (2075?) default
url
=
getURL
(
url
,
true
);
url
=
getURL
(
url
,
true
);
conn
=
getConnection
(
url
);
conn
=
getConnection
(
url
);
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id bigint primary key, name varchar)"
);
stat
.
execute
(
"create table test(id bigint primary key, name varchar)"
);
conn
.
setAutoCommit
(
false
);
conn
.
setAutoCommit
(
false
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"insert into test values(?, ?)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"insert into test values(?, ?)"
);
String
data
=
"Hello World"
;
String
data
=
"Hello World"
;
int
rowCount
=
100000
;
int
rowCount
=
100000
;
int
readCount
=
20
*
rowCount
;
int
readCount
=
20
*
rowCount
;
for
(
int
i
=
0
;
i
<
rowCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
rowCount
;
i
++)
{
prep
.
setInt
(
1
,
i
);
prep
.
setInt
(
1
,
i
);
...
@@ -76,44 +71,16 @@ public class TestBenchmark extends TestBase {
...
@@ -76,44 +71,16 @@ public class TestBenchmark extends TestBase {
}
}
long
start
=
System
.
currentTimeMillis
();
long
start
=
System
.
currentTimeMillis
();
// Profiler prof = new Profiler();
// prof.sumClasses=true;
// prof.startCollecting();
;
prep
=
conn
.
prepareStatement
(
"select * from test where id = ?"
);
prep
=
conn
.
prepareStatement
(
"select * from test where id = ?"
);
for
(
int
i
=
0
;
i
<
readCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
readCount
;
i
++)
{
prep
.
setInt
(
1
,
i
%
rowCount
);
prep
.
setInt
(
1
,
i
%
rowCount
);
prep
.
executeQuery
();
prep
.
executeQuery
();
}
}
System
.
out
.
println
((
System
.
currentTimeMillis
()
-
start
)
+
" "
//System.out.println("Transactionstore.counter " + ValueLong.counter);
+
(
mvStore
?
"mvstore"
:
"default"
));
//System.out.println("count " + Page.writeCount + " avgLen " + (1.0*Page.writeLength/Page.writeCount) + " avgSize " + (1.0*Page.writeSize/Page.writeCount));
//System.out.println(prof.getTop(5));
//System.out.println("ountUnc:" + counterUnc);
//System.out.println("ount:" + counter);
System
.
out
.
println
((
System
.
currentTimeMillis
()
-
start
)
+
" "
+
(
mvStore
?
"mvstore"
:
"default"
));
conn
.
close
();
conn
.
close
();
// MVStore s = new MVStore.Builder().fileName(getBaseDir() + "/mvstore.mv.db").open();
// int count = 0;
// long length = 0;
// for(String k : s.getMetaMap().keyList()) {
// if (k.startsWith("chunk.")) {
// String x = s.getMetaMap().get(k);
// Chunk c = Chunk.fromString(x);
// if (c.length < Integer.MAX_VALUE) {
// count++;
// length += c.length;
// }
// }
// }
// if (count > 0) {
// System.out.println("chunks: " + count + " average length: " + (length / count));
// }
// s.close();
}
}
}
}
h2/src/test/org/h2/test/store/TestDataUtils.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/unit/TestBnf.java
浏览文件 @
9752cf23
...
@@ -38,6 +38,7 @@ public class TestBnf extends TestBase {
...
@@ -38,6 +38,7 @@ public class TestBnf extends TestBase {
deleteDb
(
"bnf"
);
deleteDb
(
"bnf"
);
Connection
conn
=
getConnection
(
"bnf"
);
Connection
conn
=
getConnection
(
"bnf"
);
try
{
try
{
testModes
(
conn
);
testProcedures
(
conn
,
false
);
testProcedures
(
conn
,
false
);
}
finally
{
}
finally
{
conn
.
close
();
conn
.
close
();
...
@@ -50,6 +51,34 @@ public class TestBnf extends TestBase {
...
@@ -50,6 +51,34 @@ public class TestBnf extends TestBase {
}
}
}
}
private
void
testModes
(
Connection
conn
)
throws
Exception
{
DbContents
dbContents
;
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:h2:test"
,
conn
);
assertTrue
(
dbContents
.
isH2
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:derby:test"
,
conn
);
assertTrue
(
dbContents
.
isDerby
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:firebirdsql:test"
,
conn
);
assertTrue
(
dbContents
.
isFirebird
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:sqlserver:test"
,
conn
);
assertTrue
(
dbContents
.
isMSSQLServer
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:mysql:test"
,
conn
);
assertTrue
(
dbContents
.
isMySQL
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:oracle:test"
,
conn
);
assertTrue
(
dbContents
.
isOracle
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:postgresql:test"
,
conn
);
assertTrue
(
dbContents
.
isPostgreSQL
());
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
"jdbc:sqlite:test"
,
conn
);
assertTrue
(
dbContents
.
isSQLite
());
}
private
void
testProcedures
(
Connection
conn
,
boolean
isMySQLMode
)
throws
Exception
{
private
void
testProcedures
(
Connection
conn
,
boolean
isMySQLMode
)
throws
Exception
{
// Register a procedure and check if it is present in DbContents
// Register a procedure and check if it is present in DbContents
conn
.
createStatement
().
execute
(
"DROP ALIAS IF EXISTS CUSTOM_PRINT"
);
conn
.
createStatement
().
execute
(
"DROP ALIAS IF EXISTS CUSTOM_PRINT"
);
...
@@ -57,7 +86,7 @@ public class TestBnf extends TestBase {
...
@@ -57,7 +86,7 @@ public class TestBnf extends TestBase {
conn
.
createStatement
().
execute
(
"DROP TABLE IF EXISTS TABLE_WITH_STRING_FIELD"
);
conn
.
createStatement
().
execute
(
"DROP TABLE IF EXISTS TABLE_WITH_STRING_FIELD"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TABLE_WITH_STRING_FIELD (STRING_FIELD VARCHAR(50), INT_FIELD integer)"
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TABLE_WITH_STRING_FIELD (STRING_FIELD VARCHAR(50), INT_FIELD integer)"
);
DbContents
dbContents
=
new
DbContents
();
DbContents
dbContents
=
new
DbContents
();
dbContents
.
readContents
(
conn
.
getMetaData
()
);
dbContents
.
readContents
(
"jdbc:h2:test"
,
conn
);
assertTrue
(
dbContents
.
isH2
());
assertTrue
(
dbContents
.
isH2
());
assertFalse
(
dbContents
.
isDerby
());
assertFalse
(
dbContents
.
isDerby
());
assertFalse
(
dbContents
.
isFirebird
());
assertFalse
(
dbContents
.
isFirebird
());
...
...
h2/src/test/org/h2/test/unit/TestCollation.java
浏览文件 @
9752cf23
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
9752cf23
...
@@ -31,6 +31,7 @@ import org.h2.mvstore.DataUtils;
...
@@ -31,6 +31,7 @@ import org.h2.mvstore.DataUtils;
import
org.h2.mvstore.cache.FilePathCache
;
import
org.h2.mvstore.cache.FilePathCache
;
import
org.h2.store.fs.FilePath
;
import
org.h2.store.fs.FilePath
;
import
org.h2.store.fs.FilePathEncrypt
;
import
org.h2.store.fs.FilePathEncrypt
;
import
org.h2.store.fs.FilePathRec
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.utils.AssertThrows
;
import
org.h2.test.utils.AssertThrows
;
...
@@ -65,6 +66,7 @@ public class TestFileSystem extends TestBase {
...
@@ -65,6 +66,7 @@ public class TestFileSystem extends TestBase {
testUnsupportedFeatures
(
getBaseDir
());
testUnsupportedFeatures
(
getBaseDir
());
FilePathZip2
.
register
();
FilePathZip2
.
register
();
FilePath
.
register
(
new
FilePathCache
());
FilePath
.
register
(
new
FilePathCache
());
FilePathRec
.
register
();
testZipFileSystem
(
"zip:"
);
testZipFileSystem
(
"zip:"
);
testZipFileSystem
(
"cache:zip:"
);
testZipFileSystem
(
"cache:zip:"
);
testZipFileSystem
(
"zip2:"
);
testZipFileSystem
(
"zip2:"
);
...
@@ -85,6 +87,7 @@ public class TestFileSystem extends TestBase {
...
@@ -85,6 +87,7 @@ public class TestFileSystem extends TestBase {
testFileSystem
(
"memLZF:"
);
testFileSystem
(
"memLZF:"
);
testFileSystem
(
"nioMemFS:"
);
testFileSystem
(
"nioMemFS:"
);
testFileSystem
(
"nioMemLZF:"
);
testFileSystem
(
"nioMemLZF:"
);
testFileSystem
(
"rec:memFS:"
);
testUserHome
();
testUserHome
();
try
{
try
{
testFileSystem
(
"nio:"
+
getBaseDir
()
+
"/fs"
);
testFileSystem
(
"nio:"
+
getBaseDir
()
+
"/fs"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论