Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c26f2c09
提交
c26f2c09
authored
1月 07, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting / tests
上级
5a546e5c
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
36 行增加
和
12 行删除
+36
-12
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+1
-1
TestIndex.java
h2/src/test/org/h2/test/db/TestIndex.java
+24
-0
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+8
-8
TestStatement.java
h2/src/test/org/h2/test/jdbc/TestStatement.java
+2
-2
TestBnf.java
h2/src/test/org/h2/test/unit/TestBnf.java
+1
-1
没有找到文件。
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
c26f2c09
...
...
@@ -1809,7 +1809,7 @@ public class JdbcConnection extends TraceObject implements Connection {
/**
* Check that the given type map is either null or empty.
*
*
* @param map the type map
* @throws DbException if the map is not empty
*/
...
...
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
c26f2c09
...
...
@@ -39,6 +39,7 @@ public class TestIndex extends TestBase {
@Override
public
void
test
()
throws
SQLException
{
deleteDb
(
"index"
);
testIndexTypes
();
testHashIndexOnMemoryTable
();
testErrorMessage
();
testDuplicateKeyException
();
...
...
@@ -93,6 +94,29 @@ public class TestIndex extends TestBase {
deleteDb
(
"index"
);
}
private
void
testIndexTypes
()
throws
SQLException
{
Connection
conn
=
getConnection
(
"index;MV_STORE=false"
);
stat
=
conn
.
createStatement
();
for
(
String
type
:
new
String
[]
{
"unique"
,
"hash"
,
"unique hash"
})
{
stat
.
execute
(
"create table test(id int)"
);
stat
.
execute
(
"create "
+
type
+
" index idx_name on test(id)"
);
stat
.
execute
(
"insert into test select x from system_range(1, 1000)"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select * from test where id=100"
);
assertTrue
(
rs
.
next
());
assertFalse
(
rs
.
next
());
stat
.
execute
(
"delete from test where id=100"
);
rs
=
stat
.
executeQuery
(
"select * from test where id=100"
);
assertFalse
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"select min(id), max(id) from test"
);
assertTrue
(
rs
.
next
());
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertEquals
(
1000
,
rs
.
getInt
(
2
));
stat
.
execute
(
"drop table test"
);
}
conn
.
close
();
deleteDb
(
"index"
);
}
private
void
testErrorMessage
()
throws
SQLException
{
reconnect
();
stat
.
execute
(
"create table test(id int primary key, name varchar)"
);
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
c26f2c09
...
...
@@ -1034,31 +1034,31 @@ public class TestPreparedStatement extends TestBase {
rs
.
next
();
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
Statement
.
RETURN_GENERATED_KEYS
);
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
assertEquals
(
2
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
new
int
[]
{
1
});
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
assertEquals
(
3
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
new
String
[]
{
"ID"
});
prep
.
execute
();
rs
=
prep
.
getGeneratedKeys
();
rs
.
next
();
assertEquals
(
4
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(NEXT VALUE FOR SEQ)"
,
ResultSet
.
TYPE_FORWARD_ONLY
,
ResultSet
.
CONCUR_READ_ONLY
,
...
...
@@ -1068,7 +1068,7 @@ public class TestPreparedStatement extends TestBase {
rs
.
next
();
assertEquals
(
5
,
rs
.
getInt
(
1
));
assertFalse
(
rs
.
next
());
stat
.
execute
(
"DROP TABLE TEST"
);
}
...
...
h2/src/test/org/h2/test/jdbc/TestStatement.java
浏览文件 @
c26f2c09
...
...
@@ -57,13 +57,13 @@ public class TestStatement extends TestBase {
Statement
stat
=
conn
.
createStatement
();
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
stat
).
isWrapperFor
(
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
());
}
...
...
h2/src/test/org/h2/test/unit/TestBnf.java
浏览文件 @
c26f2c09
...
...
@@ -50,7 +50,7 @@ public class TestBnf extends TestBase {
conn
.
close
();
}
}
private
void
testModes
(
Connection
conn
)
throws
Exception
{
DbContents
dbContents
;
dbContents
=
new
DbContents
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论