Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a75bf79a
提交
a75bf79a
authored
6月 26, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup.
上级
9f217915
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
64 行增加
和
52 行删除
+64
-52
Parser.java
h2/src/main/org/h2/command/Parser.java
+1
-1
CreateIndex.java
h2/src/main/org/h2/command/ddl/CreateIndex.java
+1
-1
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+1
-1
CreateTableData.java
h2/src/main/org/h2/command/ddl/CreateTableData.java
+1
-1
ErrorCode.java
h2/src/main/org/h2/constant/ErrorCode.java
+2
-2
Comparison.java
h2/src/main/org/h2/expression/Comparison.java
+3
-2
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+1
-0
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+2
-2
IndexCursor.java
h2/src/main/org/h2/index/IndexCursor.java
+3
-2
IndexType.java
h2/src/main/org/h2/index/IndexType.java
+2
-1
SpatialIndex.java
h2/src/main/org/h2/index/SpatialIndex.java
+30
-26
SpatialTreeIndex.java
h2/src/main/org/h2/index/SpatialTreeIndex.java
+17
-13
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
a75bf79a
...
...
@@ -3871,7 +3871,7 @@ public class Parser {
}
return
parseCreateTable
(
false
,
false
,
cached
);
}
else
{
boolean
hash
=
false
,
primaryKey
=
false
,
unique
=
false
,
spatial
=
false
;
;
boolean
hash
=
false
,
primaryKey
=
false
,
unique
=
false
,
spatial
=
false
;
String
indexName
=
null
;
Schema
oldSchema
=
null
;
boolean
ifNotExists
=
false
;
...
...
h2/src/main/org/h2/command/ddl/CreateIndex.java
浏览文件 @
a75bf79a
...
...
@@ -109,7 +109,7 @@ public class CreateIndex extends SchemaCommand {
public
void
setSpatial
(
boolean
b
)
{
this
.
spatial
=
b
;
}
public
void
setComment
(
String
comment
)
{
this
.
comment
=
comment
;
}
...
...
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
a75bf79a
...
...
@@ -292,7 +292,7 @@ public class CreateTable extends SchemaCommand {
public
void
setTableEngineParams
(
ArrayList
<
String
>
tableEngineParams
)
{
data
.
tableEngineParams
=
tableEngineParams
;
}
public
void
setHidden
(
boolean
isHidden
)
{
data
.
isHidden
=
isHidden
;
}
...
...
h2/src/main/org/h2/command/ddl/CreateTableData.java
浏览文件 @
a75bf79a
...
...
@@ -76,7 +76,7 @@ public class CreateTableData {
* The table engine params to use for creating the table.
*/
public
ArrayList
<
String
>
tableEngineParams
;
/**
* The table is hidden.
*/
...
...
h2/src/main/org/h2/constant/ErrorCode.java
浏览文件 @
a75bf79a
...
...
@@ -215,7 +215,7 @@ public class ErrorCode {
public
static
final
int
NO_DEFAULT_SET_1
=
23507
;
/**
* The error with code <code>23513</code> is thrown when
* The error with code <code>23513</code> is thrown when
* a check constraint is violated. Example:
* <pre>
* CREATE TABLE TEST(ID INT CHECK ID>0);
...
...
@@ -229,7 +229,7 @@ public class ErrorCode {
* evaluation of a check constraint resulted in a error.
*/
public
static
final
int
CHECK_CONSTRAINT_INVALID
=
23514
;
// 28: invalid authorization specification
/**
...
...
h2/src/main/org/h2/expression/Comparison.java
浏览文件 @
a75bf79a
...
...
@@ -101,10 +101,11 @@ public class Comparison extends Condition {
public
static
final
int
IN_QUERY
=
10
;
/**
* This is a pseudo comparison type that is only used for spatial index conditions.
* This is a pseudo comparison type that is only used for spatial index
* conditions.
*/
public
static
final
int
SPATIAL_INTERSECTS
=
11
;
private
final
Database
database
;
private
int
compareType
;
private
Expression
left
;
...
...
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
a75bf79a
...
...
@@ -90,6 +90,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
* Create a duplicate key exception with a message that contains the index
* name.
*
* @param key the key values
* @return the exception
*/
protected
DbException
getDuplicateKeyException
(
String
key
)
{
...
...
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
a75bf79a
...
...
@@ -61,7 +61,7 @@ public class IndexCondition {
* A bit of a search mask meaning 'spatial intersection'.
*/
public
static
final
int
SPATIAL_INTERSECTS
=
16
;
private
final
Column
column
;
/**
* see constants in {@link Comparison}
...
...
@@ -319,7 +319,7 @@ public class IndexCondition {
return
false
;
}
}
public
int
getCompareType
()
{
return
compareType
;
}
...
...
h2/src/main/org/h2/index/IndexCursor.java
浏览文件 @
a75bf79a
...
...
@@ -148,7 +148,8 @@ public class IndexCursor implements Cursor {
}
if
(!
alwaysFalse
)
{
if
(
intersects
!=
null
&&
index
instanceof
SpatialTreeIndex
)
{
cursor
=
((
SpatialTreeIndex
)
index
).
findByGeometry
(
tableFilter
,
intersects
);
cursor
=
((
SpatialTreeIndex
)
index
).
findByGeometry
(
tableFilter
,
intersects
);
}
else
{
cursor
=
index
.
find
(
tableFilter
,
start
,
end
);
}
...
...
@@ -190,7 +191,7 @@ public class IndexCursor implements Cursor {
}
return
row
;
}
private
SearchRow
getSearchRow
(
SearchRow
row
,
int
columnId
,
Value
v
,
boolean
max
)
{
if
(
row
==
null
)
{
row
=
table
.
getTemplateRow
();
...
...
h2/src/main/org/h2/index/IndexType.java
浏览文件 @
a75bf79a
...
...
@@ -60,6 +60,7 @@ public class IndexType {
*
* @param persistent if the index is persistent
* @param hash if a hash index should be used
* @param spatial if a spatial index should be used
* @return the index type
*/
public
static
IndexType
createNonUnique
(
boolean
persistent
,
boolean
hash
,
boolean
spatial
)
{
...
...
@@ -119,7 +120,7 @@ public class IndexType {
public
boolean
isSpatial
()
{
return
spatial
;
}
/**
* Is this index persistent?
*
...
...
h2/src/main/org/h2/index/SpatialIndex.java
浏览文件 @
a75bf79a
/*
* Copyright 2004-2013 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
index
;
import
org.h2.result.SearchRow
;
import
org.h2.table.TableFilter
;
/**
* A spatial index. Spatial indexes are used to speed up searching spatial/geometric data.
*/
public
interface
SpatialIndex
extends
Index
{
/**
* Find a row or a list of rows and create a cursor to iterate over the result.
*
* @param filter the table filter (which possibly knows
* about additional conditions)
* @param intersection the geometry which values should intersect with, or null for anything
* @return the cursor to iterate over the results
*/
Cursor
findByGeometry
(
TableFilter
filter
,
SearchRow
intersection
);
}
/*
* Copyright 2004-2013 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
index
;
import
org.h2.result.SearchRow
;
import
org.h2.table.TableFilter
;
/**
* A spatial index. Spatial indexes are used to speed up searching
* spatial/geometric data.
*/
public
interface
SpatialIndex
extends
Index
{
/**
* Find a row or a list of rows and create a cursor to iterate over the
* result.
*
* @param filter the table filter (which possibly knows about additional
* conditions)
* @param intersection the geometry which values should intersect with, or
* null for anything
* @return the cursor to iterate over the results
*/
Cursor
findByGeometry
(
TableFilter
filter
,
SearchRow
intersection
);
}
h2/src/main/org/h2/index/SpatialTreeIndex.java
浏览文件 @
a75bf79a
...
...
@@ -74,7 +74,7 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
root
.
insert
(
getEnvelope
(
row
),
row
);
rowCount
++;
}
private
Envelope
getEnvelope
(
SearchRow
row
)
{
Value
v
=
row
.
getValue
(
columnIds
[
0
]);
Geometry
g
=
((
ValueGeometry
)
v
).
getGeometry
();
...
...
@@ -104,20 +104,21 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
@SuppressWarnings
(
"unchecked"
)
private
Cursor
find
()
{
// FIXME: ideally I need external iterators, but let's see if we can get
// it working first
// FIXME: in the context of a spatial index, a query that uses ">" or "<" has no real meaning, so for now just ignore
// TODO use an external iterator,
// but let's see if we can get it working first
// TODO in the context of a spatial index,
// a query that uses ">" or "<" has no real meaning, so for now just ignore
// it and return all rows
java
.
util
.
List
<
Row
>
list
=
root
.
queryAll
();
return
new
ListCursor
(
list
,
true
/*first*/
);
List
<
Row
>
list
=
root
.
queryAll
();
return
new
ListCursor
(
list
,
true
/*first*/
);
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
Cursor
findByGeometry
(
TableFilter
filter
,
SearchRow
intersection
)
{
//
FIXME: ideally I need external iterators, but let's see if we can get
// it working first
java
.
util
.
List
<
Row
>
list
;
//
TODO use an external iterator,
//
but let's see if we can get
it working first
List
<
Row
>
list
;
if
(
intersection
!=
null
)
{
list
=
root
.
query
(
getEnvelope
(
intersection
));
}
else
{
...
...
@@ -163,11 +164,11 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
throw
DbException
.
throwInternalError
();
}
//
FIXME: ideally I need external iterators, but let's see if we can get
// it working first
//
TODO use an external iterator,
//
but let's see if we can get
it working first
@SuppressWarnings
(
"unchecked"
)
List
<
Row
>
list
=
root
.
queryAll
();
return
new
ListCursor
(
list
,
first
);
}
...
...
@@ -186,6 +187,9 @@ public class SpatialTreeIndex extends BaseIndex implements SpatialIndex {
return
0
;
}
/**
* A cursor of a fixed list of rows.
*/
private
static
final
class
ListCursor
implements
Cursor
{
private
final
List
<
Row
>
rows
;
private
int
index
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论