Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
10ce4998
提交
10ce4998
authored
2月 12, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add IndexColumn.writeColumns()
上级
15609e26
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
137 行增加
和
123 行删除
+137
-123
ConstraintReferential.java
h2/src/main/org/h2/constraint/ConstraintReferential.java
+80
-105
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+1
-7
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+2
-1
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+2
-1
SortOrder.java
h2/src/main/org/h2/result/SortOrder.java
+1
-1
IndexColumn.java
h2/src/main/org/h2/table/IndexColumn.java
+51
-8
没有找到文件。
h2/src/main/org/h2/constraint/ConstraintReferential.java
浏览文件 @
10ce4998
差异被折叠。
点击展开。
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
10ce4998
...
@@ -21,7 +21,6 @@ import org.h2.table.Column;
...
@@ -21,7 +21,6 @@ import org.h2.table.Column;
import
org.h2.table.IndexColumn
;
import
org.h2.table.IndexColumn
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableFilter
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
...
@@ -412,12 +411,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
...
@@ -412,12 +411,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
* @return the list of columns
* @return the list of columns
*/
*/
private
String
getColumnListSQL
()
{
private
String
getColumnListSQL
()
{
StatementBuilder
buff
=
new
StatementBuilder
();
return
IndexColumn
.
writeColumns
(
new
StringBuilder
(),
indexColumns
).
toString
();
for
(
IndexColumn
c
:
indexColumns
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
c
.
getSQL
());
}
return
buff
.
toString
();
}
}
@Override
@Override
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
10ce4998
...
@@ -142,7 +142,8 @@ public class PageDataIndex extends PageIndex {
...
@@ -142,7 +142,8 @@ public class PageDataIndex extends PageIndex {
StringBuilder
builder
=
new
StringBuilder
(
"PRIMARY KEY ON "
);
StringBuilder
builder
=
new
StringBuilder
(
"PRIMARY KEY ON "
);
table
.
getSQL
(
builder
);
table
.
getSQL
(
builder
);
if
(
mainIndexColumn
>=
0
&&
mainIndexColumn
<
indexColumns
.
length
)
{
if
(
mainIndexColumn
>=
0
&&
mainIndexColumn
<
indexColumns
.
length
)
{
builder
.
append
(
'('
).
append
(
indexColumns
[
mainIndexColumn
].
getSQL
()).
append
(
')'
);
builder
.
append
(
'('
);
indexColumns
[
mainIndexColumn
].
getSQL
(
builder
).
append
(
')'
);
}
}
DbException
e
=
DbException
.
get
(
ErrorCode
.
DUPLICATE_KEY_1
,
builder
.
toString
());
DbException
e
=
DbException
.
get
(
ErrorCode
.
DUPLICATE_KEY_1
,
builder
.
toString
());
e
.
setSource
(
this
);
e
.
setSource
(
this
);
...
...
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
10ce4998
...
@@ -119,7 +119,8 @@ public class MVPrimaryIndex extends BaseIndex {
...
@@ -119,7 +119,8 @@ public class MVPrimaryIndex extends BaseIndex {
StringBuilder
builder
=
new
StringBuilder
(
"PRIMARY KEY ON "
);
StringBuilder
builder
=
new
StringBuilder
(
"PRIMARY KEY ON "
);
table
.
getSQL
(
builder
);
table
.
getSQL
(
builder
);
if
(
mainIndexColumn
>=
0
&&
mainIndexColumn
<
indexColumns
.
length
)
{
if
(
mainIndexColumn
>=
0
&&
mainIndexColumn
<
indexColumns
.
length
)
{
builder
.
append
(
'('
).
append
(
indexColumns
[
mainIndexColumn
].
getSQL
()).
append
(
')'
);
builder
.
append
(
'('
);
indexColumns
[
mainIndexColumn
].
getSQL
(
builder
).
append
(
')'
);
}
}
int
errorCode
=
ErrorCode
.
CONCURRENT_UPDATE_1
;
int
errorCode
=
ErrorCode
.
CONCURRENT_UPDATE_1
;
if
(
map
.
get
(
key
)
!=
null
)
{
if
(
map
.
get
(
key
)
!=
null
)
{
...
...
h2/src/main/org/h2/result/SortOrder.java
浏览文件 @
10ce4998
...
@@ -136,7 +136,7 @@ public class SortOrder implements Comparator<Value[]> {
...
@@ -136,7 +136,7 @@ public class SortOrder implements Comparator<Value[]> {
/**
/**
* Appends type information (DESC, NULLS FIRST, NULLS LAST) to the specified statement builder.
* Appends type information (DESC, NULLS FIRST, NULLS LAST) to the specified statement builder.
* @param builder st
atement
builder
* @param builder st
ring
builder
* @param type sort type
* @param type sort type
*/
*/
public
static
void
typeToString
(
StringBuilder
builder
,
int
type
)
{
public
static
void
typeToString
(
StringBuilder
builder
,
int
type
)
{
...
...
h2/src/main/org/h2/table/IndexColumn.java
浏览文件 @
10ce4998
...
@@ -30,15 +30,58 @@ public class IndexColumn {
...
@@ -30,15 +30,58 @@ public class IndexColumn {
public
int
sortType
=
SortOrder
.
ASCENDING
;
public
int
sortType
=
SortOrder
.
ASCENDING
;
/**
/**
*
Get the SQL snippet for this index column
.
*
Appends the specified columns to the specified builder
.
*
*
* @return the SQL snippet
* @param builder
* string builder
* @param columns
* index columns
* @return the specified string builder
*/
*/
public
String
getSQL
()
{
public
static
StringBuilder
writeColumns
(
StringBuilder
builder
,
IndexColumn
[]
columns
)
{
StringBuilder
builder
=
new
StringBuilder
();
for
(
int
i
=
0
,
l
=
columns
.
length
;
i
<
l
;
i
++)
{
column
.
getSQL
(
builder
);
if
(
i
>
0
)
{
SortOrder
.
typeToString
(
builder
,
sortType
);
builder
.
append
(
", "
);
return
builder
.
toString
();
}
columns
[
i
].
getSQL
(
builder
);
}
return
builder
;
}
/**
* Appends the specified columns to the specified builder.
*
* @param builder
* string builder
* @param columns
* index columns
* @param separator
* separator
* @param suffix
* additional SQL to append after each column
* @return the specified string builder
*/
public
static
StringBuilder
writeColumns
(
StringBuilder
builder
,
IndexColumn
[]
columns
,
String
separator
,
String
suffix
)
{
for
(
int
i
=
0
,
l
=
columns
.
length
;
i
<
l
;
i
++)
{
if
(
i
>
0
)
{
builder
.
append
(
separator
);
}
columns
[
i
].
getSQL
(
builder
).
append
(
suffix
);
}
return
builder
;
}
/**
* Appends the SQL snippet for this index column to the specified string builder.
*
* @param builder
* string builder
* @return the specified string builder
*/
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
SortOrder
.
typeToString
(
column
.
getSQL
(
builder
),
sortType
);
return
builder
;
}
}
/**
/**
...
@@ -71,6 +114,6 @@ public class IndexColumn {
...
@@ -71,6 +114,6 @@ public class IndexColumn {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"IndexColumn "
+
getSQL
();
return
getSQL
(
new
StringBuilder
(
"IndexColumn "
)).
toString
();
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论