Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
bdfc4914
提交
bdfc4914
authored
12月 02, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Trying to alter a temporary table threw a strange exception.
上级
50769a54
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
1 行删除
+21
-1
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+3
-0
TestTempTables.java
h2/src/test/org/h2/test/db/TestTempTables.java
+18
-1
没有找到文件。
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
bdfc4914
...
...
@@ -213,6 +213,9 @@ public class AlterTableAlterColumn extends SchemaCommand {
}
private
void
copyData
()
throws
SQLException
{
if
(
table
.
isTemporary
())
{
throw
Message
.
getUnsupportedException
(
"TEMP TABLE"
);
}
Database
db
=
session
.
getDatabase
();
String
tempName
=
db
.
getTempTableName
(
session
.
getId
());
Column
[]
columns
=
table
.
getColumns
();
...
...
h2/src/test/org/h2/test/db/TestTempTables.java
浏览文件 @
bdfc4914
...
...
@@ -10,7 +10,6 @@ import java.sql.Connection;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
/**
...
...
@@ -30,6 +29,7 @@ public class TestTempTables extends TestBase {
public
void
test
()
throws
SQLException
{
deleteDb
(
"tempTables"
);
Connection
c1
=
getConnection
(
"tempTables"
);
testAlter
(
c1
);
Connection
c2
=
getConnection
(
"tempTables"
);
testConstraints
(
c1
,
c2
);
testTables
(
c1
,
c2
);
...
...
@@ -39,6 +39,23 @@ public class TestTempTables extends TestBase {
deleteDb
(
"tempTables"
);
}
private
void
testAlter
(
Connection
conn
)
throws
SQLException
{
Statement
stat
;
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create temporary table test(id varchar)"
);
stat
.
execute
(
"create index idx1 on test(id)"
);
stat
.
execute
(
"drop index idx1"
);
stat
.
execute
(
"create index idx1 on test(id)"
);
stat
.
execute
(
"insert into test select x from system_range(1, 10)"
);
try
{
stat
.
execute
(
"alter table test add column x int"
);
fail
();
}
catch
(
SQLException
e
)
{
assertKnownException
(
e
);
}
stat
.
execute
(
"drop table test"
);
}
private
void
testConstraints
(
Connection
conn1
,
Connection
conn2
)
throws
SQLException
{
Statement
s1
=
conn1
.
createStatement
(),
s2
=
conn2
.
createStatement
();
s1
.
execute
(
"create local temporary table test(id int unique)"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论