Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
bf43f380
提交
bf43f380
authored
11 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting.
上级
126fd829
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
24 行增加
和
23 行删除
+24
-23
FilePathDisk.java
h2/src/main/org/h2/store/fs/FilePathDisk.java
+1
-1
FilePathEncrypt.java
h2/src/main/org/h2/store/fs/FilePathEncrypt.java
+2
-2
Recover.java
h2/src/main/org/h2/tools/Recover.java
+10
-10
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+4
-3
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+5
-5
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+1
-1
TestSequence.java
h2/src/test/org/h2/test/db/TestSequence.java
+1
-1
没有找到文件。
h2/src/main/org/h2/store/fs/FilePathDisk.java
浏览文件 @
bf43f380
...
...
@@ -251,7 +251,7 @@ public class FilePathDisk extends FilePath {
if
(
dir
.
isDirectory
())
{
return
;
}
throw
DbException
.
get
(
ErrorCode
.
FILE_CREATION_FAILED_1
,
throw
DbException
.
get
(
ErrorCode
.
FILE_CREATION_FAILED_1
,
name
+
" (a file with this name already exists)"
);
}
else
if
(
dir
.
mkdir
())
{
return
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FilePathEncrypt.java
浏览文件 @
bf43f380
...
...
@@ -168,7 +168,7 @@ public class FilePathEncrypt extends FilePathWrapper {
private
long
size
;
private
final
String
name
;
private
XTS
xts
;
private
byte
[]
encryptionKey
;
...
...
@@ -181,7 +181,7 @@ public class FilePathEncrypt extends FilePathWrapper {
this
.
base
=
base
;
this
.
encryptionKey
=
encryptionKey
;
}
private
void
init
()
throws
IOException
{
if
(
xts
!=
null
)
{
return
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
bf43f380
...
...
@@ -228,18 +228,18 @@ public class Recover extends Tool implements DataHandler {
*/
public
static
InputStream
readBlobMap
(
Connection
conn
,
long
lobId
,
long
precision
)
throws
SQLException
{
final
PreparedStatement
prep
=
conn
.
prepareStatement
(
"SELECT DATA FROM INFORMATION_SCHEMA.LOB_BLOCKS "
+
"SELECT DATA FROM INFORMATION_SCHEMA.LOB_BLOCKS "
+
"WHERE LOB_ID = ? AND SEQ = ? AND ? > 0"
);
prep
.
setLong
(
1
,
lobId
);
// precision is currently not really used,
// precision is currently not really used,
// it is just to improve readability of the script
prep
.
setLong
(
3
,
precision
);
return
new
SequenceInputStream
(
new
Enumeration
<
InputStream
>()
{
private
int
seq
;
private
byte
[]
data
=
fetch
();
private
byte
[]
fetch
()
{
try
{
prep
.
setInt
(
2
,
seq
++);
...
...
@@ -252,7 +252,7 @@ public class Recover extends Tool implements DataHandler {
throw
DbException
.
convert
(
e
);
}
}
@Override
public
boolean
hasMoreElements
()
{
return
data
!=
null
;
...
...
@@ -559,7 +559,7 @@ public class Recover extends Tool implements DataHandler {
setDatabaseName
(
fileName
.
substring
(
0
,
fileName
.
length
()
-
Constants
.
SUFFIX_MV_FILE
.
length
()));
MVStore
mv
=
new
MVStore
.
Builder
().
fileName
(
fileName
).
readOnly
().
open
();
dumpLobMaps
(
writer
,
mv
);
writer
.
println
(
"-- Tables"
);
writer
.
println
(
"-- Tables"
);
TransactionStore
store
=
new
TransactionStore
(
mv
);
try
{
for
(
String
mapName
:
mv
.
getMapNames
())
{
...
...
@@ -627,7 +627,7 @@ public class Recover extends Tool implements DataHandler {
mv
.
close
();
}
}
private
void
dumpLobMaps
(
PrintWriter
writer
,
MVStore
mv
)
{
lobMaps
=
mv
.
hasMap
(
"lobData"
);
if
(!
lobMaps
)
{
...
...
@@ -637,8 +637,8 @@ public class Recover extends Tool implements DataHandler {
StreamStore
streamStore
=
new
StreamStore
(
lobData
);
MVMap
<
Long
,
Object
[]>
lobMap
=
mv
.
openMap
(
"lobMap"
);
writer
.
println
(
"-- LOB"
);
writer
.
println
(
"CREATE TABLE IF NOT EXISTS "
+
"INFORMATION_SCHEMA.LOB_BLOCKS("
+
writer
.
println
(
"CREATE TABLE IF NOT EXISTS "
+
"INFORMATION_SCHEMA.LOB_BLOCKS("
+
"LOB_ID BIGINT, SEQ INT, DATA BINARY);"
);
for
(
Entry
<
Long
,
Object
[]>
e
:
lobMap
.
entrySet
())
{
long
lobId
=
e
.
getKey
();
...
...
@@ -652,7 +652,7 @@ public class Recover extends Tool implements DataHandler {
int
l
=
IOUtils
.
readFully
(
in
,
block
,
block
.
length
);
String
x
=
StringUtils
.
convertBytesToHex
(
block
,
l
);
if
(
l
>
0
)
{
writer
.
println
(
"INSERT INTO INFORMATION_SCHEMA.LOB_BLOCKS "
+
writer
.
println
(
"INSERT INTO INFORMATION_SCHEMA.LOB_BLOCKS "
+
"VALUES("
+
lobId
+
", "
+
seq
+
", '"
+
x
+
"');"
);
}
if
(
l
!=
len
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
bf43f380
...
...
@@ -32,7 +32,7 @@ import org.h2.util.Utils;
/**
* A implementation of the BLOB and CLOB data types.
*
*
* Small objects are kept in memory and stored in the record.
* Large objects are either stored in the database, or in temporary files.
*/
...
...
@@ -561,7 +561,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
int
inplace
=
handler
.
getMaxLengthInplaceLob
();
long
m
=
compress
?
Constants
.
IO_BUFFER_SIZE_COMPRESS
:
Constants
.
IO_BUFFER_SIZE
;
if
(
m
<
remaining
&&
m
<=
inplace
)
{
// using "1L" to force long arithmetic because inplace could be Integer.MAX_VALUE
// using "1L" to force long arithmetic because
// inplace could be Integer.MAX_VALUE
m
=
Math
.
min
(
remaining
,
inplace
+
1L
);
// the buffer size must be bigger than the inplace lob, otherwise we can't
// know if it must be stored in-place or not
...
...
@@ -626,7 +627,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
}
return
createSmallLob
(
type
,
small
,
precision
);
}
/**
* Create a LOB object that fits in memory.
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
bf43f380
...
...
@@ -1500,12 +1500,12 @@ public abstract class TestBase {
throw
new
RuntimeException
(
e
);
}
}
/**
* Construct a stream of 20 KB that fails while reading with the provided
* exception.
*
*
* @param e the exception
* @return the stream
*/
...
...
@@ -1524,13 +1524,13 @@ public abstract class TestBase {
/**
* Throw a checked exception, without having to declare the method as
* throwing a checked exception.
*
*
* @param e the exception to throw
*/
public
static
void
throwException
(
Throwable
e
)
{
TestBase
.<
RuntimeException
>
throwThis
(
e
);
}
@SuppressWarnings
(
"unchecked"
)
private
static
<
E
extends
Throwable
>
void
throwThis
(
Throwable
e
)
throws
E
{
throw
(
E
)
e
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
bf43f380
...
...
@@ -743,7 +743,7 @@ public class TestLob extends TestBase {
int
rows
=
0
;
Savepoint
sp
=
null
;
int
len
=
getSize
(
100
,
400
);
// config.traceTest = true;
// config.traceTest = true;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
switch
(
random
.
nextInt
(
10
))
{
case
0
:
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSequence.java
浏览文件 @
bf43f380
...
...
@@ -262,7 +262,7 @@ public class TestSequence extends TestBase {
stat
.
execute
(
"create sequence b START WITH 7320917853639540658 INCREMENT -1"
);
conn
.
close
();
}
private
void
testTwo
()
throws
SQLException
{
deleteDb
(
"sequence"
);
Connection
conn
=
getConnection
(
"sequence"
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论