Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b5faeeb0
提交
b5faeeb0
authored
10月 17, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Queries with more than 10 joins are now faster.
上级
51821000
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
1333 行增加
和
1222 行删除
+1333
-1222
changelog.html
h2/src/docsrc/html/changelog.html
+7
-6
roadmap.html
h2/src/docsrc/html/roadmap.html
+1
-1
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+417
-402
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+417
-402
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+408
-403
Optimizer.java
h2/src/main/org/h2/command/dml/Optimizer.java
+8
-5
_messages_es.properties
h2/src/main/org/h2/res/_messages_es.properties
+1
-1
MathUtils.java
h2/src/main/org/h2/util/MathUtils.java
+26
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
TestLinkedTable.java
h2/src/test/org/h2/test/db/TestLinkedTable.java
+2
-1
TestMathUtils.java
h2/src/test/org/h2/test/unit/TestMathUtils.java
+42
-0
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+2
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
b5faeeb0
...
...
@@ -18,15 +18,16 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Opening a connection with AUTO_SERVER=TRUE is now fast
when the database is already open in another process (less than 0.01 seconds
instead of 2 seconds).
<ul><li>
Queries with more than 10 joins are now faster.
</li><li>
Opening a connection with AUTO_SERVER=TRUE is now fast
when the database is already open in another process (less than 0.01 seconds
instead of 2 seconds).
</li><li>
IF NOT EXISTS is supported for named constraints in
ALTER TABLE ... ADD CONSTRAINT.
ALTER TABLE ... ADD CONSTRAINT.
</li><li>
IF EXISTS is supported for named constraints in
ALTER TABLE ... DROP CONSTRAINT.
ALTER TABLE ... DROP CONSTRAINT.
</li><li>
The error messages have been translated to Spanish by Dario V. Fassi.
Thanks a lot!
Thanks a lot!
</li><li>
Linked tables: the automatic connection sharing didn't work. Actually the
system property h2.shareLinkedConnections was working in the opposite direction:
it was disabled when set to true. Now it works as expected.
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
b5faeeb0
...
...
@@ -306,7 +306,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches
move Products that Work with H2 to Comparison,
move Performance Tuning to Advanced Topics
</li><li>
Support JMX: Create an MBean for each database and server (support JConsole).
See http://thedevcloud.blogspot.com/2008/10/displaying-hsql-database-manager-in.html
See http://thedevcloud.blogspot.com/2008/10/displaying-hsql-database-manager-in.html
</li><li>
Translation: use ${.} in help.csv
</li><li>
Translated .pdf
</li><li>
Cluster: hot deploy (adding a node on runtime)
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
b5faeeb0
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
b5faeeb0
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
b5faeeb0
差异被折叠。
点击展开。
h2/src/main/org/h2/command/dml/Optimizer.java
浏览文件 @
b5faeeb0
...
...
@@ -6,6 +6,7 @@
*/
package
org
.
h2
.
command
.
dml
;
import
java.math.BigInteger
;
import
java.sql.SQLException
;
import
java.util.BitSet
;
import
java.util.Random
;
...
...
@@ -15,6 +16,7 @@ import org.h2.expression.Expression;
import
org.h2.table.Plan
;
import
org.h2.table.PlanItem
;
import
org.h2.table.TableFilter
;
import
org.h2.util.MathUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.Permutations
;
...
...
@@ -25,8 +27,8 @@ import org.h2.util.Permutations;
public
class
Optimizer
{
private
static
final
int
MAX_BRUTE_FORCE_FILTERS
=
7
;
private
static
final
int
MAX_BRUTE_FORCE
=
2000
;
private
static
final
int
MAX_GENETIC
=
20
00
;
private
static
final
BigInteger
MAX_BRUTE_FORCE
=
new
BigInteger
(
""
+
2000
)
;
private
static
final
int
MAX_GENETIC
=
5
00
;
private
long
start
;
private
BitSet
switched
;
...
...
@@ -62,10 +64,11 @@ public class Optimizer {
}
private
int
getMaxBruteForceFilters
(
int
filterCount
)
{
int
i
=
0
,
j
=
filterCount
,
total
=
filterCount
;
while
(
j
>
0
&&
total
<
MAX_BRUTE_FORCE
)
{
int
i
=
0
,
j
=
filterCount
;
BigInteger
total
=
new
BigInteger
(
""
+
filterCount
);
while
(
j
>
0
&&
total
.
compareTo
(
MAX_BRUTE_FORCE
)
<
0
)
{
j
--;
total
*=
j
;
total
=
total
.
multiply
(
MathUtils
.
factorial
(
j
))
;
i
++;
}
return
i
;
...
...
h2/src/main/org/h2/res/_messages_es.properties
浏览文件 @
b5faeeb0
...
...
@@ -39,7 +39,7 @@
90015
=
SUM
\u
00F3 AVG sobre un tipo de datos invalidado para {0}
90016
=
La columna {0} debe estar incluida en la lista de GROUP BY
90017
=
Intento de definir una segunda clave primaria
90018
=
La conexi
\u
00F3n no fue cerrada por la aplicaci
\u
00F3n y esta siendo limpiada
\(
garbage collected
\
)
90018
=
La conexi
\u
00F3n no fue cerrada por la aplicaci
\u
00F3n y esta siendo limpiada
(garbage collected
)
90019
=
Imposible eliminar el usuario actual
90020
=
La base de datos puede que ya est
\u
00E9 siendo utilizada
\:
{0}. Soluciones Posibles
\:
cierre todas las otras conexiones; use el modo server
90021
=
Conversi
\u
00F3n de datos fallida, convirtiendo {0}
...
...
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
b5faeeb0
...
...
@@ -7,6 +7,7 @@
package
org
.
h2
.
util
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.sql.SQLException
;
import
org.h2.engine.Constants
;
...
...
@@ -178,4 +179,29 @@ public class MathUtils {
}
}
/**
* Calculate the factorial (n!) of a number.
* This implementation uses a naive multiplication loop, and
* is very slow for large n.
* For n = 1000, it takes about 10 ms.
* For n = 8000, it takes about 800 ms.
*
* @param n the number
* @return the factorial of n
*/
public
static
BigInteger
factorial
(
int
n
)
{
if
(
n
<
0
)
{
throw
new
IllegalArgumentException
(
n
+
"<0"
);
}
else
if
(
n
<
2
)
{
return
BigInteger
.
ONE
;
}
BigInteger
x
=
new
BigInteger
(
""
+
n
);
BigInteger
result
=
x
;
for
(
int
i
=
n
-
1
;
i
>=
2
;
i
--)
{
x
=
x
.
subtract
(
BigInteger
.
ONE
);
result
=
result
.
multiply
(
x
);
}
return
result
;
}
}
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
b5faeeb0
...
...
@@ -110,6 +110,7 @@ import org.h2.test.unit.TestFileSystem;
import
org.h2.test.unit.TestFtp
;
import
org.h2.test.unit.TestIntArray
;
import
org.h2.test.unit.TestIntIntHashMap
;
import
org.h2.test.unit.TestMathUtils
;
import
org.h2.test.unit.TestMultiThreadedKernel
;
import
org.h2.test.unit.TestOverflow
;
import
org.h2.test.unit.TestPattern
;
...
...
@@ -603,6 +604,7 @@ http://www.w3schools.com/sql/
new
TestFileSystem
().
runTest
(
this
);
new
TestIntArray
().
runTest
(
this
);
new
TestIntIntHashMap
().
runTest
(
this
);
new
TestMathUtils
().
runTest
(
this
);
new
TestMultiThreadedKernel
().
runTest
(
this
);
new
TestOverflow
().
runTest
(
this
);
new
TestPattern
().
runTest
(
this
);
...
...
h2/src/test/org/h2/test/db/TestLinkedTable.java
浏览文件 @
b5faeeb0
...
...
@@ -15,6 +15,7 @@ import java.sql.SQLException;
import
java.sql.Statement
;
import
java.sql.Timestamp
;
import
org.h2.constant.SysProperties
;
import
org.h2.test.TestBase
;
/**
...
...
@@ -65,7 +66,7 @@ public class TestLinkedTable extends TestBase {
// }
private
void
testSharedConnection
()
throws
SQLException
{
if
(
config
.
memory
)
{
if
(
config
.
memory
||
!
SysProperties
.
SHARE_LINKED_CONNECTIONS
)
{
return
;
}
org
.
h2
.
Driver
.
load
();
...
...
h2/src/test/org/h2/test/unit/TestMathUtils.java
0 → 100644
浏览文件 @
b5faeeb0
/*
* Copyright 2004-2008 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
test
.
unit
;
import
java.sql.SQLException
;
import
org.h2.test.TestBase
;
import
org.h2.util.MathUtils
;
/**
* Tests math utility methods.
*/
public
class
TestMathUtils
extends
TestBase
{
/**
* Run just this test.
*
* @param a ignored
*/
public
static
void
main
(
String
[]
a
)
throws
Exception
{
TestBase
.
createCaller
().
init
().
test
();
}
public
void
test
()
throws
SQLException
{
try
{
MathUtils
.
factorial
(-
1
);
fail
();
}
catch
(
IllegalArgumentException
e
)
{
// ignore
}
assertEquals
(
"1"
,
MathUtils
.
factorial
(
0
).
toString
());
assertEquals
(
"1"
,
MathUtils
.
factorial
(
1
).
toString
());
assertEquals
(
"2"
,
MathUtils
.
factorial
(
2
).
toString
());
assertEquals
(
"6"
,
MathUtils
.
factorial
(
3
).
toString
());
assertEquals
(
"3628800"
,
MathUtils
.
factorial
(
10
).
toString
());
assertEquals
(
"2432902008176640000"
,
MathUtils
.
factorial
(
20
).
toString
());
}
}
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
b5faeeb0
...
...
@@ -566,4 +566,5 @@ implies looping cataloguing mapper frees javaw geographic borges grass
somehow marcio groove roy gis matt targeted brazil dig opt deregister
classname recaptcha unload unloaded unloads activator statistic hence rathsack
reflects doy bloom minimal gmx conserve panic serious robert thursday
wednesday saturday friday tuesday sharing opposite fassi dario clauses
\ No newline at end of file
wednesday saturday friday tuesday sharing opposite fassi dario clauses
factorial blogspot displaying thedevcloud
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论