Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b8fc1320
提交
b8fc1320
authored
11 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup.
上级
48690027
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
38 行增加
和
34 行删除
+38
-34
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-1
TestIndex.java
h2/src/test/org/h2/test/db/TestIndex.java
+1
-1
TestShow.java
h2/src/test/org/h2/test/db/TestShow.java
+3
-3
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+33
-29
没有找到文件。
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
b8fc1320
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
b8fc1320
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestShow.java
浏览文件 @
b8fc1320
...
...
@@ -14,7 +14,7 @@ import java.sql.SQLException;
import
java.sql.Statement
;
/**
* Test of compatibility for the SHOW statement
* Test of compatibility for the SHOW statement
.
*/
public
class
TestShow
extends
TestBase
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
b8fc1320
...
...
@@ -41,21 +41,25 @@ public class TestSpatial extends TestBase {
Connection
conn
=
getConnection
(
"spatial"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create memory table test(id int primary key, poly geometry)"
);
stat
.
execute
(
"create memory table test(id int primary key, poly
gon
geometry)"
);
stat
.
execute
(
"insert into test values(1, 'POLYGON ((1 1, 1 2, 2 2, 1 1))')"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select * from test"
);
assertTrue
(
rs
.
next
());
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertEquals
(
"POLYGON ((1 1, 1 2, 2 2, 1 1))"
,
rs
.
getString
(
2
));
GeometryFactory
f
=
new
GeometryFactory
();
Polygon
poly
=
f
.
createPolygon
(
new
Coordinate
[]
{
new
Coordinate
(
1
,
1
),
new
Coordinate
(
1
,
2
),
new
Coordinate
(
2
,
2
),
new
Coordinate
(
1
,
1
)
});
assertTrue
(
poly
.
equals
(
rs
.
getObject
(
2
)));
rs
=
stat
.
executeQuery
(
"select * from test where poly = 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
Polygon
polygon
=
f
.
createPolygon
(
new
Coordinate
[]
{
new
Coordinate
(
1
,
1
),
new
Coordinate
(
1
,
2
),
new
Coordinate
(
2
,
2
),
new
Coordinate
(
1
,
1
)
});
assertTrue
(
polygon
.
equals
(
rs
.
getObject
(
2
)));
rs
=
stat
.
executeQuery
(
"select * from test where polygon = 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
assertTrue
(
rs
.
next
());
assertEquals
(
1
,
rs
.
getInt
(
1
));
stat
.
executeQuery
(
"select * from test where poly > 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly < 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly
gon
> 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly
gon
< 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
execute
(
"drop table test"
);
conn
.
close
();
...
...
@@ -68,27 +72,27 @@ public class TestSpatial extends TestBase {
Connection
conn
=
getConnection
(
"spatialIndex"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create memory table test(id int primary key, poly geometry)"
);
stat
.
execute
(
"create spatial index idx_test_poly
on test(poly
)"
);
stat
.
execute
(
"create memory table test(id int primary key, poly
gon
geometry)"
);
stat
.
execute
(
"create spatial index idx_test_poly
gon on test(polygon
)"
);
stat
.
execute
(
"insert into test values(1, 'POLYGON ((1 1, 1 2, 2 2, 1 1))')"
);
ResultSet
rs
=
stat
.
executeQuery
(
"explain select * from test where poly = 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
ResultSet
rs
=
stat
.
executeQuery
(
"explain select * from test where poly
gon
= 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
rs
.
next
();
assertContains
(
rs
.
getString
(
1
),
"/* PUBLIC.IDX_TEST_POLY
: POLY
="
);
assertContains
(
rs
.
getString
(
1
),
"/* PUBLIC.IDX_TEST_POLY
GON: POLYGON
="
);
// these queries actually have no meaning in the context of a spatial index,
but
//
check them anyhow
stat
.
executeQuery
(
"select * from test where poly = 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly > 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly < 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
// these queries actually have no meaning in the context of a spatial index,
//
just check that the query works
stat
.
executeQuery
(
"select * from test where poly
gon
= 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly
gon
> 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
stat
.
executeQuery
(
"select * from test where poly
gon
< 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
rs
=
stat
.
executeQuery
(
"select * from test where intersects(poly, 'POLYGON ((1 1, 1 2, 2 2, 1 1))')"
);
rs
=
stat
.
executeQuery
(
"select * from test where intersects(poly
gon
, 'POLYGON ((1 1, 1 2, 2 2, 1 1))')"
);
assertTrue
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"select * from test where intersects(poly, 'POINT (1 1)')"
);
rs
=
stat
.
executeQuery
(
"select * from test where intersects(poly
gon
, 'POINT (1 1)')"
);
assertTrue
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"select * from test where intersects(poly, 'POINT (0 0)')"
);
rs
=
stat
.
executeQuery
(
"select * from test where intersects(poly
gon
, 'POINT (0 0)')"
);
assertFalse
(
rs
.
next
());
stat
.
execute
(
"drop table test"
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论