Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
11b7e7cd
Unverified
提交
11b7e7cd
authored
6月 24, 2018
作者:
Noel Grandin
提交者:
GitHub
6月 24, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1233 from grandinj/simplify_old_lob
Simplify old lob ValueLob class
上级
10ed1eb9
77e95155
全部展开
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
79 行增加
和
372 行删除
+79
-372
Data.java
h2/src/main/org/h2/store/Data.java
+0
-2
Recover.java
h2/src/main/org/h2/tools/Recover.java
+2
-2
DataType.java
h2/src/main/org/h2/value/DataType.java
+4
-3
Value.java
h2/src/main/org/h2/value/Value.java
+0
-14
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+42
-323
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+28
-26
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+3
-2
没有找到文件。
h2/src/main/org/h2/store/Data.java
浏览文件 @
11b7e7cd
...
@@ -584,7 +584,6 @@ public class Data {
...
@@ -584,7 +584,6 @@ public class Data {
writeByte
((
byte
)
type
);
writeByte
((
byte
)
type
);
if
(
v
instanceof
ValueLob
)
{
if
(
v
instanceof
ValueLob
)
{
ValueLob
lob
=
(
ValueLob
)
v
;
ValueLob
lob
=
(
ValueLob
)
v
;
lob
.
convertToFileIfRequired
(
handler
);
byte
[]
small
=
lob
.
getSmall
();
byte
[]
small
=
lob
.
getSmall
();
if
(
small
==
null
)
{
if
(
small
==
null
)
{
int
t
=
-
1
;
int
t
=
-
1
;
...
@@ -1013,7 +1012,6 @@ public class Data {
...
@@ -1013,7 +1012,6 @@ public class Data {
int
len
=
1
;
int
len
=
1
;
if
(
v
instanceof
ValueLob
)
{
if
(
v
instanceof
ValueLob
)
{
ValueLob
lob
=
(
ValueLob
)
v
;
ValueLob
lob
=
(
ValueLob
)
v
;
lob
.
convertToFileIfRequired
(
handler
);
byte
[]
small
=
lob
.
getSmall
();
byte
[]
small
=
lob
.
getSmall
();
if
(
small
==
null
)
{
if
(
small
==
null
)
{
int
t
=
-
1
;
int
t
=
-
1
;
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
11b7e7cd
...
@@ -214,7 +214,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -214,7 +214,7 @@ public class Recover extends Tool implements DataHandler {
/**
/**
* INTERNAL
* INTERNAL
*/
*/
public
static
Value
.
ValueBlo
b
readBlobDb
(
Connection
conn
,
long
lobId
,
public
static
Value
LobD
b
readBlobDb
(
Connection
conn
,
long
lobId
,
long
precision
)
{
long
precision
)
{
DataHandler
h
=
((
JdbcConnection
)
conn
).
getSession
().
getDataHandler
();
DataHandler
h
=
((
JdbcConnection
)
conn
).
getSession
().
getDataHandler
();
verifyPageStore
(
h
);
verifyPageStore
(
h
);
...
@@ -235,7 +235,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -235,7 +235,7 @@ public class Recover extends Tool implements DataHandler {
/**
/**
* INTERNAL
* INTERNAL
*/
*/
public
static
Value
.
ValueClo
b
readClobDb
(
Connection
conn
,
long
lobId
,
public
static
Value
LobD
b
readClobDb
(
Connection
conn
,
long
lobId
,
long
precision
)
{
long
precision
)
{
DataHandler
h
=
((
JdbcConnection
)
conn
).
getSession
().
getDataHandler
();
DataHandler
h
=
((
JdbcConnection
)
conn
).
getSession
().
getDataHandler
();
verifyPageStore
(
h
);
verifyPageStore
(
h
);
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
11b7e7cd
...
@@ -995,10 +995,11 @@ public class DataType {
...
@@ -995,10 +995,11 @@ public class DataType {
return
Value
.
DECIMAL
;
return
Value
.
DECIMAL
;
}
else
if
(
ResultSet
.
class
.
isAssignableFrom
(
x
))
{
}
else
if
(
ResultSet
.
class
.
isAssignableFrom
(
x
))
{
return
Value
.
RESULT_SET
;
return
Value
.
RESULT_SET
;
}
else
if
(
Value
.
ValueBlo
b
.
class
.
isAssignableFrom
(
x
))
{
}
else
if
(
Value
LobD
b
.
class
.
isAssignableFrom
(
x
))
{
return
Value
.
BLOB
;
return
Value
.
BLOB
;
}
else
if
(
Value
.
ValueClob
.
class
.
isAssignableFrom
(
x
))
{
// FIXME no way to distinguish between these 2 types
return
Value
.
CLOB
;
// } else if (ValueLobDb.class.isAssignableFrom(x)) {
// return Value.CLOB;
}
else
if
(
Date
.
class
.
isAssignableFrom
(
x
))
{
}
else
if
(
Date
.
class
.
isAssignableFrom
(
x
))
{
return
Value
.
DATE
;
return
Value
.
DATE
;
}
else
if
(
Time
.
class
.
isAssignableFrom
(
x
))
{
}
else
if
(
Time
.
class
.
isAssignableFrom
(
x
))
{
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
11b7e7cd
...
@@ -1395,18 +1395,4 @@ public abstract class Value {
...
@@ -1395,18 +1395,4 @@ public abstract class Value {
return
null
;
return
null
;
}
}
/**
* A "binary large object".
*/
public
interface
ValueClob
{
// this is a marker interface
}
/**
* A "character large object".
*/
public
interface
ValueBlob
{
// this is a marker interface
}
}
}
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
11b7e7cd
差异被折叠。
点击展开。
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
11b7e7cd
...
@@ -39,10 +39,12 @@ import org.h2.util.Utils;
...
@@ -39,10 +39,12 @@ import org.h2.util.Utils;
* Small objects are kept in memory and stored in the record.
* Small objects are kept in memory and stored in the record.
* Large objects are either stored in the database, or in temporary files.
* Large objects are either stored in the database, or in temporary files.
*/
*/
public
class
ValueLobDb
extends
Value
implements
Value
.
ValueClob
,
public
class
ValueLobDb
extends
Value
{
Value
.
ValueBlob
{
private
final
int
type
;
/**
* the value type (Value.BLOB or CLOB)
*/
private
final
int
valueType
;
private
final
long
lobId
;
private
final
long
lobId
;
private
final
byte
[]
hmac
;
private
final
byte
[]
hmac
;
private
final
byte
[]
small
;
private
final
byte
[]
small
;
...
@@ -66,7 +68,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -66,7 +68,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
private
ValueLobDb
(
int
type
,
DataHandler
handler
,
int
tableId
,
long
lobId
,
private
ValueLobDb
(
int
type
,
DataHandler
handler
,
int
tableId
,
long
lobId
,
byte
[]
hmac
,
long
precision
)
{
byte
[]
hmac
,
long
precision
)
{
this
.
t
ype
=
type
;
this
.
valueT
ype
=
type
;
this
.
handler
=
handler
;
this
.
handler
=
handler
;
this
.
tableId
=
tableId
;
this
.
tableId
=
tableId
;
this
.
lobId
=
lobId
;
this
.
lobId
=
lobId
;
...
@@ -78,7 +80,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -78,7 +80,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
}
}
private
ValueLobDb
(
int
type
,
byte
[]
small
,
long
precision
)
{
private
ValueLobDb
(
int
type
,
byte
[]
small
,
long
precision
)
{
this
.
t
ype
=
type
;
this
.
valueT
ype
=
type
;
this
.
small
=
small
;
this
.
small
=
small
;
this
.
precision
=
precision
;
this
.
precision
=
precision
;
this
.
lobId
=
0
;
this
.
lobId
=
0
;
...
@@ -94,7 +96,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -94,7 +96,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
*/
*/
private
ValueLobDb
(
DataHandler
handler
,
Reader
in
,
long
remaining
)
private
ValueLobDb
(
DataHandler
handler
,
Reader
in
,
long
remaining
)
throws
IOException
{
throws
IOException
{
this
.
t
ype
=
Value
.
CLOB
;
this
.
valueT
ype
=
Value
.
CLOB
;
this
.
handler
=
handler
;
this
.
handler
=
handler
;
this
.
small
=
null
;
this
.
small
=
null
;
this
.
lobId
=
0
;
this
.
lobId
=
0
;
...
@@ -126,7 +128,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -126,7 +128,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
*/
*/
private
ValueLobDb
(
DataHandler
handler
,
byte
[]
buff
,
int
len
,
InputStream
in
,
private
ValueLobDb
(
DataHandler
handler
,
byte
[]
buff
,
int
len
,
InputStream
in
,
long
remaining
)
throws
IOException
{
long
remaining
)
throws
IOException
{
this
.
t
ype
=
Value
.
BLOB
;
this
.
valueT
ype
=
Value
.
BLOB
;
this
.
handler
=
handler
;
this
.
handler
=
handler
;
this
.
small
=
null
;
this
.
small
=
null
;
this
.
lobId
=
0
;
this
.
lobId
=
0
;
...
@@ -167,7 +169,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -167,7 +169,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
/**
/**
* Create a LOB value.
* Create a LOB value.
*
*
* @param type the type
* @param type the type
(Value.BLOB or CLOB)
* @param handler the data handler
* @param handler the data handler
* @param tableId the table id
* @param tableId the table id
* @param id the lob id
* @param id the lob id
...
@@ -194,7 +196,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -194,7 +196,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
*/
*/
@Override
@Override
public
Value
convertTo
(
int
t
,
int
precision
,
Mode
mode
,
Object
column
,
String
[]
enumerators
)
{
public
Value
convertTo
(
int
t
,
int
precision
,
Mode
mode
,
Object
column
,
String
[]
enumerators
)
{
if
(
t
==
t
ype
)
{
if
(
t
==
valueT
ype
)
{
return
this
;
return
this
;
}
else
if
(
t
==
Value
.
CLOB
)
{
}
else
if
(
t
==
Value
.
CLOB
)
{
if
(
handler
!=
null
)
{
if
(
handler
!=
null
)
{
...
@@ -248,7 +250,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -248,7 +250,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
}
else
if
(
small
.
length
>
database
.
getMaxLengthInplaceLob
())
{
}
else
if
(
small
.
length
>
database
.
getMaxLengthInplaceLob
())
{
LobStorageInterface
s
=
database
.
getLobStorage
();
LobStorageInterface
s
=
database
.
getLobStorage
();
Value
v
;
Value
v
;
if
(
t
ype
==
Value
.
BLOB
)
{
if
(
valueT
ype
==
Value
.
BLOB
)
{
v
=
s
.
createBlob
(
getInputStream
(),
getPrecision
());
v
=
s
.
createBlob
(
getInputStream
(),
getPrecision
());
}
else
{
}
else
{
v
=
s
.
createClob
(
getReader
(),
getPrecision
());
v
=
s
.
createClob
(
getReader
(),
getPrecision
());
...
@@ -272,7 +274,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -272,7 +274,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
@Override
public
int
getType
()
{
public
int
getType
()
{
return
t
ype
;
return
valueT
ype
;
}
}
@Override
@Override
...
@@ -285,7 +287,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -285,7 +287,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
int
len
=
precision
>
Integer
.
MAX_VALUE
||
precision
==
0
?
int
len
=
precision
>
Integer
.
MAX_VALUE
||
precision
==
0
?
Integer
.
MAX_VALUE
:
(
int
)
precision
;
Integer
.
MAX_VALUE
:
(
int
)
precision
;
try
{
try
{
if
(
t
ype
==
Value
.
CLOB
)
{
if
(
valueT
ype
==
Value
.
CLOB
)
{
if
(
small
!=
null
)
{
if
(
small
!=
null
)
{
return
new
String
(
small
,
StandardCharsets
.
UTF_8
);
return
new
String
(
small
,
StandardCharsets
.
UTF_8
);
}
}
...
@@ -305,7 +307,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -305,7 +307,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
@Override
public
byte
[]
getBytes
()
{
public
byte
[]
getBytes
()
{
if
(
t
ype
==
CLOB
)
{
if
(
valueT
ype
==
CLOB
)
{
// convert hex to string
// convert hex to string
return
super
.
getBytes
();
return
super
.
getBytes
();
}
}
...
@@ -315,7 +317,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -315,7 +317,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
@Override
public
byte
[]
getBytesNoCopy
()
{
public
byte
[]
getBytesNoCopy
()
{
if
(
t
ype
==
CLOB
)
{
if
(
valueT
ype
==
CLOB
)
{
// convert hex to string
// convert hex to string
return
super
.
getBytesNoCopy
();
return
super
.
getBytesNoCopy
();
}
}
...
@@ -337,7 +339,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -337,7 +339,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
// it in the database file
// it in the database file
return
(
int
)
(
precision
^
(
precision
>>>
32
));
return
(
int
)
(
precision
^
(
precision
>>>
32
));
}
}
if
(
t
ype
==
CLOB
)
{
if
(
valueT
ype
==
CLOB
)
{
hash
=
getString
().
hashCode
();
hash
=
getString
().
hashCode
();
}
else
{
}
else
{
hash
=
Utils
.
getByteArrayHash
(
getBytes
());
hash
=
Utils
.
getByteArrayHash
(
getBytes
());
...
@@ -357,7 +359,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -357,7 +359,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
return
0
;
return
0
;
}
}
}
}
if
(
t
ype
==
Value
.
CLOB
)
{
if
(
valueT
ype
==
Value
.
CLOB
)
{
return
Integer
.
signum
(
getString
().
compareTo
(
v
.
getString
()));
return
Integer
.
signum
(
getString
().
compareTo
(
v
.
getString
()));
}
}
byte
[]
v2
=
v
.
getBytesNoCopy
();
byte
[]
v2
=
v
.
getBytesNoCopy
();
...
@@ -366,7 +368,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -366,7 +368,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
@Override
public
Object
getObject
()
{
public
Object
getObject
()
{
if
(
t
ype
==
Value
.
CLOB
)
{
if
(
valueT
ype
==
Value
.
CLOB
)
{
return
getReader
();
return
getReader
();
}
}
return
getInputStream
();
return
getInputStream
();
...
@@ -379,7 +381,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -379,7 +381,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
@Override
public
Reader
getReader
(
long
oneBasedOffset
,
long
length
)
{
public
Reader
getReader
(
long
oneBasedOffset
,
long
length
)
{
return
ValueLob
.
rangeReader
(
getReader
(),
oneBasedOffset
,
length
,
t
ype
==
Value
.
CLOB
?
precision
:
-
1
);
return
ValueLob
.
rangeReader
(
getReader
(),
oneBasedOffset
,
length
,
valueT
ype
==
Value
.
CLOB
?
precision
:
-
1
);
}
}
@Override
@Override
...
@@ -392,7 +394,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -392,7 +394,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
return
new
BufferedInputStream
(
new
FileStoreInputStream
(
store
,
return
new
BufferedInputStream
(
new
FileStoreInputStream
(
store
,
handler
,
false
,
alwaysClose
),
Constants
.
IO_BUFFER_SIZE
);
handler
,
false
,
alwaysClose
),
Constants
.
IO_BUFFER_SIZE
);
}
}
long
byteCount
=
(
t
ype
==
Value
.
BLOB
)
?
precision
:
-
1
;
long
byteCount
=
(
valueT
ype
==
Value
.
BLOB
)
?
precision
:
-
1
;
try
{
try
{
return
handler
.
getLobStorage
().
getInputStream
(
this
,
hmac
,
byteCount
);
return
handler
.
getLobStorage
().
getInputStream
(
this
,
hmac
,
byteCount
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -413,7 +415,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -413,7 +415,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
inputStream
=
new
BufferedInputStream
(
new
FileStoreInputStream
(
store
,
inputStream
=
new
BufferedInputStream
(
new
FileStoreInputStream
(
store
,
handler
,
false
,
alwaysClose
),
Constants
.
IO_BUFFER_SIZE
);
handler
,
false
,
alwaysClose
),
Constants
.
IO_BUFFER_SIZE
);
}
else
{
}
else
{
byteCount
=
(
t
ype
==
Value
.
BLOB
)
?
precision
:
-
1
;
byteCount
=
(
valueT
ype
==
Value
.
BLOB
)
?
precision
:
-
1
;
try
{
try
{
inputStream
=
handler
.
getLobStorage
().
getInputStream
(
this
,
hmac
,
byteCount
);
inputStream
=
handler
.
getLobStorage
().
getInputStream
(
this
,
hmac
,
byteCount
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -430,7 +432,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -430,7 +432,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
if
(
p
>
Integer
.
MAX_VALUE
||
p
<=
0
)
{
if
(
p
>
Integer
.
MAX_VALUE
||
p
<=
0
)
{
p
=
-
1
;
p
=
-
1
;
}
}
if
(
t
ype
==
Value
.
BLOB
)
{
if
(
valueT
ype
==
Value
.
BLOB
)
{
prep
.
setBinaryStream
(
parameterIndex
,
getInputStream
(),
(
int
)
p
);
prep
.
setBinaryStream
(
parameterIndex
,
getInputStream
(),
(
int
)
p
);
}
else
{
}
else
{
prep
.
setCharacterStream
(
parameterIndex
,
getReader
(),
(
int
)
p
);
prep
.
setCharacterStream
(
parameterIndex
,
getReader
(),
(
int
)
p
);
...
@@ -440,7 +442,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -440,7 +442,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
@Override
public
String
getSQL
()
{
public
String
getSQL
()
{
String
s
;
String
s
;
if
(
t
ype
==
Value
.
CLOB
)
{
if
(
valueT
ype
==
Value
.
CLOB
)
{
s
=
getString
();
s
=
getString
();
return
StringUtils
.
quoteStringSQL
(
s
);
return
StringUtils
.
quoteStringSQL
(
s
);
}
}
...
@@ -455,7 +457,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -455,7 +457,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
return
getSQL
();
return
getSQL
();
}
}
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buff
=
new
StringBuilder
();
if
(
t
ype
==
Value
.
CLOB
)
{
if
(
valueT
ype
==
Value
.
CLOB
)
{
buff
.
append
(
"SPACE("
).
append
(
getPrecision
());
buff
.
append
(
"SPACE("
).
append
(
getPrecision
());
}
else
{
}
else
{
buff
.
append
(
"CAST(REPEAT('00', "
).
append
(
getPrecision
()).
append
(
") AS BINARY"
);
buff
.
append
(
"CAST(REPEAT('00', "
).
append
(
getPrecision
()).
append
(
") AS BINARY"
);
...
@@ -650,13 +652,13 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -650,13 +652,13 @@ public class ValueLobDb extends Value implements Value.ValueClob,
return
this
;
return
this
;
}
}
ValueLobDb
lob
;
ValueLobDb
lob
;
if
(
t
ype
==
CLOB
)
{
if
(
valueT
ype
==
CLOB
)
{
if
(
handler
==
null
)
{
if
(
handler
==
null
)
{
try
{
try
{
int
p
=
MathUtils
.
convertLongToInt
(
precision
);
int
p
=
MathUtils
.
convertLongToInt
(
precision
);
String
s
=
IOUtils
.
readStringAndClose
(
getReader
(),
p
);
String
s
=
IOUtils
.
readStringAndClose
(
getReader
(),
p
);
byte
[]
data
=
s
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
data
=
s
.
getBytes
(
StandardCharsets
.
UTF_8
);
lob
=
ValueLobDb
.
createSmallLob
(
t
ype
,
data
,
s
.
length
());
lob
=
ValueLobDb
.
createSmallLob
(
valueT
ype
,
data
,
s
.
length
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
...
@@ -668,7 +670,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
...
@@ -668,7 +670,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
try
{
try
{
int
p
=
MathUtils
.
convertLongToInt
(
precision
);
int
p
=
MathUtils
.
convertLongToInt
(
precision
);
byte
[]
data
=
IOUtils
.
readBytesAndClose
(
getInputStream
(),
p
);
byte
[]
data
=
IOUtils
.
readBytesAndClose
(
getInputStream
(),
p
);
lob
=
ValueLobDb
.
createSmallLob
(
t
ype
,
data
,
data
.
length
);
lob
=
ValueLobDb
.
createSmallLob
(
valueT
ype
,
data
,
data
.
length
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
DbException
.
convertIOException
(
e
,
null
);
throw
DbException
.
convertIOException
(
e
,
null
);
}
}
...
...
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
11b7e7cd
...
@@ -265,8 +265,9 @@ public class TestValue extends TestDb {
...
@@ -265,8 +265,9 @@ public class TestValue extends TestDb {
testDataType
(
Value
.
NULL
,
Void
.
class
);
testDataType
(
Value
.
NULL
,
Void
.
class
);
testDataType
(
Value
.
DECIMAL
,
BigDecimal
.
class
);
testDataType
(
Value
.
DECIMAL
,
BigDecimal
.
class
);
testDataType
(
Value
.
RESULT_SET
,
ResultSet
.
class
);
testDataType
(
Value
.
RESULT_SET
,
ResultSet
.
class
);
testDataType
(
Value
.
BLOB
,
Value
.
ValueBlob
.
class
);
testDataType
(
Value
.
BLOB
,
ValueLobDb
.
class
);
testDataType
(
Value
.
CLOB
,
Value
.
ValueClob
.
class
);
// see FIXME in DataType.getTypeFromClass
//testDataType(Value.CLOB, Value.ValueClob.class);
testDataType
(
Value
.
DATE
,
Date
.
class
);
testDataType
(
Value
.
DATE
,
Date
.
class
);
testDataType
(
Value
.
TIME
,
Time
.
class
);
testDataType
(
Value
.
TIME
,
Time
.
class
);
testDataType
(
Value
.
TIMESTAMP
,
Timestamp
.
class
);
testDataType
(
Value
.
TIMESTAMP
,
Timestamp
.
class
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论