Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
48e87d3b
提交
48e87d3b
authored
12 年前
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify code - reduce some catching and rethrowing
上级
c82c7ab6
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
86 行增加
和
102 行删除
+86
-102
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+49
-53
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+37
-49
没有找到文件。
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
48e87d3b
...
@@ -197,8 +197,7 @@ public class ValueLob extends Value {
...
@@ -197,8 +197,7 @@ public class ValueLob extends Value {
return
(
int
)
m
;
return
(
int
)
m
;
}
}
private
void
createFromReader
(
char
[]
buff
,
int
len
,
Reader
in
,
long
remaining
,
DataHandler
h
)
{
private
void
createFromReader
(
char
[]
buff
,
int
len
,
Reader
in
,
long
remaining
,
DataHandler
h
)
throws
IOException
{
try
{
FileStoreOutputStream
out
=
initLarge
(
h
);
FileStoreOutputStream
out
=
initLarge
(
h
);
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
Value
.
CLOB
)
!=
null
;
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
Value
.
CLOB
)
!=
null
;
try
{
try
{
...
@@ -219,9 +218,6 @@ public class ValueLob extends Value {
...
@@ -219,9 +218,6 @@ public class ValueLob extends Value {
}
finally
{
}
finally
{
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
}
private
static
String
getFileNamePrefix
(
String
path
,
int
objectId
)
{
private
static
String
getFileNamePrefix
(
String
path
,
int
objectId
)
{
...
@@ -400,8 +396,7 @@ public class ValueLob extends Value {
...
@@ -400,8 +396,7 @@ public class ValueLob extends Value {
return
out
;
return
out
;
}
}
private
void
createFromStream
(
byte
[]
buff
,
int
len
,
InputStream
in
,
long
remaining
,
DataHandler
h
)
{
private
void
createFromStream
(
byte
[]
buff
,
int
len
,
InputStream
in
,
long
remaining
,
DataHandler
h
)
throws
IOException
{
try
{
FileStoreOutputStream
out
=
initLarge
(
h
);
FileStoreOutputStream
out
=
initLarge
(
h
);
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
Value
.
BLOB
)
!=
null
;
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
Value
.
BLOB
)
!=
null
;
try
{
try
{
...
@@ -421,9 +416,6 @@ public class ValueLob extends Value {
...
@@ -421,9 +416,6 @@ public class ValueLob extends Value {
}
finally
{
}
finally
{
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
}
/**
/**
...
@@ -692,6 +684,7 @@ public class ValueLob extends Value {
...
@@ -692,6 +684,7 @@ public class ValueLob extends Value {
* @param h the data handler
* @param h the data handler
*/
*/
public
void
convertToFileIfRequired
(
DataHandler
h
)
{
public
void
convertToFileIfRequired
(
DataHandler
h
)
{
try
{
if
(
small
!=
null
&&
small
.
length
>
h
.
getMaxLengthInplaceLob
())
{
if
(
small
!=
null
&&
small
.
length
>
h
.
getMaxLengthInplaceLob
())
{
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
type
)
!=
null
;
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
type
)
!=
null
;
int
len
=
getBufferSize
(
h
,
compress
,
Long
.
MAX_VALUE
);
int
len
=
getBufferSize
(
h
,
compress
,
Long
.
MAX_VALUE
);
...
@@ -706,6 +699,9 @@ public class ValueLob extends Value {
...
@@ -706,6 +699,9 @@ public class ValueLob extends Value {
DbException
.
throwInternalError
();
DbException
.
throwInternalError
();
}
}
}
}
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
48e87d3b
...
@@ -456,8 +456,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
...
@@ -456,8 +456,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
}
}
}
}
private
void
createTempFromReader
(
char
[]
buff
,
int
len
,
Reader
in
,
long
remaining
,
DataHandler
h
)
{
private
void
createTempFromReader
(
char
[]
buff
,
int
len
,
Reader
in
,
long
remaining
,
DataHandler
h
)
throws
IOException
{
try
{
FileStoreOutputStream
out
=
initTemp
(
h
);
FileStoreOutputStream
out
=
initTemp
(
h
);
try
{
try
{
while
(
true
)
{
while
(
true
)
{
...
@@ -477,13 +476,9 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
...
@@ -477,13 +476,9 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
}
finally
{
}
finally
{
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
}
private
void
createTempFromStream
(
byte
[]
buff
,
int
len
,
InputStream
in
,
long
remaining
,
DataHandler
h
)
{
private
void
createTempFromStream
(
byte
[]
buff
,
int
len
,
InputStream
in
,
long
remaining
,
DataHandler
h
)
throws
IOException
{
try
{
FileStoreOutputStream
out
=
initTemp
(
h
);
FileStoreOutputStream
out
=
initTemp
(
h
);
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
Value
.
BLOB
)
!=
null
;
boolean
compress
=
h
.
getLobCompressionAlgorithm
(
Value
.
BLOB
)
!=
null
;
try
{
try
{
...
@@ -503,25 +498,18 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
...
@@ -503,25 +498,18 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
}
finally
{
}
finally
{
out
.
close
();
out
.
close
();
}
}
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
}
private
FileStoreOutputStream
initTemp
(
DataHandler
h
)
{
private
FileStoreOutputStream
initTemp
(
DataHandler
h
)
throws
IOException
{
this
.
precision
=
0
;
this
.
precision
=
0
;
this
.
handler
=
h
;
this
.
handler
=
h
;
this
.
lobStorage
=
h
.
getLobStorage
();
this
.
lobStorage
=
h
.
getLobStorage
();
this
.
small
=
null
;
this
.
small
=
null
;
try
{
String
path
=
h
.
getDatabasePath
();
String
path
=
h
.
getDatabasePath
();
if
(
path
.
length
()
==
0
)
{
if
(
path
.
length
()
==
0
)
{
path
=
SysProperties
.
PREFIX_TEMP_FILE
;
path
=
SysProperties
.
PREFIX_TEMP_FILE
;
}
}
fileName
=
FileUtils
.
createTempFile
(
path
,
Constants
.
SUFFIX_TEMP_FILE
,
true
,
true
);
fileName
=
FileUtils
.
createTempFile
(
path
,
Constants
.
SUFFIX_TEMP_FILE
,
true
,
true
);
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
}
tempFile
=
h
.
openFile
(
fileName
,
"rw"
,
false
);
tempFile
=
h
.
openFile
(
fileName
,
"rw"
,
false
);
tempFile
.
autoDelete
();
tempFile
.
autoDelete
();
FileStoreOutputStream
out
=
new
FileStoreOutputStream
(
tempFile
,
null
,
null
);
FileStoreOutputStream
out
=
new
FileStoreOutputStream
(
tempFile
,
null
,
null
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论