Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
91eb57ed
提交
91eb57ed
authored
2月 24, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
95c8ef4c
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
71 行增加
和
10 行删除
+71
-10
changelog.html
h2/src/docsrc/html/changelog.html
+5
-1
Set.java
h2/src/main/org/h2/command/dml/Set.java
+3
-2
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+18
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-0
StartBrowser.java
h2/src/main/org/h2/util/StartBrowser.java
+11
-2
CompareMode.java
h2/src/main/org/h2/value/CompareMode.java
+28
-2
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
TestPattern.java
h2/src/test/org/h2/test/unit/TestPattern.java
+1
-1
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+1
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
91eb57ed
...
...
@@ -15,7 +15,11 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
UPDATE SET column=DEFAULT is now supported.
<li>
The performance of text comparison has been improved when using locale sensitive
string comparison (SET COLLATOR). Now CollationKey is used with a LRU cache.
The default cache size is 10000, and can be changed using the system property
h2.collatorCacheSize. Use 0 to disable the cache.
</li><li>
UPDATE SET column=DEFAULT is now supported.
</li></ul>
<h2>
Version 1.0.67 (2008-02-22)
</h2>
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
91eb57ed
...
...
@@ -10,6 +10,7 @@ import java.text.Collator;
import
org.h2.command.Prepared
;
import
org.h2.compress.Compressor
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Database
;
import
org.h2.engine.DbObject
;
import
org.h2.engine.Mode
;
...
...
@@ -119,10 +120,10 @@ public class Set extends Prepared {
CompareMode
compareMode
;
StringBuffer
buff
=
new
StringBuffer
(
stringValue
);
if
(
stringValue
.
equals
(
CompareMode
.
OFF
))
{
compareMode
=
new
CompareMode
(
null
,
null
);
compareMode
=
new
CompareMode
(
null
,
null
,
0
);
}
else
{
Collator
coll
=
CompareMode
.
getCollator
(
stringValue
);
compareMode
=
new
CompareMode
(
coll
,
stringValue
);
compareMode
=
new
CompareMode
(
coll
,
stringValue
,
SysProperties
.
getCollatorCacheSize
()
);
buff
.
append
(
" STRENGTH "
);
if
(
getIntValue
()
==
Collator
.
IDENTICAL
)
{
buff
.
append
(
"IDENTICAL"
);
...
...
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
91eb57ed
...
...
@@ -31,6 +31,11 @@ public class SysProperties {
*/
public
static
final
String
H2_LOG_DELETE_DELAY
=
"h2.logDeleteDelay"
;
/**
* INTERNAL
*/
public
static
final
String
H2_COLLATOR_CACHE_SIZE
=
"h2.collatorCacheSize"
;
/**
* System property <code>file.encoding</code> (default: Cp1252).<br />
* It is usually set by the system and is the default encoding used for the RunScript and CSV tool.
...
...
@@ -339,6 +344,12 @@ public class SysProperties {
*/
public
static
final
int
LARGE_RESULT_BUFFER_SIZE
=
getIntSetting
(
"h2.largeResultBufferSize"
,
4
*
1024
);
/**
* System property <code>h2.collatorCacheSize</code> (default: 10000).<br />
* The cache size for collation keys (in elements). Used when a collator has been set for the database.
*/
public
static
final
int
COLLATOR_CACHE_SIZE
=
getCollatorCacheSize
();
private
static
String
baseDir
=
getStringSetting
(
"h2.baseDir"
,
null
);
private
static
boolean
getBooleanSetting
(
String
name
,
boolean
defaultValue
)
{
...
...
@@ -413,4 +424,11 @@ public class SysProperties {
public
static
int
getLogFileDeleteDelay
()
{
return
getIntSetting
(
H2_LOG_DELETE_DELAY
,
0
);
}
/**
* INTERNAL
*/
public
static
int
getCollatorCacheSize
()
{
return
getIntSetting
(
H2_COLLATOR_CACHE_SIZE
,
32000
);
}
}
h2/src/main/org/h2/engine/Database.java
浏览文件 @
91eb57ed
...
...
@@ -150,7 +150,7 @@ public class Database implements DataHandler {
private
int
maxOperationMemory
=
SysProperties
.
DEFAULT_MAX_OPERATION_MEMORY
;
public
Database
(
String
name
,
ConnectionInfo
ci
,
String
cipher
)
throws
SQLException
{
this
.
compareMode
=
new
CompareMode
(
null
,
null
);
this
.
compareMode
=
new
CompareMode
(
null
,
null
,
0
);
this
.
persistent
=
ci
.
isPersistent
();
this
.
filePasswordHash
=
ci
.
getFilePasswordHash
();
this
.
databaseName
=
name
;
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
91eb57ed
...
...
@@ -718,6 +718,7 @@ public class MetaTable extends Table {
add
(
rows
,
new
String
[]{
"h2.check"
,
""
+
SysProperties
.
CHECK
});
add
(
rows
,
new
String
[]{
"h2.check2"
,
""
+
SysProperties
.
CHECK2
});
add
(
rows
,
new
String
[]{
"h2.clientTraceDirectory"
,
SysProperties
.
CLIENT_TRACE_DIRECTORY
});
add
(
rows
,
new
String
[]{
SysProperties
.
H2_COLLATOR_CACHE_SIZE
,
""
+
SysProperties
.
getCollatorCacheSize
()});
add
(
rows
,
new
String
[]{
"h2.defaultMaxMemoryUndo"
,
""
+
SysProperties
.
DEFAULT_MAX_MEMORY_UNDO
});
add
(
rows
,
new
String
[]{
"h2.emergencySpaceInitial"
,
""
+
SysProperties
.
EMERGENCY_SPACE_INITIAL
});
add
(
rows
,
new
String
[]{
"h2.emergencySpaceMin"
,
""
+
SysProperties
.
EMERGENCY_SPACE_MIN
});
...
...
h2/src/main/org/h2/util/StartBrowser.java
浏览文件 @
91eb57ed
...
...
@@ -23,10 +23,19 @@ public class StartBrowser {
// Runtime.getRuntime().exec("open " + url + "/index.html");
Runtime
.
getRuntime
().
exec
(
"open "
+
url
);
}
else
{
System
.
out
.
println
(
"Please open a browser and go to "
+
url
);
try
{
Runtime
.
getRuntime
().
exec
(
"firefox "
+
url
);
}
catch
(
Exception
e
)
{
try
{
Runtime
.
getRuntime
().
exec
(
"mozilla-firefox "
+
url
);
}
catch
(
Exception
e2
)
{
// No success in detection.
System
.
out
.
println
(
"Please open a browser and go to "
+
url
);
}
}
}
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"Failed to start a browser to open the
url
"
+
url
);
System
.
out
.
println
(
"Failed to start a browser to open the
URL
"
+
url
);
e
.
printStackTrace
();
}
}
...
...
h2/src/main/org/h2/value/CompareMode.java
浏览文件 @
91eb57ed
...
...
@@ -4,9 +4,11 @@
*/
package
org
.
h2
.
value
;
import
java.text.CollationKey
;
import
java.text.Collator
;
import
java.util.Locale
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.StringUtils
;
/**
...
...
@@ -18,9 +20,15 @@ public class CompareMode {
public
static
final
String
OFF
=
"OFF"
;
private
final
Collator
collator
;
private
final
String
name
;
private
final
SmallLRUCache
collationKeys
;
public
CompareMode
(
Collator
collator
,
String
name
)
{
public
CompareMode
(
Collator
collator
,
String
name
,
int
cacheSize
)
{
this
.
collator
=
collator
;
if
(
collator
!=
null
&&
cacheSize
!=
0
)
{
collationKeys
=
new
SmallLRUCache
(
cacheSize
);
}
else
{
collationKeys
=
null
;
}
this
.
name
=
name
==
null
?
OFF
:
name
;
}
...
...
@@ -49,10 +57,28 @@ public class CompareMode {
a
=
a
.
toUpperCase
();
b
=
b
.
toUpperCase
();
}
int
comp
=
collator
.
compare
(
a
,
b
);
int
comp
;
if
(
collationKeys
!=
null
)
{
CollationKey
aKey
=
getKey
(
a
);
CollationKey
bKey
=
getKey
(
b
);
comp
=
aKey
.
compareTo
(
bKey
);
}
else
{
comp
=
collator
.
compare
(
a
,
b
);
}
return
comp
;
}
private
CollationKey
getKey
(
String
a
)
{
synchronized
(
collationKeys
)
{
CollationKey
key
=
(
CollationKey
)
collationKeys
.
get
(
a
);
if
(
key
==
null
)
{
key
=
collator
.
getCollationKey
(
a
);
collationKeys
.
put
(
a
,
key
);
}
return
key
;
}
}
public
static
String
getName
(
Locale
l
)
{
Locale
english
=
Locale
.
ENGLISH
;
String
name
=
l
.
getDisplayLanguage
(
english
)
+
' '
+
l
.
getDisplayCountry
(
english
)
+
' '
+
l
.
getVariant
();
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
91eb57ed
...
...
@@ -155,6 +155,8 @@ java org.h2.test.TestAll timer
/*
test startBrowser in Linux
fix or disable the linear hash index
delete old ipowerb content
...
...
h2/src/test/org/h2/test/unit/TestPattern.java
浏览文件 @
91eb57ed
...
...
@@ -14,7 +14,7 @@ import org.h2.value.CompareMode;
public
class
TestPattern
extends
TestBase
{
public
void
test
()
throws
Exception
{
CompareMode
mode
=
new
CompareMode
(
null
,
null
);
CompareMode
mode
=
new
CompareMode
(
null
,
null
,
100
);
CompareLike
comp
=
new
CompareLike
(
mode
,
null
,
null
,
null
,
false
);
test
(
comp
,
"B"
,
"%_"
);
test
(
comp
,
"A"
,
"A%"
);
...
...
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
91eb57ed
...
...
@@ -23,7 +23,7 @@ import org.h2.value.ValueInt;
*/
public
class
TestValueHashMap
extends
TestBase
implements
DataHandler
{
CompareMode
compareMode
=
new
CompareMode
(
null
,
null
);
CompareMode
compareMode
=
new
CompareMode
(
null
,
null
,
0
);
public
void
test
()
throws
Exception
{
ValueHashMap
map
=
new
ValueHashMap
(
this
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论