Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e574982a
提交
e574982a
authored
8 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prevent people using unsupported combination of auto-increment columns and clustering mode.
上级
c6584ac2
master
noel-pr1
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
20 行增加
和
1 行删除
+20
-1
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+12
-0
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+6
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
e574982a
...
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
Prevent people using unsupported combination of auto-increment columns and clustering mode.
</li>
<li>
Support for DB2 time format, patch by Niklas Mehner
</li>
<li>
Added support for Connection.setClientInfo() in compatibility modes for DB2, Postgresql, Oracle and MySQL.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
e574982a
...
...
@@ -14,6 +14,7 @@ import org.h2.command.Parser;
import
org.h2.command.Prepared
;
import
org.h2.constraint.Constraint
;
import
org.h2.constraint.ConstraintReferential
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Database
;
import
org.h2.engine.DbObject
;
import
org.h2.engine.Right
;
...
...
@@ -88,10 +89,12 @@ public class AlterTableAlterColumn extends SchemaCommand {
table
.
lock
(
session
,
true
,
true
);
if
(
newColumn
!=
null
)
{
checkDefaultReferencesTable
(
newColumn
.
getDefaultExpression
());
checkClustering
(
newColumn
);
}
if
(
columnsToAdd
!=
null
)
{
for
(
Column
column
:
columnsToAdd
)
{
checkDefaultReferencesTable
(
column
.
getDefaultExpression
());
checkClustering
(
column
);
}
}
switch
(
type
)
{
...
...
@@ -197,6 +200,15 @@ public class AlterTableAlterColumn extends SchemaCommand {
}
}
private
void
checkClustering
(
Column
c
)
{
if
(!
Constants
.
CLUSTERING_DISABLED
.
equals
(
session
.
getDatabase
().
getCluster
())
&&
c
.
isAutoIncrement
())
{
throw
DbException
.
getUnsupportedException
(
"CLUSTERING && auto-increment columns"
);
}
}
private
void
convertAutoIncrementColumn
(
Column
c
)
{
if
(
c
.
isAutoIncrement
())
{
if
(
c
.
isPrimaryKey
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
e574982a
...
...
@@ -7,11 +7,11 @@ package org.h2.command.ddl;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.dml.Insert
;
import
org.h2.command.dml.Query
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Database
;
import
org.h2.engine.DbObject
;
import
org.h2.engine.Session
;
...
...
@@ -140,6 +140,11 @@ public class CreateTable extends SchemaCommand {
if
(
c
.
isAutoIncrement
())
{
int
objId
=
getObjectId
();
c
.
convertAutoIncrementToSequence
(
session
,
getSchema
(),
objId
,
data
.
temporary
);
if
(!
Constants
.
CLUSTERING_DISABLED
.
equals
(
session
.
getDatabase
().
getCluster
()))
{
throw
DbException
.
getUnsupportedException
(
"CLUSTERING && auto-increment columns"
);
}
}
Sequence
seq
=
c
.
getSequence
();
if
(
seq
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论