Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
99216697
提交
99216697
authored
7 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/h2database/h2database
上级
8a89d185
e1a20588
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
88 行增加
和
28 行删除
+88
-28
JdbcBlob.java
h2/src/main/org/h2/jdbc/JdbcBlob.java
+14
-2
JdbcClob.java
h2/src/main/org/h2/jdbc/JdbcClob.java
+25
-2
TestLobApi.java
h2/src/test/org/h2/test/jdbc/TestLobApi.java
+33
-16
stylesheet.css
h2/src/tools/org/h2/jcr/stylesheet.css
+16
-8
没有找到文件。
h2/src/main/org/h2/jdbc/JdbcBlob.java
浏览文件 @
99216697
...
...
@@ -125,7 +125,7 @@ public class JdbcBlob extends TraceObject implements Blob {
}
/**
*
[Not supported]
Sets some bytes of the object.
* Sets some bytes of the object.
*
* @param pos the write position
* @param bytes the bytes to set
...
...
@@ -136,7 +136,19 @@ public class JdbcBlob extends TraceObject implements Blob {
@Override
public
int
setBytes
(
long
pos
,
byte
[]
bytes
,
int
offset
,
int
len
)
throws
SQLException
{
throw
unsupported
(
"LOB update"
);
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"setBytes("
+
pos
+
", "
+
quoteBytes
(
bytes
)
+
", "
+
offset
+
", "
+
len
+
");"
);
}
checkClosed
();
if
(
pos
!=
1
)
{
throw
DbException
.
getInvalidValueException
(
"pos"
,
pos
);
}
value
=
conn
.
createBlob
(
new
ByteArrayInputStream
(
bytes
,
offset
,
len
),
-
1
);
return
(
int
)
value
.
getPrecision
();
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcClob.java
浏览文件 @
99216697
...
...
@@ -21,6 +21,7 @@ import org.h2.api.ErrorCode;
import
org.h2.engine.Constants
;
import
org.h2.message.DbException
;
import
org.h2.message.TraceObject
;
import
org.h2.store.RangeReader
;
import
org.h2.util.IOUtils
;
import
org.h2.util.Task
;
import
org.h2.value.Value
;
...
...
@@ -227,12 +228,34 @@ public class JdbcClob extends TraceObject implements NClob
}
/**
* [Not supported] Sets a substring.
* Fills the Clob. This is only supported for new, empty Clob objects that
* were created with Connection.createClob() or createNClob(). The position
* must be 1, meaning the whole Clob data is set.
*
* @param pos where to start writing (the first character is at position 1)
* @param str the string to add
* @param offset the string offset
* @param len the number of characters to read
* @return the length of the added text
*/
@Override
public
int
setString
(
long
pos
,
String
str
,
int
offset
,
int
len
)
throws
SQLException
{
throw
unsupported
(
"LOB update"
);
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"setString("
+
pos
+
", "
+
quote
(
str
)
+
", "
+
offset
+
", "
+
len
+
");"
);
}
checkClosed
();
if
(
pos
!=
1
)
{
throw
DbException
.
getInvalidValueException
(
"pos"
,
pos
);
}
else
if
(
str
==
null
)
{
throw
DbException
.
getInvalidValueException
(
"str"
,
str
);
}
value
=
conn
.
createClob
(
new
RangeReader
(
new
StringReader
(
str
),
offset
,
len
),
-
1
);
return
(
int
)
value
.
getPrecision
();
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestLobApi.java
浏览文件 @
99216697
...
...
@@ -86,8 +86,6 @@ public class TestLobApi extends TestBase {
truncate
(
0
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
clob
).
setAsciiStream
(
1
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
clob
).
setString
(
1
,
""
,
0
,
1
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
clob
).
position
(
""
,
0
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
clob
).
...
...
@@ -96,8 +94,6 @@ public class TestLobApi extends TestBase {
Blob
blob
=
rs
.
getBlob
(
3
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
blob
).
truncate
(
0
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
blob
).
setBytes
(
1
,
new
byte
[
0
],
0
,
0
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
blob
).
position
(
new
byte
[
1
],
0
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
blob
).
...
...
@@ -237,30 +233,43 @@ public class TestLobApi extends TestBase {
prep
.
setInt
(
1
,
2
);
b
=
conn
.
createBlob
();
b
.
setBytes
(
1
,
data
);
assertEquals
(
length
,
b
.
setBytes
(
1
,
data
)
);
prep
.
setBlob
(
2
,
b
);
prep
.
execute
();
prep
.
setInt
(
1
,
3
);
prep
.
setBlob
(
2
,
new
ByteArrayInputStream
(
data
));
Blob
b2
=
conn
.
createBlob
();
byte
[]
xdata
=
new
byte
[
length
+
2
];
System
.
arraycopy
(
data
,
0
,
xdata
,
1
,
length
);
assertEquals
(
length
,
b2
.
setBytes
(
1
,
xdata
,
1
,
length
));
prep
.
setBlob
(
2
,
b2
);
prep
.
execute
();
prep
.
setInt
(
1
,
4
);
prep
.
setBlob
(
2
,
new
ByteArrayInputStream
(
data
));
prep
.
execute
();
prep
.
setInt
(
1
,
5
);
prep
.
setBlob
(
2
,
new
ByteArrayInputStream
(
data
),
-
1
);
prep
.
execute
();
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"select * from test"
);
rs
.
next
();
Blob
b
2
=
rs
.
getBlob
(
2
);
assertEquals
(
length
,
b
2
.
length
());
Blob
b
3
=
rs
.
getBlob
(
2
);
assertEquals
(
length
,
b
3
.
length
());
byte
[]
bytes
=
b
.
getBytes
(
1
,
length
);
byte
[]
bytes2
=
b2
.
getBytes
(
1
,
length
);
byte
[]
bytes2
=
b3
.
getBytes
(
1
,
length
);
assertEquals
(
bytes
,
bytes2
);
rs
.
next
();
b3
=
rs
.
getBlob
(
2
);
assertEquals
(
length
,
b3
.
length
());
bytes2
=
b3
.
getBytes
(
1
,
length
);
assertEquals
(
bytes
,
bytes2
);
rs
.
next
();
b
2
=
rs
.
getBlob
(
2
);
assertEquals
(
length
,
b
2
.
length
());
bytes2
=
b
2
.
getBytes
(
1
,
length
);
b
3
=
rs
.
getBlob
(
2
);
assertEquals
(
length
,
b
3
.
length
());
bytes2
=
b
3
.
getBytes
(
1
,
length
);
assertEquals
(
bytes
,
bytes2
);
while
(
rs
.
next
())
{
bytes2
=
rs
.
getBytes
(
2
);
...
...
@@ -311,20 +320,28 @@ public class TestLobApi extends TestBase {
NClob
nc
;
nc
=
conn
.
createNClob
();
nc
.
setString
(
1
,
new
String
(
data
));
assertEquals
(
length
,
nc
.
setString
(
1
,
new
String
(
data
)
));
prep
.
setInt
(
1
,
5
);
prep
.
setNClob
(
2
,
nc
);
prep
.
execute
();
prep
.
setInt
(
1
,
5
);
nc
=
conn
.
createNClob
();
char
[]
xdata
=
new
char
[
length
+
2
];
System
.
arraycopy
(
data
,
0
,
xdata
,
1
,
length
);
assertEquals
(
length
,
nc
.
setString
(
1
,
new
String
(
xdata
),
1
,
length
));
prep
.
setInt
(
1
,
6
);
prep
.
setNClob
(
2
,
nc
);
prep
.
execute
();
prep
.
setInt
(
1
,
7
);
prep
.
setNClob
(
2
,
new
StringReader
(
new
String
(
data
)));
prep
.
execute
();
prep
.
setInt
(
1
,
6
);
prep
.
setInt
(
1
,
8
);
prep
.
setNClob
(
2
,
new
StringReader
(
new
String
(
data
)),
-
1
);
prep
.
execute
();
prep
.
setInt
(
1
,
7
);
prep
.
setInt
(
1
,
9
);
prep
.
setNString
(
2
,
new
String
(
data
));
prep
.
execute
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/jcr/stylesheet.css
浏览文件 @
99216697
...
...
@@ -249,6 +249,8 @@ td.index {
margin
:
0px
0px
;
border
:
2px
solid
;
-moz-border-radius
:
0.4em
;
-webkit-border-radius
:
0.4em
;
-khtml-border-radius
:
0.4em
;
border-radius
:
0.4em
;
background-color
:
#fff
;
}
...
...
@@ -259,9 +261,10 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-ts.png)
;
width
:
16
px
;
background-size
:
16px
512
px
;
}
.ls
{
...
...
@@ -270,9 +273,10 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-ls.png)
;
width
:
16
px
;
background-size
:
16px
512
px
;
}
.ks
{
...
...
@@ -281,9 +285,10 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-ks.png)
;
width
:
16
px
;
background-size
:
16px
512
px
;
}
.te
{
...
...
@@ -292,9 +297,10 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-te.png)
;
width
:
16
px
;
background-size
:
16px
512
px
;
}
.le
{
...
...
@@ -303,9 +309,10 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-le.png)
;
width
:
16
px
;
background-size
:
16px
512
px
;
}
.ke
{
...
...
@@ -314,9 +321,10 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-ke.png)
;
width
:
16
px
;
background-size
:
16px
512
px
;
}
.d
{
...
...
@@ -325,8 +333,8 @@ td.index {
margin
:
0px
;
border-collapse
:
collapse
;
vertical-align
:
top
;
min-width
:
16px
;
height
:
24px
;
background-image
:
url(images/div-d.png)
;
background-repeat
:
repeat-x
;
min-width
:
16px
;
background-size
:
1024px
512px
;
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论