Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9e7f4dfe
提交
9e7f4dfe
authored
7月 27, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The command line tools now say so if the source directory of an option doesn't exist.
上级
2b6a376e
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
32 行增加
和
15 行删除
+32
-15
BackupCommand.java
h2/src/main/org/h2/command/dml/BackupCommand.java
+1
-0
FileLister.java
h2/src/main/org/h2/store/FileLister.java
+15
-6
Backup.java
h2/src/main/org/h2/tools/Backup.java
+3
-3
ChangeFileEncryption.java
h2/src/main/org/h2/tools/ChangeFileEncryption.java
+1
-0
DeleteDbFiles.java
h2/src/main/org/h2/tools/DeleteDbFiles.java
+1
-1
Tool.java
h2/src/main/org/h2/util/Tool.java
+11
-5
没有找到文件。
h2/src/main/org/h2/command/dml/BackupCommand.java
浏览文件 @
9e7f4dfe
...
...
@@ -67,6 +67,7 @@ public class BackupCommand extends Prepared {
synchronized
(
db
.
getLobSyncObject
())
{
String
prefix
=
db
.
getDatabasePath
();
String
dir
=
IOUtils
.
getParent
(
prefix
);
dir
=
FileLister
.
getDir
(
dir
);
ArrayList
<
String
>
fileList
=
FileLister
.
getDatabaseFiles
(
dir
,
name
,
true
);
for
(
String
n
:
fileList
)
{
if
(
n
.
endsWith
(
Constants
.
SUFFIX_LOB_FILE
))
{
...
...
h2/src/main/org/h2/store/FileLister.java
浏览文件 @
9e7f4dfe
...
...
@@ -62,9 +62,22 @@ public class FileLister {
}
/**
*
Get the list of database files
.
*
Normalize the directory name
.
*
* @param dir the directory (null for the current directory)
* @return the normalized directory name
*/
public
static
String
getDir
(
String
dir
)
{
if
(
dir
==
null
||
dir
.
equals
(
""
))
{
return
"."
;
}
return
IOUtils
.
normalize
(
dir
);
}
/**
* Get the list of database files.
*
* @param dir the directory (must be normalized)
* @param db the database name (null for all databases)
* @param all if true, files such as the lock, trace, and lob
* files are included. If false, only data, index, log,
...
...
@@ -72,10 +85,6 @@ public class FileLister {
* @return the list of files
*/
public
static
ArrayList
<
String
>
getDatabaseFiles
(
String
dir
,
String
db
,
boolean
all
)
{
if
(
dir
==
null
||
dir
.
equals
(
""
))
{
dir
=
"."
;
}
dir
=
IOUtils
.
normalize
(
dir
);
ArrayList
<
String
>
files
=
New
.
arrayList
();
String
start
=
db
==
null
?
null
:
IOUtils
.
normalize
(
dir
+
"/"
+
db
);
String
[]
list
=
IOUtils
.
listFiles
(
dir
);
...
...
h2/src/main/org/h2/tools/Backup.java
浏览文件 @
9e7f4dfe
...
...
@@ -105,15 +105,15 @@ public class Backup extends Tool {
private
void
process
(
String
zipFileName
,
String
directory
,
String
db
,
boolean
quiet
)
throws
SQLException
{
ArrayList
<
String
>
list
=
FileLister
.
getDatabaseFiles
(
directory
,
db
,
true
);
if
(!
quiet
)
{
FileLister
.
tryUnlockDatabase
(
list
,
"backup"
);
}
if
(
list
.
size
()
==
0
)
{
if
(!
quiet
)
{
printNoDatabaseFilesFound
(
directory
,
db
);
}
return
;
}
if
(!
quiet
)
{
FileLister
.
tryUnlockDatabase
(
list
,
"backup"
);
}
zipFileName
=
IOUtils
.
normalize
(
zipFileName
);
if
(
IOUtils
.
exists
(
zipFileName
))
{
IOUtils
.
delete
(
zipFileName
);
...
...
h2/src/main/org/h2/tools/ChangeFileEncryption.java
浏览文件 @
9e7f4dfe
...
...
@@ -131,6 +131,7 @@ public class ChangeFileEncryption extends Tool {
}
private
void
process
(
String
dir
,
String
db
,
String
cipher
,
char
[]
decryptPassword
,
char
[]
encryptPassword
,
boolean
quiet
)
throws
SQLException
{
dir
=
FileLister
.
getDir
(
dir
);
ChangeFileEncryption
change
=
new
ChangeFileEncryption
();
if
(
encryptPassword
!=
null
)
{
for
(
char
c
:
encryptPassword
)
{
...
...
h2/src/main/org/h2/tools/DeleteDbFiles.java
浏览文件 @
9e7f4dfe
...
...
@@ -85,11 +85,11 @@ public class DeleteDbFiles extends Tool {
* @throws SQLException
*/
private
void
process
(
String
dir
,
String
db
,
boolean
quiet
)
throws
SQLException
{
DeleteDbFiles
delete
=
new
DeleteDbFiles
();
ArrayList
<
String
>
files
=
FileLister
.
getDatabaseFiles
(
dir
,
db
,
true
);
if
(
files
.
size
()
==
0
&&
!
quiet
)
{
printNoDatabaseFilesFound
(
dir
,
db
);
}
DeleteDbFiles
delete
=
new
DeleteDbFiles
();
for
(
String
fileName
:
files
)
{
delete
.
process
(
fileName
,
quiet
);
if
(!
quiet
)
{
...
...
h2/src/main/org/h2/util/Tool.java
浏览文件 @
9e7f4dfe
...
...
@@ -11,6 +11,7 @@ import java.io.IOException;
import
java.io.PrintStream
;
import
java.sql.SQLException
;
import
java.util.Properties
;
import
org.h2.store.FileLister
;
/**
* Command line tools implement the tool interface so that they can be used in
...
...
@@ -59,13 +60,18 @@ public abstract class Tool {
* @param db the database name or null
*/
protected
void
printNoDatabaseFilesFound
(
String
dir
,
String
db
)
{
StringBuilder
buff
=
new
StringBuilder
(
"No database files have been found"
);
if
(
dir
!=
null
)
{
StringBuilder
buff
;
dir
=
FileLister
.
getDir
(
dir
);
if
(!
IOUtils
.
isDirectory
(
dir
))
{
buff
=
new
StringBuilder
(
"Directory not found: "
);
buff
.
append
(
dir
);
}
else
{
buff
=
new
StringBuilder
(
"No database files have been found"
);
buff
.
append
(
" in directory "
).
append
(
dir
);
}
if
(
db
!=
null
)
{
buff
.
append
(
" for the database "
).
append
(
db
);
}
}
out
.
println
(
buff
.
toString
());
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论