Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
83a21918
提交
83a21918
authored
1月 09, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
encrypted script files of earlier versions could not be processed.
上级
011a7674
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
40 行增加
和
10 行删除
+40
-10
Constants.java
h2/src/main/org/h2/engine/Constants.java
+6
-5
FileStore.java
h2/src/main/org/h2/store/FileStore.java
+19
-0
FileStoreInputStream.java
h2/src/main/org/h2/store/FileStoreInputStream.java
+15
-5
没有找到文件。
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
83a21918
...
...
@@ -304,6 +304,12 @@ public class Constants {
*/
public
static
final
String
MAGIC_FILE_HEADER
=
"-- H2 0.5/B -- "
.
substring
(
0
,
FILE_BLOCK_SIZE
-
1
)
+
"\n"
;
/**
* If old text file headers should be supported. This setting can be removed
* in future versions (required for compatibility with version 1.1.103).
*/
public
static
final
boolean
MAGIC_FILE_HEADER_SUPPORT_TEXT
=
true
;
/**
* The name of the in-memory management database used by the TCP server
* to keep the active sessions.
...
...
@@ -455,11 +461,6 @@ public class Constants {
*/
public
static
final
String
SUFFIX_TRACE_FILE
=
".trace.db"
;
/**
* The file name suffix of the signal file that starts trace output.
*/
public
static
final
String
SUFFIX_TRACE_START_FILE
=
".start"
;
/**
* The table name suffix used to create internal temporary tables.
*/
...
...
h2/src/main/org/h2/store/FileStore.java
浏览文件 @
83a21918
...
...
@@ -58,6 +58,7 @@ public class FileStore {
private
boolean
synchronousMode
;
private
String
mode
;
private
TempFileDeleter
tempFileDeleter
;
private
boolean
textMode
;
/**
* Create a new file using the given settings.
...
...
@@ -195,6 +196,12 @@ public class FileStore {
seek
(
0
);
byte
[]
buff
=
new
byte
[
len
];
readFullyDirect
(
buff
,
0
,
len
);
if
(
Constants
.
MAGIC_FILE_HEADER_SUPPORT_TEXT
)
{
if
(
buff
[
10
]
==
'T'
)
{
buff
[
10
]
=
'B'
;
textMode
=
true
;
}
}
if
(
ByteUtils
.
compareNotNull
(
buff
,
magic
)
!=
0
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_VERSION_ERROR_1
,
name
);
}
...
...
@@ -203,6 +210,9 @@ public class FileStore {
initKey
(
salt
);
// read (maybe) encrypted
readFully
(
buff
,
0
,
Constants
.
FILE_BLOCK_SIZE
);
if
(
textMode
)
{
buff
[
10
]
=
'B'
;
}
if
(
ByteUtils
.
compareNotNull
(
buff
,
magic
)
!=
0
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_ENCRYPTION_ERROR_1
,
name
);
}
...
...
@@ -510,4 +520,13 @@ public class FileStore {
}
}
/**
* Check if the file store is in text mode.
*
* @return true if it is
*/
public
boolean
isTextMode
()
{
return
textMode
;
}
}
h2/src/main/org/h2/store/FileStoreInputStream.java
浏览文件 @
83a21918
...
...
@@ -98,7 +98,7 @@ public class FileStoreInputStream extends InputStream {
throw
Message
.
convertToIOException
(
e
);
}
page
.
reset
();
remainingInBuffer
=
page
.
readInt
();
remainingInBuffer
=
readInt
();
if
(
remainingInBuffer
<
0
)
{
close
();
return
;
...
...
@@ -107,19 +107,19 @@ public class FileStoreInputStream extends InputStream {
// get the length to read
if
(
compress
!=
null
)
{
page
.
checkCapacity
(
DataPage
.
LENGTH_INT
);
page
.
readInt
();
readInt
();
}
page
.
setPos
(
page
.
length
()
+
remainingInBuffer
);
page
.
fillAligned
();
int
len
=
page
.
length
()
-
Constants
.
FILE_BLOCK_SIZE
;
page
.
reset
();
page
.
readInt
();
readInt
();
try
{
store
.
readFully
(
page
.
getBytes
(),
Constants
.
FILE_BLOCK_SIZE
,
len
);
page
.
reset
();
page
.
readInt
();
readInt
();
if
(
compress
!=
null
)
{
int
uncompressed
=
page
.
readInt
();
int
uncompressed
=
readInt
();
byte
[]
buff
=
ByteUtils
.
newBytes
(
remainingInBuffer
);
page
.
read
(
buff
,
0
,
remainingInBuffer
);
page
.
reset
();
...
...
@@ -167,4 +167,14 @@ public class FileStoreInputStream extends InputStream {
return
i
;
}
public
int
readInt
()
{
if
(
store
.
isTextMode
())
{
byte
[]
buff
=
new
byte
[
8
];
page
.
read
(
buff
,
0
,
8
);
String
s
=
new
String
(
buff
);
return
Integer
.
parseInt
(
s
,
16
);
}
return
page
.
readInt
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论