Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
16ceecac
提交
16ceecac
authored
1月 29, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
847cf627
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
1213 行增加
和
1106 行删除
+1213
-1106
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+376
-364
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+376
-364
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+370
-366
TestLob.java
h2/src/test/org/h2/test/utils/TestLob.java
+89
-10
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
FtpServer.java
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
+1
-1
没有找到文件。
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
16ceecac
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
16ceecac
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
16ceecac
This source diff could not be displayed because it is too large. You can
view the blob
instead.
h2/src/test/org/h2/test/utils/TestLob.java
浏览文件 @
16ceecac
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
test
.
utils
;
import
java.io.ByteArrayInputStream
;
import
java.io.EOFException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.sql.Connection
;
...
...
@@ -15,6 +16,8 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Random
;
import
org.h2.constant.ErrorCode
;
import
org.h2.message.Message
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.util.ByteUtils
;
...
...
@@ -73,12 +76,12 @@ public class TestLob {
*/
static
class
LobInputStream
extends
InputStream
{
private
byte
[]
page
=
new
byte
[
BLOCK_LENGTH
];
private
byte
[]
buff
=
new
byte
[
1
];
private
byte
[]
buffer
=
new
byte
[
BLOCK_LENGTH
];
private
PreparedStatement
prepSelectBlock
;
private
int
bufferEnd
;
private
long
remaining
;
private
long
offset
;
private
long
next
;
private
int
pos
;
LobInputStream
(
PreparedStatement
prepSelectBlock
,
long
first
,
long
length
)
{
this
.
next
=
first
;
...
...
@@ -87,11 +90,11 @@ public class TestLob {
}
public
int
read
()
throws
IOException
{
int
len
=
readFully
(
buff
,
0
,
1
);
if
(
len
==
0
)
{
fillBuffer
(
);
if
(
pos
>=
bufferEnd
)
{
return
-
1
;
}
return
buff
[
0
]
&
255
;
return
buff
er
[
pos
++
]
&
255
;
}
public
int
read
(
byte
[]
buff
)
throws
IOException
{
...
...
@@ -103,12 +106,72 @@ public class TestLob {
}
private
int
readFully
(
byte
[]
buff
,
int
off
,
int
length
)
throws
IOException
{
i
nt
len
=
0
;
while
(
length
>
0
&&
remaining
>
0
)
{
i
f
(
length
==
0
)
{
return
0
;
}
return
len
;
int
read
=
0
;
int
todo
;
// while (length > 0) {
// fillBuffer();
//
// if (r < 0) {
// break;
// }
// read += r;
// off += r;
// len -= r;
// }
// return read == 0 ? -1 : read;
//
// int len = 0;
// while (length > 0 && remaining > 0) {
// }
return
read
;
}
private
void
fillBuffer
()
throws
IOException
{
if
(
buffer
!=
null
&&
pos
<
bufferEnd
)
{
return
;
}
if
(
remaining
<=
0
)
{
return
;
}
try
{
prepSelectBlock
.
setLong
(
1
,
next
);
ResultSet
rs
=
prepSelectBlock
.
executeQuery
();
if
(!
rs
.
next
())
{
SQLException
e
=
Message
.
getSQLException
(
ErrorCode
.
IO_EXCEPTION_1
,
"block: "
+
next
);
IOException
io
=
new
EOFException
(
"Unexpected end of stream"
);
io
.
initCause
(
e
);
throw
e
;
}
}
catch
(
SQLException
e
)
{
throw
Message
.
convertToIOException
(
e
);
}
int
todo
;
//
//
// int len = readInt();
// if (decompress == null) {
// // EOF
// this.bufferLength = 0;
// } else if (len < 0) {
// len = -len;
// buffer = ensureSize(buffer, len);
// readFully(buffer, len);
// this.bufferLength = len;
// } else {
// inBuffer = ensureSize(inBuffer, len);
// int size = readInt();
// readFully(inBuffer, len);
// buffer = ensureSize(buffer, size);
// decompress.expand(inBuffer, 0, len, buffer, 0, size);
// this.bufferLength = size;
// }
// pos = 0;
}
}
/**
...
...
@@ -120,14 +183,30 @@ public class TestLob {
new
TestLob
().
test
();
}
private
void
test
()
throws
SQL
Exception
{
private
void
test
()
throws
Exception
{
DeleteDbFiles
.
execute
(
"data"
,
"test"
,
true
);
org
.
h2
.
Driver
.
load
();
Connection
c
=
DriverManager
.
getConnection
(
"jdbc:h2:data/test"
);
init
(
c
);
c
=
DriverManager
.
getConnection
(
"jdbc:h2:data/test"
);
int
len
=
128
*
1024
;
byte
[]
buff
=
new
byte
[
len
];
Random
random
=
new
Random
(
1
);
random
.
nextBytes
(
buff
);
LobId
lob
=
addLob
(
new
ByteArrayInputStream
(
buff
),
-
1
,
-
1
);
InputStream
in
=
getInputStream
(
lob
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
int
x
=
in
.
read
();
if
(
x
!=
(
buff
[
i
]
&
255
))
{
throw
new
AssertionError
();
}
}
if
(
in
.
read
()
!=
-
1
)
{
throw
new
AssertionError
();
}
Statement
stat
=
c
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, data blob)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"insert into test(id, data) values(?, ?)"
);
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
16ceecac
...
...
@@ -629,4 +629,4 @@ sweden abbreviated xmx trede googlecode gustav standing hashes
decompressed expansion ziv abbreviated augments omitted gain
subtracted maxed logical lempel increases sibling impersonate proper remembers
moon centric adeptia workflows generalized bpchar binaries incremental poor
slowly prefs precedence mat
slowly prefs precedence mat
verbose nonce
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
浏览文件 @
16ceecac
...
...
@@ -222,7 +222,7 @@ public class FtpServer extends Tool implements Service {
return
NetUtils
.
createServerSocket
(
0
,
false
);
}
private
void
appendFile
(
StringBuilder
buff
,
String
fileName
)
throws
SQLException
{
private
void
appendFile
(
StringBuilder
buff
,
String
fileName
)
{
buff
.
append
(
fs
.
isDirectory
(
fileName
)
?
'd'
:
'-'
);
buff
.
append
(
'r'
);
buff
.
append
(
fs
.
canWrite
(
fileName
)
?
'w'
:
'-'
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论