Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b8fc1320
提交
b8fc1320
authored
6月 26, 2013
作者:
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
...
@@ -214,7 +214,7 @@ public class TestCompatibility extends TestBase {
...
@@ -214,7 +214,7 @@ public class TestCompatibility extends TestBase {
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET MODE PostgreSQL"
);
stat
.
execute
(
"SET MODE PostgreSQL"
);
testLog
(
Math
.
log10
(
10
),
stat
);
testLog
(
Math
.
log10
(
10
),
stat
);
assertResult
(
"ABC"
,
stat
,
"SELECT SUBSTRING('ABCDEF' FOR 3)"
);
assertResult
(
"ABC"
,
stat
,
"SELECT SUBSTRING('ABCDEF' FOR 3)"
);
assertResult
(
"ABCD"
,
stat
,
"SELECT SUBSTRING('0ABCDEF' FROM 2 FOR 4)"
);
assertResult
(
"ABCD"
,
stat
,
"SELECT SUBSTRING('0ABCDEF' FROM 2 FOR 4)"
);
}
}
...
...
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
b8fc1320
...
@@ -143,7 +143,7 @@ public class TestIndex extends TestBase {
...
@@ -143,7 +143,7 @@ public class TestIndex extends TestBase {
}
}
stat
.
execute
(
"drop table test"
);
stat
.
execute
(
"drop table test"
);
}
}
private
void
testNonUniqueHashIndex
()
throws
SQLException
{
private
void
testNonUniqueHashIndex
()
throws
SQLException
{
reconnect
();
reconnect
();
stat
.
execute
(
"create memory table test(id bigint, data bigint)"
);
stat
.
execute
(
"create memory table test(id bigint, data bigint)"
);
...
...
h2/src/test/org/h2/test/db/TestShow.java
浏览文件 @
b8fc1320
...
@@ -13,11 +13,11 @@ import java.sql.ResultSet;
...
@@ -13,11 +13,11 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
/**
/**
* Test of compatibility for the SHOW statement
* Test of compatibility for the SHOW statement
.
*/
*/
public
class
TestShow
extends
TestBase
{
public
class
TestShow
extends
TestBase
{
/**
/**
* Run just this test.
* Run just this test.
*
*
...
...
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
b8fc1320
...
@@ -21,7 +21,7 @@ public class TestSpatial extends TestBase {
...
@@ -21,7 +21,7 @@ public class TestSpatial extends TestBase {
/**
/**
* Run just this test.
* Run just this test.
*
*
* @param a ignored
* @param a ignored
*/
*/
public
static
void
main
(
String
...
a
)
throws
Exception
{
public
static
void
main
(
String
...
a
)
throws
Exception
{
...
@@ -40,23 +40,27 @@ public class TestSpatial extends TestBase {
...
@@ -40,23 +40,27 @@ public class TestSpatial extends TestBase {
deleteDb
(
"spatial"
);
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
"spatial"
);
Connection
conn
=
getConnection
(
"spatial"
);
Statement
stat
=
conn
.
createStatement
();
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))')"
);
stat
.
execute
(
"insert into test values(1, 'POLYGON ((1 1, 1 2, 2 2, 1 1))')"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select * from test"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select * from test"
);
assertTrue
(
rs
.
next
());
assertTrue
(
rs
.
next
());
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertEquals
(
1
,
rs
.
getInt
(
1
));
assertEquals
(
"POLYGON ((1 1, 1 2, 2 2, 1 1))"
,
rs
.
getString
(
2
));
assertEquals
(
"POLYGON ((1 1, 1 2, 2 2, 1 1))"
,
rs
.
getString
(
2
));
GeometryFactory
f
=
new
GeometryFactory
();
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
)
});
Polygon
polygon
=
f
.
createPolygon
(
new
Coordinate
[]
{
assertTrue
(
poly
.
equals
(
rs
.
getObject
(
2
)));
new
Coordinate
(
1
,
1
),
new
Coordinate
(
1
,
2
),
rs
=
stat
.
executeQuery
(
"select * from test where poly = 'POLYGON ((1 1, 1 2, 2 2, 1 1))'"
);
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
());
assertTrue
(
rs
.
next
());
assertEquals
(
1
,
rs
.
getInt
(
1
));
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
gon
> '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
.
execute
(
"drop table test"
);
stat
.
execute
(
"drop table test"
);
conn
.
close
();
conn
.
close
();
deleteDb
(
"spatial"
);
deleteDb
(
"spatial"
);
...
@@ -67,30 +71,30 @@ public class TestSpatial extends TestBase {
...
@@ -67,30 +71,30 @@ public class TestSpatial extends TestBase {
deleteDb
(
"spatialIndex"
);
deleteDb
(
"spatialIndex"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
Connection
conn
=
getConnection
(
"spatialIndex"
);
Statement
stat
=
conn
.
createStatement
();
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
(
"create spatial index idx_test_poly
on test(poly
)"
);
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))')"
);
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
();
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
// these queries actually have no meaning in the context of a spatial index,
//
check them anyhow
//
just check that the query works
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 > '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 < '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
());
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
());
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
());
assertFalse
(
rs
.
next
());
stat
.
execute
(
"drop table test"
);
stat
.
execute
(
"drop table test"
);
conn
.
close
();
conn
.
close
();
deleteDb
(
"spatialIndex"
);
deleteDb
(
"spatialIndex"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论