Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cb4c607a
提交
cb4c607a
authored
15 年前
作者:
christian.peter.io
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Drop table did not delete lob files in old file store (not PAGE_STORE).
上级
26ff584f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
37 行增加
和
2 行删除
+37
-2
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
DropTable.java
h2/src/main/org/h2/command/ddl/DropTable.java
+6
-1
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+30
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
cb4c607a
...
...
@@ -53,6 +53,7 @@ Change Log
</li><li>
The database is now closed after an out of memory exception, because
the database could get corrupt otherwise.
</li><li>
Better error message if both AUTO_SERVER and SERIALIZED parameters are set to TRUE.
</li><li>
Drop table did not delete lob files in old file store (not PAGE_STORE).
</li></ul>
<h2>
Version 1.2.124 (2009-11-20)
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/DropTable.java
浏览文件 @
cb4c607a
...
...
@@ -15,6 +15,7 @@ import org.h2.engine.Session;
import
org.h2.message.Message
;
import
org.h2.schema.Schema
;
import
org.h2.table.Table
;
import
org.h2.value.ValueLob
;
/**
* This class represents the statement
...
...
@@ -26,6 +27,7 @@ public class DropTable extends SchemaCommand {
private
String
tableName
;
private
Table
table
;
private
DropTable
next
;
private
int
dropTableId
;
public
DropTable
(
Session
session
,
Schema
schema
)
{
super
(
session
,
schema
);
...
...
@@ -62,6 +64,7 @@ public class DropTable extends SchemaCommand {
throw
Message
.
getSQLException
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
tableName
);
}
}
else
{
dropTableId
=
table
.
getId
();
session
.
getUser
().
checkRight
(
table
,
Right
.
ALL
);
if
(!
table
.
canDrop
())
{
throw
Message
.
getSQLException
(
ErrorCode
.
CANNOT_DROP_TABLE_1
,
tableName
);
...
...
@@ -77,10 +80,12 @@ public class DropTable extends SchemaCommand {
// need to get the table again, because it may be dropped already
// meanwhile (dependent object, or same object)
table
=
getSchema
().
findTableOrView
(
session
,
tableName
);
if
(
table
!=
null
)
{
table
.
setModified
();
Database
db
=
session
.
getDatabase
();
db
.
removeSchemaObject
(
session
,
table
);
ValueLob
.
removeAllForTable
(
db
,
dropTableId
);
}
if
(
next
!=
null
)
{
next
.
executeDrop
();
...
...
@@ -94,4 +99,4 @@ public class DropTable extends SchemaCommand {
return
0
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
cb4c607a
...
...
@@ -49,6 +49,8 @@ public class TestCases extends TestBase {
if
(
config
.
memory
||
config
.
logMode
==
0
)
{
return
;
}
testDeleteAndDropTableWithLobs
(
true
);
testDeleteAndDropTableWithLobs
(
false
);
testEmptyBtreeIndex
();
testReservedKeywordReconnect
();
testSpecialSQL
();
...
...
@@ -907,4 +909,31 @@ public class TestCases extends TestBase {
conn
.
close
();
}
}
private
void
testDeleteAndDropTableWithLobs
(
boolean
useDrop
)
throws
SQLException
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TEST(id int, content BLOB)"
);
stat
.
execute
(
"set MAX_LENGTH_INPLACE_LOB 1"
);
PreparedStatement
prepared
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(?, ?)"
);
byte
[]
blobContent
=
"BLOB_CONTENT"
.
getBytes
();
prepared
.
setInt
(
1
,
1
);
prepared
.
setBytes
(
2
,
blobContent
);
prepared
.
execute
();
if
(
useDrop
)
{
stat
.
execute
(
"DROP TABLE TEST"
);
}
else
{
stat
.
execute
(
"DELETE FROM TEST"
);
}
conn
.
close
();
File
[]
files
=
new
File
(
baseDir
+
"/cases.lobs.db"
).
listFiles
();
if
(
files
!=
null
&&
files
.
length
>
0
)
{
fail
(
"Lob file was not deleted"
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论