Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e299cfc2
提交
e299cfc2
authored
1月 08, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
4b0fe6a5
显示空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
126 行增加
和
108 行删除
+126
-108
Select.java
h2/src/main/org/h2/command/dml/Select.java
+8
-8
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-2
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+12
-0
FtpClient.java
h2/src/test/org/h2/test/unit/FtpClient.java
+22
-19
TestBitField.java
h2/src/test/org/h2/test/unit/TestBitField.java
+3
-4
TestCache.java
h2/src/test/org/h2/test/unit/TestCache.java
+3
-0
TestCompress.java
h2/src/test/org/h2/test/unit/TestCompress.java
+3
-59
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+3
-4
TestDate.java
h2/src/test/org/h2/test/unit/TestDate.java
+6
-0
TestExit.java
h2/src/test/org/h2/test/unit/TestExit.java
+4
-0
TestFile.java
h2/src/test/org/h2/test/unit/TestFile.java
+4
-1
TestFileLock.java
h2/src/test/org/h2/test/unit/TestFileLock.java
+2
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+3
-0
TestFtp.java
h2/src/test/org/h2/test/unit/TestFtp.java
+3
-0
TestIntArray.java
h2/src/test/org/h2/test/unit/TestIntArray.java
+3
-0
TestIntIntHashMap.java
h2/src/test/org/h2/test/unit/TestIntIntHashMap.java
+3
-0
TestMultiThreadedKernel.java
h2/src/test/org/h2/test/unit/TestMultiThreadedKernel.java
+5
-2
TestOverflow.java
h2/src/test/org/h2/test/unit/TestOverflow.java
+4
-0
TestPattern.java
h2/src/test/org/h2/test/unit/TestPattern.java
+3
-3
TestReader.java
h2/src/test/org/h2/test/unit/TestReader.java
+3
-0
TestSampleApps.java
h2/src/test/org/h2/test/unit/TestSampleApps.java
+3
-0
TestScriptReader.java
h2/src/test/org/h2/test/unit/TestScriptReader.java
+3
-0
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+3
-4
TestStreams.java
h2/src/test/org/h2/test/unit/TestStreams.java
+3
-0
TestStringCache.java
h2/src/test/org/h2/test/unit/TestStringCache.java
+3
-0
TestStringUtils.java
h2/src/test/org/h2/test/unit/TestStringUtils.java
+3
-0
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+3
-0
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+4
-1
TestValueHashMap.java
h2/src/test/org/h2/test/unit/TestValueHashMap.java
+3
-0
没有找到文件。
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
e299cfc2
...
...
@@ -547,14 +547,6 @@ public class Select extends Query {
}
}
cost
=
preparePlan
();
if
(
sort
!=
null
&&
!
isQuickQuery
&&
!
isGroupQuery
&&
!
distinct
)
{
Index
index
=
getSortIndex
();
Index
current
=
topTableFilter
.
getIndex
();
if
(
index
!=
null
&&
(
current
.
getIndexType
().
isScan
()
||
current
==
index
))
{
topTableFilter
.
setIndex
(
index
);
sortUsingIndex
=
true
;
}
}
if
(
SysProperties
.
OPTIMIZE_DISTINCT
&&
distinct
&&
!
isGroupQuery
&&
filters
.
size
()
==
1
&&
expressions
.
size
()
==
1
&&
condition
==
null
)
{
Expression
expr
=
(
Expression
)
expressions
.
get
(
0
);
expr
=
expr
.
getNonAliasExpression
();
...
...
@@ -578,6 +570,14 @@ public class Select extends Query {
}
}
}
if
(
sort
!=
null
&&
!
isQuickQuery
&&
!
isGroupQuery
&&
(!
distinct
||
isDistinctQuery
))
{
Index
index
=
getSortIndex
();
Index
current
=
topTableFilter
.
getIndex
();
if
(
index
!=
null
&&
(
current
.
getIndexType
().
isScan
()
||
current
==
index
))
{
topTableFilter
.
setIndex
(
index
);
sortUsingIndex
=
true
;
}
}
}
public
double
getCost
()
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
e299cfc2
...
...
@@ -149,8 +149,7 @@ java org.h2.test.TestAll timer
/*
(code coverage: limit, sample-size)
add tests with select distinct type
check no more @author
staging.trace.db.gz
...
...
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
e299cfc2
...
...
@@ -70,6 +70,18 @@ public class TestOptimizations extends TestBase {
check
(
i
,
rs
.
getInt
(
1
));
}
checkFalse
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"SELECT DISTINCT TYPE FROM TEST ORDER BY TYPE LIMIT 5 OFFSET 2"
);
for
(
int
i
=
2
;
i
<
7
;
i
++)
{
rs
.
next
();
check
(
i
,
rs
.
getInt
(
1
));
}
checkFalse
(
rs
.
next
());
rs
=
stat
.
executeQuery
(
"SELECT DISTINCT TYPE FROM TEST ORDER BY TYPE LIMIT 0 OFFSET 0 SAMPLE_SIZE 3"
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
rs
.
next
();
check
(
i
,
rs
.
getInt
(
1
));
}
checkFalse
(
rs
.
next
());
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/unit/FtpClient.java
浏览文件 @
e299cfc2
...
...
@@ -21,6 +21,9 @@ import org.h2.util.IOUtils;
import
org.h2.util.NetUtils
;
import
org.h2.util.StringUtils
;
/**
* A simple standalone FTP client.
*/
public
class
FtpClient
{
private
Socket
socket
;
private
BufferedReader
reader
;
...
...
h2/src/test/org/h2/test/unit/TestBitField.java
浏览文件 @
e299cfc2
...
...
@@ -11,9 +11,8 @@ import org.h2.test.TestBase;
import
org.h2.util.BitField
;
/**
*
@author Thomas
*
A unit test for bit fields.
*/
public
class
TestBitField
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestCache.java
浏览文件 @
e299cfc2
...
...
@@ -11,6 +11,9 @@ import java.util.Random;
import
org.h2.test.TestBase
;
/**
* Tests the cache.
*/
public
class
TestCache
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestCompress.java
浏览文件 @
e299cfc2
...
...
@@ -9,67 +9,11 @@ import java.util.Random;
import
org.h2.test.TestBase
;
import
org.h2.tools.CompressTool
;
/**
* Data compression tests.
*/
public
class
TestCompress
extends
TestBase
{
public
static
void
main
(
String
[]
a
)
throws
Exception
{
byte
[]
data
=
new
byte
[
1000
];
long
total
=
0
;
for
(
int
i
=
100
;
i
<
104
;
i
++)
{
long
time
=
System
.
currentTimeMillis
();
for
(
int
j
=
0
;
j
<
10000000
;
j
++)
{
// System.arraycopy(data, 0, data, 100, 11);
// for (int k = 0, n = 100; k < 11; k++) {
// data[k] = data[n++];
// }
int
outPos
=
0
,
ctrl
=
100
,
len
=
i
;
// do {
// switch((len - outPos) & 7) {
// case 0:
// data[outPos] = data[outPos++ + ctrl];
// case 7:
// data[outPos] = data[outPos++ + ctrl];
// case 6:
// data[outPos] = data[outPos++ + ctrl];
// case 5:
// data[outPos] = data[outPos++ + ctrl];
// case 4:
// data[outPos] = data[outPos++ + ctrl];
// case 3:
// data[outPos] = data[outPos++ + ctrl];
// case 2:
// data[outPos] = data[outPos++ + ctrl];
// case 1:
// data[outPos] = data[outPos++ + ctrl];
// }
// } while(outPos < len);
//
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
while
(
outPos
<
len
-
8
)
{
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
}
while
(
outPos
<
len
)
{
data
[
outPos
]
=
data
[
outPos
++
+
ctrl
];
}
}
// now: 8907/11859, switch: 9078/14782
long
t
=
(
System
.
currentTimeMillis
()
-
time
);
total
+=
t
;
System
.
out
.
println
(
"i: "
+
i
+
" time: "
+
t
);
}
System
.
out
.
println
(
"total: "
+
total
);
}
public
void
test
()
throws
Exception
{
if
(
config
.
big
)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
...
...
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
e299cfc2
...
...
@@ -18,9 +18,8 @@ import org.h2.value.ValueNull;
import
org.h2.value.ValueString
;
/**
*
@author Thomas
*
Data page tests.
*/
public
class
TestDataPage
extends
TestBase
implements
DataHandler
{
boolean
text
;
...
...
h2/src/test/org/h2/test/unit/TestDate.java
浏览文件 @
e299cfc2
...
...
@@ -11,6 +11,12 @@ import org.h2.test.TestBase;
import
org.h2.util.DateTimeUtils
;
import
org.h2.value.Value
;
/**
* Tests the data parsing.
* The problem is that some dates are not allowed because of the summer time change.
* Most countries change at 2 o'clock in the morning to 3 o'clock, but some
* (for example Chile) change at midnight. Non-lenient parsing wouldn't work in this case.
*/
public
class
TestDate
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestExit.java
浏览文件 @
e299cfc2
...
...
@@ -13,6 +13,10 @@ import java.sql.SQLException;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.test.TestBase
;
/**
* Tests the flag db_close_on_exit.
* A new process is started.
*/
public
class
TestExit
extends
TestBase
implements
DatabaseEventListener
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestFile.java
浏览文件 @
e299cfc2
...
...
@@ -12,6 +12,9 @@ import org.h2.test.TestBase;
import
org.h2.util.FileUtils
;
import
org.h2.value.Value
;
/**
* Tests the in-memory file system.
*/
public
class
TestFile
extends
TestBase
implements
DataHandler
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestFileLock.java
浏览文件 @
e299cfc2
...
...
@@ -11,7 +11,8 @@ import org.h2.store.FileLock;
import
org.h2.test.TestBase
;
/**
* @author Thomas
* Tests the database file locking facility.
* Both lock files and sockets locking is tested.
*/
public
class
TestFileLock
extends
TestBase
implements
Runnable
{
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
e299cfc2
...
...
@@ -19,6 +19,9 @@ import org.h2.store.fs.FileObject;
import
org.h2.store.fs.FileSystem
;
import
org.h2.test.TestBase
;
/**
* Tests various file system.
*/
public
class
TestFileSystem
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestFtp.java
浏览文件 @
e299cfc2
...
...
@@ -10,6 +10,9 @@ import org.h2.server.ftp.FtpServer;
import
org.h2.test.TestBase
;
import
org.h2.tools.Server
;
/**
* Tests the FTP server tool.
*/
public
class
TestFtp
extends
TestBase
implements
FtpEventListener
{
private
FtpEvent
lastEvent
;
...
...
h2/src/test/org/h2/test/unit/TestIntArray.java
浏览文件 @
e299cfc2
...
...
@@ -9,6 +9,9 @@ import java.util.Random;
import
org.h2.test.TestBase
;
import
org.h2.util.IntArray
;
/**
* Tests the IntArray class.
*/
public
class
TestIntArray
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestIntIntHashMap.java
浏览文件 @
e299cfc2
...
...
@@ -9,6 +9,9 @@ import java.util.Random;
import
org.h2.test.TestBase
;
import
org.h2.util.IntIntHashMap
;
/**
* Tests the IntHashMap class.
*/
public
class
TestIntIntHashMap
extends
TestBase
{
Random
rand
=
new
Random
();
...
...
h2/src/test/org/h2/test/unit/TestMultiThreadedKernel.java
浏览文件 @
e299cfc2
...
...
@@ -11,6 +11,9 @@ import java.sql.SQLException;
import
org.h2.test.TestBase
;
/**
* Tests the multi-threaded kernel feature.
*/
public
class
TestMultiThreadedKernel
extends
TestBase
implements
Runnable
{
private
String
url
,
user
,
password
;
...
...
h2/src/test/org/h2/test/unit/TestOverflow.java
浏览文件 @
e299cfc2
...
...
@@ -14,6 +14,10 @@ import org.h2.test.TestBase;
import
org.h2.value.Value
;
import
org.h2.value.ValueString
;
/**
* Tests numeric overflow on various data types.
* Other than in Java, overflow is detected and an exception is thrown.
*/
public
class
TestOverflow
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestPattern.java
浏览文件 @
e299cfc2
...
...
@@ -9,7 +9,7 @@ import org.h2.test.TestBase;
import
org.h2.value.CompareMode
;
/**
*
@author Thomas
*
Tests LIKE pattern matching.
*/
public
class
TestPattern
extends
TestBase
{
...
...
h2/src/test/org/h2/test/unit/TestReader.java
浏览文件 @
e299cfc2
...
...
@@ -12,6 +12,9 @@ import java.io.StringReader;
import
org.h2.test.TestBase
;
import
org.h2.util.IOUtils
;
/**
* Tests the stream to UTF-8 reader conversion.
*/
public
class
TestReader
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestSampleApps.java
浏览文件 @
e299cfc2
...
...
@@ -12,6 +12,9 @@ import org.h2.test.TestBase;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.util.StringUtils
;
/**
* Tests the sample apps.
*/
public
class
TestSampleApps
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestScriptReader.java
浏览文件 @
e299cfc2
...
...
@@ -10,6 +10,9 @@ import java.util.Random;
import
org.h2.test.TestBase
;
import
org.h2.util.ScriptReader
;
/**
* Tests the script reader tool that breaks up SQL scripts in statements.
*/
public
class
TestScriptReader
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
e299cfc2
...
...
@@ -11,9 +11,8 @@ import org.h2.test.TestBase;
import
org.h2.util.ByteUtils
;
/**
*
@author Thomas
*
Tests various security primitives.
*/
public
class
TestSecurity
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestStreams.java
浏览文件 @
e299cfc2
...
...
@@ -12,6 +12,9 @@ import org.h2.compress.LZFInputStream;
import
org.h2.compress.LZFOutputStream
;
import
org.h2.test.TestBase
;
/**
* Tests the LZF stream.
*/
public
class
TestStreams
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestStringCache.java
浏览文件 @
e299cfc2
...
...
@@ -9,6 +9,9 @@ import java.util.Random;
import
org.h2.test.TestBase
;
import
org.h2.util.StringCache
;
/**
* Tests the string cache facility.
*/
public
class
TestStringCache
extends
TestBase
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestStringUtils.java
浏览文件 @
e299cfc2
...
...
@@ -12,6 +12,9 @@ import java.util.Random;
import
org.h2.test.TestBase
;
import
org.h2.util.StringUtils
;
/**
* Tests string utility methods.
*/
public
class
TestStringUtils
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
e299cfc2
...
...
@@ -30,6 +30,9 @@ import org.h2.tools.Script;
import
org.h2.tools.Server
;
import
org.h2.util.Resources
;
/**
* Tests the database tools.
*/
public
class
TestTools
extends
TestBase
{
private
Server
server
;
...
...
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
e299cfc2
...
...
@@ -7,6 +7,9 @@ package org.h2.test.unit;
import
org.h2.test.TestBase
;
import
org.h2.value.ValueUuid
;
/**
* Tests features of values.
*/
public
class
TestValue
extends
TestBase
{
public
void
test
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestValueHashMap.java
浏览文件 @
e299cfc2
...
...
@@ -18,6 +18,9 @@ import org.h2.value.CompareMode;
import
org.h2.value.Value
;
import
org.h2.value.ValueInt
;
/**
* Tests the value hash map.
*/
public
class
TestValueHashMap
extends
TestBase
implements
DataHandler
{
CompareMode
compareMode
=
new
CompareMode
(
null
,
null
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论