Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
55edf736
提交
55edf736
authored
7月 09, 2012
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New system property "h2.serializeJavaObject".
上级
cf4ddbab
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
15 行增加
和
9 行删除
+15
-9
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+5
-5
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
TestJavaObject.java
h2/src/test/org/h2/test/jdbc/TestJavaObject.java
+5
-3
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
55edf736
...
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Dylan has translated the H2 Console tool to Korean. Thanks a lot!
<ul><li>
New system property "h2.serializeJavaObject" (default: true) that allows to disable
serializing Java objects, so that the objects compareTo and toString methods can be used.
</li><li>
Dylan has translated the H2 Console tool to Korean. Thanks a lot!
</li><li>
Executing the statement CREATE INDEX IF ALREADY EXISTS if the index already exists
no longer fails for a read only database.
</li><li>
MVCC: concurrently updating a row could result in the row to appear deleted in the second connection,
...
...
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
55edf736
...
...
@@ -372,13 +372,13 @@ public class SysProperties {
* <b>If true</b>, values of type OTHER will be stored in serialized form
* and have the semantics of binary data for all operations (such as sorting and conversion to string).
* <br />
* <b>If false</b>, the objects will be serialized only for I/O operations and few other special cases
* <b>If false</b>, the objects will be serialized only for I/O operations and
a
few other special cases
* (for example when someone tries to get the value in binary form or when comparing objects
*
other way than in binary form is impossibl
e).
*
that are not comparable otherwis
e).
* <br />
* If the object implements the Comparable interface, the method compareTo
* If the object implements the Comparable interface, the method compareTo
* will be used for sorting (but only if objects being compared have a common comparable
* super type). Otherwise the objects will be compared by type
s
, and if they are the same by hashCode, and
* super type). Otherwise the objects will be compared by type, and if they are the same by hashCode, and
* if the hash codes are equal, but objects are not, the serialized forms (the byte arrays) are compared.
* <br />
* The string representation of the values use the toString method of object.
...
...
@@ -388,7 +388,7 @@ public class SysProperties {
* and display size.
* <br />
* In embedded mode, no data copying occurs, so the user has to make defensive copy himself before storing,
*
to make sure that value object is immutable and will not be modified later
.
*
or ensure that the value object is immutable
.
*/
public
static
final
boolean
SERIALIZE_JAVA_OBJECT
=
Utils
.
getProperty
(
"h2.serializeJavaObject"
,
true
);
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
55edf736
...
...
@@ -78,6 +78,7 @@ import org.h2.test.jdbc.TestCallableStatement;
import
org.h2.test.jdbc.TestCancel
;
import
org.h2.test.jdbc.TestDatabaseEventListener
;
import
org.h2.test.jdbc.TestDriver
;
import
org.h2.test.jdbc.TestJavaObject
;
import
org.h2.test.jdbc.TestLimitUpdates
;
import
org.h2.test.jdbc.TestLobApi
;
import
org.h2.test.jdbc.TestManyJdbcObjects
;
...
...
@@ -611,6 +612,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new
TestCancel
().
runTest
(
this
);
new
TestDatabaseEventListener
().
runTest
(
this
);
new
TestDriver
().
runTest
(
this
);
new
TestJavaObject
().
runTest
(
this
);
new
TestLimitUpdates
().
runTest
(
this
);
new
TestLobApi
().
runTest
(
this
);
new
TestManyJdbcObjects
().
runTest
(
this
);
...
...
h2/src/test/org/h2/test/jdbc/TestJavaObject.java
浏览文件 @
55edf736
...
...
@@ -21,7 +21,8 @@ import org.h2.test.TestAll;
import
org.h2.test.TestBase
;
/**
* Tests java object values when {@link SysProperties#SERIALIZE_JAVA_OBJECT} property is disabled.
* Tests java object values when SysProperties.SERIALIZE_JAVA_OBJECT property is
* disabled.
*
* @author Sergi Vladykin
*/
...
...
@@ -38,7 +39,7 @@ public class TestJavaObject extends TestBase {
TestAll
conf
=
new
TestAll
();
conf
.
traceTest
=
true
;
conf
.
memory
=
true
;
//
conf.networked = true;
//
conf.networked = true;
TestBase
.
createCaller
().
init
(
conf
).
test
();
}
...
...
@@ -83,7 +84,8 @@ public class TestJavaObject extends TestBase {
x
=
o1
.
hashCode
()
<
o2
.
hashCode
()
?
o1
:
o2
;
}
}
else
{
int
cmp
=
((
Comparable
)
o1
).
compareTo
(
o2
);
@SuppressWarnings
(
"unchecked"
)
int
cmp
=
((
Comparable
<
Object
>)
o1
).
compareTo
(
o2
);
assertFalse
(
cmp
==
0
);
x
=
cmp
<
0
?
o1
:
o2
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论