Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8c67eba9
提交
8c67eba9
authored
6月 26, 2015
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #146 from svladykin/compare-mode2
Improved CompareMode
上级
a0c715b5
8f08cb90
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
64 行增加
和
21 行删除
+64
-21
ScriptBase.java
h2/src/main/org/h2/command/dml/ScriptBase.java
+6
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-0
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+8
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+1
-2
DataHandler.java
h2/src/main/org/h2/store/DataHandler.java
+8
-0
Recover.java
h2/src/main/org/h2/tools/Recover.java
+6
-1
CompareMode.java
h2/src/main/org/h2/value/CompareMode.java
+14
-14
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+4
-0
TestFile.java
h2/src/test/org/h2/test/unit/TestFile.java
+5
-1
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+5
-0
TestValueMemory.java
h2/src/test/org/h2/test/unit/TestValueMemory.java
+6
-1
没有找到文件。
h2/src/main/org/h2/command/dml/ScriptBase.java
浏览文件 @
8c67eba9
...
...
@@ -10,7 +10,6 @@ import java.io.BufferedOutputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.JavaObjectSerializer
;
import
org.h2.command.Prepared
;
...
...
@@ -31,6 +30,7 @@ import org.h2.tools.CompressTool;
import
org.h2.util.IOUtils
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.TempFileDeleter
;
import
org.h2.value.CompareMode
;
/**
* This class is the base for RunScriptCommand and ScriptCommand.
...
...
@@ -259,4 +259,9 @@ abstract class ScriptBase extends Prepared implements DataHandler {
public
JavaObjectSerializer
getJavaObjectSerializer
()
{
return
session
.
getDataHandler
().
getJavaObjectSerializer
();
}
@Override
public
CompareMode
getCompareMode
()
{
return
session
.
getDataHandler
().
getCompareMode
();
}
}
h2/src/main/org/h2/engine/Database.java
浏览文件 @
8c67eba9
...
...
@@ -1530,6 +1530,7 @@ public class Database implements DataHandler {
return
cluster
;
}
@Override
public
CompareMode
getCompareMode
()
{
return
compareMode
;
}
...
...
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
8c67eba9
...
...
@@ -8,7 +8,6 @@ package org.h2.engine;
import
java.io.IOException
;
import
java.net.Socket
;
import
java.util.ArrayList
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.JavaObjectSerializer
;
...
...
@@ -32,6 +31,7 @@ import org.h2.util.New;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.StringUtils
;
import
org.h2.util.TempFileDeleter
;
import
org.h2.value.CompareMode
;
import
org.h2.value.Transfer
;
import
org.h2.value.Value
;
...
...
@@ -91,6 +91,8 @@ public class SessionRemote extends SessionWithState implements DataHandler {
private
JavaObjectSerializer
javaObjectSerializer
;
private
volatile
boolean
javaObjectSerializerInitialized
;
private
CompareMode
compareMode
=
CompareMode
.
getInstance
(
null
,
0
);
public
SessionRemote
(
ConnectionInfo
ci
)
{
this
.
connectionInfo
=
ci
;
}
...
...
@@ -846,4 +848,9 @@ public class SessionRemote extends SessionWithState implements DataHandler {
public
void
addTemporaryLob
(
Value
v
)
{
// do nothing
}
@Override
public
CompareMode
getCompareMode
()
{
return
compareMode
;
}
}
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
8c67eba9
...
...
@@ -81,7 +81,6 @@ public class JdbcConnection extends TraceObject implements Connection {
private
int
savepointId
;
private
String
catalog
;
private
Statement
executingStatement
;
private
final
CompareMode
compareMode
=
CompareMode
.
getInstance
(
null
,
0
);
private
final
CloseWatcher
watcher
;
private
int
queryTimeoutCache
=
-
1
;
...
...
@@ -1938,7 +1937,7 @@ public class JdbcConnection extends TraceObject implements Connection {
}
CompareMode
getCompareMode
()
{
return
compareMode
;
return
session
.
getDataHandler
().
getCompareMode
();
}
/**
...
...
h2/src/main/org/h2/store/DataHandler.java
浏览文件 @
8c67eba9
...
...
@@ -9,6 +9,7 @@ import org.h2.api.JavaObjectSerializer;
import
org.h2.message.DbException
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.TempFileDeleter
;
import
org.h2.value.CompareMode
;
/**
* A data handler contains a number of callback methods, mostly related to CLOB
...
...
@@ -113,4 +114,11 @@ public interface DataHandler {
* column of type OTHER
*/
JavaObjectSerializer
getJavaObjectSerializer
();
/**
* Return compare mode.
*
* @return Compare mode.
*/
CompareMode
getCompareMode
();
}
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
8c67eba9
...
...
@@ -28,7 +28,6 @@ import java.util.Iterator;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.zip.CRC32
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.JavaObjectSerializer
;
import
org.h2.compress.CompressLZF
;
...
...
@@ -72,6 +71,7 @@ import org.h2.util.StringUtils;
import
org.h2.util.TempFileDeleter
;
import
org.h2.util.Tool
;
import
org.h2.util.Utils
;
import
org.h2.value.CompareMode
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueLob
;
...
...
@@ -1730,4 +1730,9 @@ public class Recover extends Tool implements DataHandler {
public
JavaObjectSerializer
getJavaObjectSerializer
()
{
return
null
;
}
@Override
public
CompareMode
getCompareMode
()
{
return
CompareMode
.
getInstance
(
null
,
0
);
}
}
h2/src/main/org/h2/value/CompareMode.java
浏览文件 @
8c67eba9
...
...
@@ -47,7 +47,7 @@ public class CompareMode {
*/
public
static
final
String
UNSIGNED
=
"UNSIGNED"
;
private
static
CompareMode
lastUsed
;
private
static
volatile
CompareMode
lastUsed
;
private
static
final
boolean
CAN_USE_ICU4J
;
...
...
@@ -86,8 +86,7 @@ public class CompareMode {
* @param strength the collation strength
* @return the compare mode
*/
public
static
synchronized
CompareMode
getInstance
(
String
name
,
int
strength
)
{
public
static
CompareMode
getInstance
(
String
name
,
int
strength
)
{
return
getInstance
(
name
,
strength
,
SysProperties
.
SORT_BINARY_UNSIGNED
);
}
...
...
@@ -102,17 +101,18 @@ public class CompareMode {
* @param binaryUnsigned whether to compare binaries as unsigned
* @return the compare mode
*/
public
static
synchronized
CompareMode
getInstance
(
String
name
,
int
strength
,
boolean
binaryUnsigned
)
{
if
(
lastUsed
!=
null
)
{
if
(
StringUtils
.
equals
(
lastUsed
.
name
,
name
)
&&
lastUsed
.
strength
==
strength
&&
lastUsed
.
binaryUnsigned
==
binaryUnsigned
)
{
return
lastUsed
;
public
static
CompareMode
getInstance
(
String
name
,
int
strength
,
boolean
binaryUnsigned
)
{
CompareMode
last
;
if
((
last
=
lastUsed
)
!=
null
)
{
if
(
StringUtils
.
equals
(
last
.
name
,
name
)
&&
last
.
strength
==
strength
&&
last
.
binaryUnsigned
==
binaryUnsigned
)
{
return
last
;
}
}
if
(
name
==
null
||
name
.
equals
(
OFF
))
{
lastUsed
=
new
CompareMode
(
name
,
strength
,
binaryUnsigned
);
lastUsed
=
last
=
new
CompareMode
(
name
,
strength
,
binaryUnsigned
);
}
else
{
boolean
useICU4J
;
if
(
name
.
startsWith
(
ICU4J
))
{
...
...
@@ -125,12 +125,12 @@ public class CompareMode {
useICU4J
=
CAN_USE_ICU4J
;
}
if
(
useICU4J
)
{
lastUsed
=
new
CompareModeIcu4J
(
name
,
strength
,
binaryUnsigned
);
lastUsed
=
last
=
new
CompareModeIcu4J
(
name
,
strength
,
binaryUnsigned
);
}
else
{
lastUsed
=
new
CompareModeDefault
(
name
,
strength
,
binaryUnsigned
);
lastUsed
=
last
=
new
CompareModeDefault
(
name
,
strength
,
binaryUnsigned
);
}
}
return
last
Used
;
return
last
;
}
/**
...
...
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
8c67eba9
...
...
@@ -339,4 +339,8 @@ public class TestDataPage extends TestBase implements DataHandler {
return
null
;
}
@Override
public
CompareMode
getCompareMode
()
{
return
compareMode
;
}
}
h2/src/test/org/h2/test/unit/TestFile.java
浏览文件 @
8c67eba9
...
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
test
.
unit
;
import
java.util.Random
;
import
org.h2.api.JavaObjectSerializer
;
import
org.h2.store.DataHandler
;
import
org.h2.store.FileStore
;
...
...
@@ -15,6 +14,7 @@ import org.h2.store.fs.FileUtils;
import
org.h2.test.TestBase
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.TempFileDeleter
;
import
org.h2.value.CompareMode
;
/**
* Tests the in-memory file store.
...
...
@@ -197,4 +197,8 @@ public class TestFile extends TestBase implements DataHandler {
return
null
;
}
@Override
public
CompareMode
getCompareMode
()
{
return
CompareMode
.
getInstance
(
null
,
0
);
}
}
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
8c67eba9
...
...
@@ -171,4 +171,9 @@ public class TestValueHashMap extends TestBase implements DataHandler {
public
JavaObjectSerializer
getJavaObjectSerializer
()
{
return
null
;
}
@Override
public
CompareMode
getCompareMode
()
{
return
compareMode
;
}
}
h2/src/test/org/h2/test/unit/TestValueMemory.java
浏览文件 @
8c67eba9
...
...
@@ -12,7 +12,6 @@ import java.sql.SQLException;
import
java.util.ArrayList
;
import
java.util.IdentityHashMap
;
import
java.util.Random
;
import
org.h2.api.JavaObjectSerializer
;
import
org.h2.engine.Constants
;
import
org.h2.store.DataHandler
;
...
...
@@ -24,6 +23,7 @@ import org.h2.tools.SimpleResultSet;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.TempFileDeleter
;
import
org.h2.util.Utils
;
import
org.h2.value.CompareMode
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
...
...
@@ -288,4 +288,9 @@ public class TestValueMemory extends TestBase implements DataHandler {
public
JavaObjectSerializer
getJavaObjectSerializer
()
{
return
null
;
}
@Override
public
CompareMode
getCompareMode
()
{
return
CompareMode
.
getInstance
(
null
,
0
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论