提交 677a9793 authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting

上级 2937be4a
...@@ -1024,7 +1024,7 @@ HASH(algorithmString, dataBytes, iterationInt) ...@@ -1024,7 +1024,7 @@ HASH(algorithmString, dataBytes, iterationInt)
"," ","
Calculate the hash value using an algorithm, and repeat this process for a number of iterations." Calculate the hash value using an algorithm, and repeat this process for a number of iterations."
"Functions (Numeric)","TRUNCATE"," "Functions (Numeric)","TRUNCATE","
{ TRUNC | TRUNCATE } ( { {numeric, digitsInt} | timestamp } ) { TRUNC | TRUNCATE } ( { {numeric, digitsInt} | timestamp | date | timestampString } )
"," ","
Truncates to a number of digits (to the next value closer to 0)." Truncates to a number of digits (to the next value closer to 0)."
"Functions (Numeric)","COMPRESS"," "Functions (Numeric)","COMPRESS","
......
...@@ -67,11 +67,16 @@ public class TestUsingIndex extends TestBase { ...@@ -67,11 +67,16 @@ public class TestUsingIndex extends TestBase {
conn = getConnection("using_index"); conn = getConnection("using_index");
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
assertFalse(isSupportedSyntax(stat, "create hash index idx_name_1 on test(id) using hash")); assertFalse(isSupportedSyntax(stat,
assertFalse(isSupportedSyntax(stat, "create hash index idx_name_2 on test(id) using btree")); "create hash index idx_name_1 on test(id) using hash"));
assertFalse(isSupportedSyntax(stat, "create index idx_name_3 on test(id) using hash_tree")); assertFalse(isSupportedSyntax(stat,
assertFalse(isSupportedSyntax(stat, "create unique hash index idx_name_4 on test(id) using hash")); "create hash index idx_name_2 on test(id) using btree"));
assertFalse(isSupportedSyntax(stat, "create index idx_name_5 on test(id) using hash table")); assertFalse(isSupportedSyntax(stat,
"create index idx_name_3 on test(id) using hash_tree"));
assertFalse(isSupportedSyntax(stat,
"create unique hash index idx_name_4 on test(id) using hash"));
assertFalse(isSupportedSyntax(stat,
"create index idx_name_5 on test(id) using hash table"));
conn.close(); conn.close();
deleteDb("using_index"); deleteDb("using_index");
} }
...@@ -80,9 +85,12 @@ public class TestUsingIndex extends TestBase { ...@@ -80,9 +85,12 @@ public class TestUsingIndex extends TestBase {
conn = getConnection("using_index"); conn = getConnection("using_index");
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
assertTrue(isSupportedSyntax(stat, "create index idx_name_1 on test(id) using hash")); assertTrue(isSupportedSyntax(stat,
assertTrue(isSupportedSyntax(stat, "create index idx_name_2 on test(id) using btree")); "create index idx_name_1 on test(id) using hash"));
assertTrue(isSupportedSyntax(stat, "create unique index idx_name_3 on test(id) using hash")); assertTrue(isSupportedSyntax(stat,
"create index idx_name_2 on test(id) using btree"));
assertTrue(isSupportedSyntax(stat,
"create unique index idx_name_3 on test(id) using hash"));
conn.close(); conn.close();
deleteDb("using_index"); deleteDb("using_index");
} }
...@@ -110,39 +118,33 @@ public class TestUsingIndex extends TestBase { ...@@ -110,39 +118,33 @@ public class TestUsingIndex extends TestBase {
if (config.memory && config.mvcc) { if (config.memory && config.mvcc) {
return; return;
} }
if (DataType.GEOMETRY_CLASS != null) { if (DataType.GEOMETRY_CLASS == null) {
deleteDb("spatial"); return;
conn = getConnection("spatial");
try {
stat = conn.createStatement();
stat.execute("create table test"
+ "(id int primary key, poly geometry)");
stat.execute("insert into test values(1, "
+ "'POLYGON ((1 1, 1 2, 2 2, 1 1))')");
stat.execute("insert into test values(2,null)");
stat.execute("insert into test values(3, "
+ "'POLYGON ((3 1, 3 2, 4 2, 3 1))')");
stat.execute("insert into test values(4,null)");
stat.execute("insert into test values(5, "
+ "'POLYGON ((1 3, 1 4, 2 4, 1 3))')");
stat.execute("create index on test(poly) using rtree");
ResultSet rs = stat.executeQuery(
"select * from test "
+ "where poly && 'POINT (1.5 1.5)'::Geometry");
assertTrue(rs.next());
assertEquals(1, rs.getInt("id"));
assertFalse(rs.next());
rs.close();
} finally {
// Close the database
conn.close();
}
deleteDb("spatial");
} }
deleteDb("spatial");
conn = getConnection("spatial");
stat = conn.createStatement();
stat.execute("create table test"
+ "(id int primary key, poly geometry)");
stat.execute("insert into test values(1, "
+ "'POLYGON ((1 1, 1 2, 2 2, 1 1))')");
stat.execute("insert into test values(2,null)");
stat.execute("insert into test values(3, "
+ "'POLYGON ((3 1, 3 2, 4 2, 3 1))')");
stat.execute("insert into test values(4,null)");
stat.execute("insert into test values(5, "
+ "'POLYGON ((1 3, 1 4, 2 4, 1 3))')");
stat.execute("create index on test(poly) using rtree");
ResultSet rs = stat.executeQuery(
"select * from test "
+ "where poly && 'POINT (1.5 1.5)'::Geometry");
assertTrue(rs.next());
assertEquals(1, rs.getInt("id"));
assertFalse(rs.next());
rs.close();
conn.close();
deleteDb("spatial");
} }
private void testBadSpatialSyntax() throws SQLException { private void testBadSpatialSyntax() throws SQLException {
...@@ -152,25 +154,20 @@ public class TestUsingIndex extends TestBase { ...@@ -152,25 +154,20 @@ public class TestUsingIndex extends TestBase {
if (config.memory && config.mvcc) { if (config.memory && config.mvcc) {
return; return;
} }
if (DataType.GEOMETRY_CLASS != null) { if (DataType.GEOMETRY_CLASS == null) {
deleteDb("spatial"); return;
conn = getConnection("spatial");
try {
stat = conn.createStatement();
stat.execute("create table test"
+ "(id int primary key, poly geometry)");
stat.execute("insert into test values(1, "
+ "'POLYGON ((1 1, 1 2, 2 2, 1 1))')");
assertFalse(isSupportedSyntax(stat, "create spatial index on test(poly) using rtree"));
} finally {
// Close the database
conn.close();
}
deleteDb("spatial");
} }
deleteDb("spatial");
conn = getConnection("spatial");
stat = conn.createStatement();
stat.execute("create table test"
+ "(id int primary key, poly geometry)");
stat.execute("insert into test values(1, "
+ "'POLYGON ((1 1, 1 2, 2 2, 1 1))')");
assertFalse(isSupportedSyntax(stat,
"create spatial index on test(poly) using rtree"));
conn.close();
deleteDb("spatial");
} }
} }
\ No newline at end of file
...@@ -771,4 +771,5 @@ young sweep clearer accounting disappeared donor oome ken jorissen nesterov ...@@ -771,4 +771,5 @@ young sweep clearer accounting disappeared donor oome ken jorissen nesterov
degradation failures fashion disjunctive mentioned conjunctive misses broke degradation failures fashion disjunctive mentioned conjunctive misses broke
authenticate orphaned registrations topology planner authenticate orphaned registrations topology planner
zepfred frederico thimel arnaud manipulating strongly lots aquiles younger needing zepfred frederico thimel arnaud manipulating strongly lots aquiles younger needing
unrecognized five omitting registering demo bson golomb unrecognized five omitting registering demo bson golomb bocher erwan
\ No newline at end of file huff frequencies freq frequency divisors asymmetric ideal nth prob ans
\ No newline at end of file
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
package org.h2.dev.util; package org.h2.dev.util;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import org.h2.mvstore.DataUtils; import org.h2.mvstore.DataUtils;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论