Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
07236a50
提交
07236a50
authored
7月 14, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CSVREAD did not process NULL correctly when using a whitespace field separator.
上级
cc29aa7f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
27 行增加
和
5 行删除
+27
-5
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
Csv.java
h2/src/main/org/h2/tools/Csv.java
+5
-5
newsfeed.sql
h2/src/test/org/h2/samples/newsfeed.sql
+1
-0
TestCsv.java
h2/src/test/org/h2/test/db/TestCsv.java
+20
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
07236a50
...
@@ -19,6 +19,7 @@ Change Log
...
@@ -19,6 +19,7 @@ Change Log
<ul><li>
Multi version concurrency (MVCC): when a row was updated or deleted, but this change was rolled back,
<ul><li>
Multi version concurrency (MVCC): when a row was updated or deleted, but this change was rolled back,
the row was not visible by other sessions if no index was used to access it. Fixed.
the row was not visible by other sessions if no index was used to access it. Fixed.
</li><li>
Views with multiple joined tables (where one was an outer join) couldn't be used in some cases. Fixed.
</li><li>
Views with multiple joined tables (where one was an outer join) couldn't be used in some cases. Fixed.
</li><li>
The CSVREAD method did not process NULL correctly when using a whitespace field separator.
</li><li>
Fixed the Oracle mode: Oracle allows multiple rows with NULL in a unique index.
</li><li>
Fixed the Oracle mode: Oracle allows multiple rows with NULL in a unique index.
</li><li>
Running out of memory could result in incomplete transactions or corrupted databases. Fixed.
</li><li>
Running out of memory could result in incomplete transactions or corrupted databases. Fixed.
</li><li>
When using order by in a query that uses the same table multiple times, the order could
</li><li>
When using order by in a query that uses the same table multiple times, the order could
...
...
h2/src/main/org/h2/tools/Csv.java
浏览文件 @
07236a50
...
@@ -345,12 +345,12 @@ public class Csv implements SimpleRowSource {
...
@@ -345,12 +345,12 @@ public class Csv implements SimpleRowSource {
if
(
ch
<
0
||
ch
==
'\r'
||
ch
==
'\n'
)
{
if
(
ch
<
0
||
ch
==
'\r'
||
ch
==
'\n'
)
{
endOfLine
=
true
;
endOfLine
=
true
;
break
;
break
;
}
else
if
(
ch
<=
' '
)
{
// ignore spaces
continue
;
}
else
if
(
ch
==
fieldSeparatorRead
)
{
}
else
if
(
ch
==
fieldSeparatorRead
)
{
// null
// null
break
;
break
;
}
else
if
(
ch
<=
' '
)
{
// ignore spaces
continue
;
}
else
if
(
ch
==
fieldDelimiter
)
{
}
else
if
(
ch
==
fieldDelimiter
)
{
// delimited value
// delimited value
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
...
@@ -388,10 +388,10 @@ public class Csv implements SimpleRowSource {
...
@@ -388,10 +388,10 @@ public class Csv implements SimpleRowSource {
ch
=
readChar
();
ch
=
readChar
();
if
(
ch
<
0
)
{
if
(
ch
<
0
)
{
break
;
break
;
}
else
if
(
ch
==
' '
||
ch
==
'\t'
)
{
// ignore
}
else
if
(
ch
==
fieldSeparatorRead
)
{
}
else
if
(
ch
==
fieldSeparatorRead
)
{
break
;
break
;
}
else
if
(
ch
==
' '
||
ch
==
'\t'
)
{
// ignore
}
else
if
(
ch
==
'\r'
||
ch
==
'\n'
)
{
}
else
if
(
ch
==
'\r'
||
ch
==
'\n'
)
{
pushBack
(
ch
);
pushBack
(
ch
);
endOfLine
=
true
;
endOfLine
=
true
;
...
...
h2/src/test/org/h2/samples/newsfeed.sql
浏览文件 @
07236a50
...
@@ -25,6 +25,7 @@ $$A new version of H2 is available for <a href="http://www.h2database.com">downl
...
@@ -25,6 +25,7 @@ $$A new version of H2 is available for <a href="http://www.h2database.com">downl
</
li
></
ul
>
</
li
></
ul
>
<
b
>
Bugfixes
:
</
b
>
<
b
>
Bugfixes
:
</
b
>
<
ul
><
li
>
Running
out
of
memory
could
result
in
incomplete
transactions
or
corrupted
databases
.
Fixed
.
<
ul
><
li
>
Running
out
of
memory
could
result
in
incomplete
transactions
or
corrupted
databases
.
Fixed
.
</
li
><
li
>
CSVREAD
did
not
process
NULL
correctly
when
using
a
whitespace
field
separator
.
</
li
><
li
>
Stopping
a
WebServer
didn
't always work. Fixed.
</
li
><
li
>
Stopping
a
WebServer
didn
't always work. Fixed.
</li><li>Sometimes, order by in a query that uses the same table multiple times didn'
t
work
.
</li><li>Sometimes, order by in a query that uses the same table multiple times didn'
t
work
.
</
li
><
li
>
A
multi
version
concurrency
(
MVCC
)
problem
has
been
fixed
.
</
li
><
li
>
A
multi
version
concurrency
(
MVCC
)
problem
has
been
fixed
.
...
...
h2/src/test/org/h2/test/db/TestCsv.java
浏览文件 @
07236a50
...
@@ -33,6 +33,7 @@ import org.h2.util.StringUtils;
...
@@ -33,6 +33,7 @@ import org.h2.util.StringUtils;
public
class
TestCsv
extends
TestBase
{
public
class
TestCsv
extends
TestBase
{
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
testSpaceSeparated
();
testNull
();
testNull
();
testRandomData
();
testRandomData
();
testEmptyFieldDelimiter
();
testEmptyFieldDelimiter
();
...
@@ -42,6 +43,25 @@ public class TestCsv extends TestBase {
...
@@ -42,6 +43,25 @@ public class TestCsv extends TestBase {
testRead
();
testRead
();
testPipe
();
testPipe
();
}
}
private
void
testSpaceSeparated
()
throws
Exception
{
deleteDb
(
"csv"
);
File
f
=
new
File
(
baseDir
+
"/testSpace.csv"
);
FileUtils
.
delete
(
f
.
getAbsolutePath
());
Connection
conn
=
getConnection
(
"csv"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create temporary table test (a int, b int, c int)"
);
stat
.
execute
(
"insert into test values(1,2,3)"
);
stat
.
execute
(
"insert into test values(4,null,5)"
);
stat
.
execute
(
"call csvwrite('test.tsv','select * from test',null,' ')"
);
ResultSet
rs1
=
stat
.
executeQuery
(
"select * from test"
);
assertResultSetOrdered
(
rs1
,
new
String
[][]{
new
String
[]{
"1"
,
"2"
,
"3"
},
new
String
[]{
"4"
,
null
,
"5"
}});
ResultSet
rs2
=
stat
.
executeQuery
(
"select * from csvread('test.tsv',null,null,' ')"
);
assertResultSetOrdered
(
rs2
,
new
String
[][]{
new
String
[]{
"1"
,
"2"
,
"3"
},
new
String
[]{
"4"
,
null
,
"5"
}});
conn
.
close
();
FileUtils
.
delete
(
f
.
getAbsolutePath
());
}
/**
/**
* Test custom NULL string.
* Test custom NULL string.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论