Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
91926786
提交
91926786
authored
12 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting / javadocs
上级
d95318e6
master
noel-pr1
plus33-master
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
version-1.4.191
version-1.4.190
version-1.4.188
version-1.4.187
version-1.4.186
version-1.4.185
version-1.4.184
version-1.4.183
version-1.4.182
version-1.4.181
version-1.4.178
version-1.4.177
version-1.3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
28 个修改的文件
包含
348 行增加
和
277 行删除
+348
-277
Parser.java
h2/src/main/org/h2/command/Parser.java
+1
-1
Select.java
h2/src/main/org/h2/command/dml/Select.java
+2
-2
SetTypes.java
h2/src/main/org/h2/command/dml/SetTypes.java
+1
-1
Mode.java
h2/src/main/org/h2/engine/Mode.java
+2
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+1
-1
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+6
-3
Index.java
h2/src/main/org/h2/index/Index.java
+1
-0
Chunk.java
h2/src/main/org/h2/mvstore/Chunk.java
+1
-1
DataUtils.java
h2/src/main/org/h2/mvstore/DataUtils.java
+1
-1
FreeSpaceList.java
h2/src/main/org/h2/mvstore/FreeSpaceList.java
+208
-208
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+6
-6
Page.java
h2/src/main/org/h2/mvstore/Page.java
+1
-1
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+1
-1
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+2
-2
MVTableEngine.java
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
+1
-1
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+72
-14
Table.java
h2/src/main/org/h2/table/Table.java
+1
-0
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+1
-1
CompareMode.java
h2/src/main/org/h2/value/CompareMode.java
+9
-6
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+1
-1
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+4
-4
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+7
-7
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+10
-5
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+3
-3
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+2
-2
TestPageStore.java
h2/src/test/org/h2/test/unit/TestPageStore.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
91926786
...
...
@@ -4718,7 +4718,7 @@ public class Parser {
}
throw
DbException
.
getInvalidValueException
(
"BINARY_COLLATION"
,
name
);
}
private
RunScriptCommand
parseRunScript
()
{
RunScriptCommand
command
=
new
RunScriptCommand
(
session
);
read
(
"FROM"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
91926786
...
...
@@ -1273,8 +1273,8 @@ public class Select extends Query {
return
false
;
}
public
SortOrder
prepare
Order
()
{
public
SortOrder
getSort
Order
()
{
return
sort
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/SetTypes.java
浏览文件 @
91926786
...
...
@@ -203,7 +203,7 @@ public class SetTypes {
* The type of a SET BINARY_COLLATION statement.
*/
public
static
final
int
BINARY_COLLATION
=
38
;
private
static
final
ArrayList
<
String
>
TYPES
=
New
.
arrayList
();
private
SetTypes
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
91926786
...
...
@@ -112,12 +112,12 @@ public class Mode {
* The function LOG() uses base 10 instead of E.
*/
public
boolean
logIsLogBase10
;
/**
* SERIAL and BIGSERIAL columns are not automatically primary keys.
*/
public
boolean
serialColumnIsNotPK
;
/**
* Swap the parameters of the CONVERT function.
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Function.java
浏览文件 @
91926786
...
...
@@ -242,7 +242,7 @@ public class Function extends Expression implements FunctionCall {
// 2 or 3 arguments
addFunction
(
"LOCATE"
,
LOCATE
,
VAR_ARGS
,
Value
.
INT
);
// alias for MSSQLServer
addFunction
(
"CHARINDEX"
,
LOCATE
,
VAR_ARGS
,
Value
.
INT
);
addFunction
(
"CHARINDEX"
,
LOCATE
,
VAR_ARGS
,
Value
.
INT
);
// same as LOCATE with 2 arguments
addFunction
(
"POSITION"
,
LOCATE
,
2
,
Value
.
INT
);
addFunction
(
"INSTR"
,
INSTR
,
VAR_ARGS
,
Value
.
INT
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
91926786
...
...
@@ -124,6 +124,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
*
* @param masks the search mask
* @param rowCount the number of rows in the index
* @param sortOrder the sort order
* @return the estimated cost
*/
protected
long
getCostRangeIndex
(
int
[]
masks
,
long
rowCount
,
SortOrder
sortOrder
)
{
...
...
@@ -163,8 +164,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
break
;
}
}
//
If the query ORDER BY clause matches the ordering of this index, it will be cheaper
//
than another index, so adjust the cost accordingly.
//
if the ORDER BY clause matches the ordering of this index,
//
it will be cheaper than another index, so adjust the cost accordingly
if
(
sortOrder
!=
null
)
{
int
[]
columnIndexes
=
new
int
[
indexColumns
.
length
];
int
[]
columnSortTypes
=
new
int
[
indexColumns
.
length
];
...
...
@@ -187,7 +188,9 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
coveringCount
++;
}
if
(
sortOrderMatches
)
{
// "coveringCount" makes sure that when we have two or more covering indexes, we choose the one that covers more
// "coveringCount" makes sure that when we have two
// or more covering indexes, we choose the one
// that covers more
cost
-=
coveringCount
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/Index.java
浏览文件 @
91926786
...
...
@@ -80,6 +80,7 @@ public interface Index extends SchemaObject {
* @param session the session
* @param masks per-column comparison bit masks, null means 'always false',
* see constants in IndexCondition
* @param sortOrder the sort order
* @return the estimated cost
*/
double
getCost
(
Session
session
,
int
[]
masks
,
SortOrder
sortOrder
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/Chunk.java
浏览文件 @
91926786
...
...
@@ -45,7 +45,7 @@ public class Chunk {
* The total number of pages in this chunk.
*/
int
pageCount
;
/**
* The number of pages still alive.
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/DataUtils.java
浏览文件 @
91926786
...
...
@@ -352,7 +352,7 @@ public class DataUtils {
file
,
src
.
remaining
(),
pos
,
e
);
}
}
/**
* Convert the length to a length code 0..31. 31 means more than 1 MB.
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/FreeSpaceList.java
浏览文件 @
91926786
差异被折叠。
点击展开。
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
91926786
...
...
@@ -1176,7 +1176,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
this
.
keyType
=
keyType
;
return
this
;
}
public
DataType
getKeyType
()
{
return
keyType
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
91926786
...
...
@@ -868,7 +868,7 @@ public class MVStore {
}
else
{
meta
.
put
(
"root."
+
m
.
getId
(),
String
.
valueOf
(
Integer
.
MAX_VALUE
));
}
}
}
Set
<
Chunk
>
removedChunks
=
applyFreedPages
(
storeVersion
,
time
);
ByteBuffer
buff
;
if
(
writeBuffer
!=
null
)
{
...
...
@@ -947,15 +947,15 @@ public class MVStore {
writeFileHeader
();
shrinkFileIfPossible
(
1
);
}
for
(
MVMap
<?,
?>
m
:
changed
)
{
Page
p
=
m
.
getRoot
();
if
(
p
.
getTotalCount
()
>
0
)
{
p
.
writeEnd
();
}
}
meta
.
getRoot
().
writeEnd
();
meta
.
getRoot
().
writeEnd
();
// some pages might have been changed in the meantime (in the newest version)
unsavedPageCount
=
Math
.
max
(
0
,
unsavedPageCount
-
currentUnsavedPageCount
);
currentStoreVersion
=
-
1
;
...
...
@@ -1297,7 +1297,7 @@ public class MVStore {
}
registerFreePage
(
version
,
c
.
id
,
DataUtils
.
getPageMaxLength
(
pos
),
1
);
}
private
void
registerFreePage
(
long
version
,
int
chunkId
,
long
maxLengthLive
,
int
pageCount
)
{
synchronized
(
freedPages
)
{
HashMap
<
Integer
,
Chunk
>
freed
=
freedPages
.
get
(
version
);
...
...
@@ -1736,7 +1736,7 @@ public class MVStore {
}
store
(
true
);
}
public
boolean
isReadOnly
()
{
return
readOnly
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
91926786
...
...
@@ -852,7 +852,7 @@ public class Page {
}
return
write
(
chunk
,
buff
);
}
/**
* Unlink the children recursively after all data is written.
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
91926786
...
...
@@ -218,7 +218,7 @@ public class MVPrimaryIndex extends BaseIndex {
return
new
MVStoreCursor
(
session
,
Collections
.<
Value
>
emptyList
().
iterator
(),
0
);
}
long
key
=
first
?
map
.
firstKey
().
getLong
()
:
map
.
lastKey
().
getLong
();
MVStoreCursor
cursor
=
new
MVStoreCursor
(
session
,
MVStoreCursor
cursor
=
new
MVStoreCursor
(
session
,
Arrays
.
asList
((
Value
)
ValueLong
.
get
(
key
)).
iterator
(),
key
);
cursor
.
next
();
return
cursor
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
91926786
...
...
@@ -520,7 +520,7 @@ public class MVTable extends TableBase {
rowCount
=
0
;
changesSinceAnalyze
=
0
;
}
@Override
public
void
addRow
(
Session
session
,
Row
row
)
{
lastModificationId
=
database
.
getNextModificationDataId
();
...
...
@@ -701,7 +701,7 @@ public class MVTable extends TableBase {
public
String
toString
()
{
return
getSQL
();
}
public
boolean
isMVStore
()
{
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
浏览文件 @
91926786
...
...
@@ -147,7 +147,7 @@ public class MVTableEngine implements TableEngine {
public
Store
(
Database
db
,
MVStore
store
)
{
this
.
db
=
db
;
this
.
store
=
store
;
this
.
transactionStore
=
new
TransactionStore
(
store
,
this
.
transactionStore
=
new
TransactionStore
(
store
,
new
ValueDataType
(
null
,
null
,
null
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
91926786
...
...
@@ -75,7 +75,7 @@ public class TransactionStore {
public
TransactionStore
(
MVStore
store
)
{
this
(
store
,
new
ObjectDataType
());
}
/**
* Create a new transaction store.
*
...
...
@@ -92,7 +92,7 @@ public class TransactionStore {
ArrayType
valueType
=
new
ArrayType
(
new
DataType
[]{
new
ObjectDataType
(),
new
ObjectDataType
(),
keyType
});
MVMapConcurrent
.
Builder
<
long
[],
Object
[]>
builder
=
MVMapConcurrent
.
Builder
<
long
[],
Object
[]>
builder
=
new
MVMapConcurrent
.
Builder
<
long
[],
Object
[]>().
valueType
(
valueType
);
// TODO escape other map names, to avoid conflicts
...
...
@@ -129,7 +129,7 @@ public class TransactionStore {
/**
* Get the list of currently open transactions that have pending writes.
*
*
* @return the list of transactions
*/
public
synchronized
List
<
Transaction
>
getOpenTransactions
()
{
...
...
@@ -158,8 +158,8 @@ public class TransactionStore {
int
status
=
Transaction
.
STATUS_OPEN
;
return
new
Transaction
(
this
,
transactionId
,
status
,
null
,
0
);
}
void
storeTransaction
(
Transaction
t
)
{
private
void
storeTransaction
(
Transaction
t
)
{
long
transactionId
=
t
.
getId
();
if
(
openTransactions
.
containsKey
(
transactionId
))
{
return
;
...
...
@@ -185,10 +185,10 @@ public class TransactionStore {
openTransactions
.
put
(
t
.
getId
(),
v
);
store
.
commit
();
}
/**
* Log an entry.
*
*
* @param t the transaction
* @param logId the log id
* @param opType the operation type
...
...
@@ -345,7 +345,7 @@ public class TransactionStore {
* The transaction store.
*/
final
TransactionStore
store
;
/**
* The version of the store at the time the transaction was started.
*/
...
...
@@ -454,7 +454,7 @@ public class TransactionStore {
*/
public
<
K
,
V
>
TransactionMap
<
K
,
V
>
openMap
(
String
name
,
long
readVersion
)
{
checkOpen
();
return
new
TransactionMap
<
K
,
V
>(
this
,
name
,
new
ObjectDataType
(),
return
new
TransactionMap
<
K
,
V
>(
this
,
name
,
new
ObjectDataType
(),
new
ObjectDataType
(),
readVersion
);
}
...
...
@@ -569,7 +569,7 @@ public class TransactionStore {
*/
private
final
MVMap
<
K
,
Object
[]>
mapRead
;
TransactionMap
(
Transaction
transaction
,
String
name
,
DataType
keyType
,
TransactionMap
(
Transaction
transaction
,
String
name
,
DataType
keyType
,
DataType
valueType
,
long
readVersion
)
{
this
.
transaction
=
transaction
;
ArrayType
arrayType
=
new
ArrayType
(
new
DataType
[]
{
...
...
@@ -811,7 +811,13 @@ public class TransactionStore {
public
V
getLatest
(
K
key
)
{
return
get
(
key
,
mapWrite
);
}
/**
* Whether the map contains the key.
*
* @param key the key
* @return true if the map contains an entry for this key
*/
public
boolean
containsKey
(
K
key
)
{
return
get
(
key
)
!=
null
;
}
...
...
@@ -855,50 +861,102 @@ public class TransactionStore {
}
}
/**
* Rename the map.
*
* @param newMapName the new map name
*/
public
void
renameMap
(
String
newMapName
)
{
// TODO rename maps transactionally
mapWrite
.
renameMap
(
newMapName
);
}
/**
* Check whether this map is closed.
*
* @return true if closed
*/
public
boolean
isClosed
()
{
return
mapWrite
.
isClosed
();
}
/**
* Remove the map.
*/
public
void
removeMap
()
{
// TODO remove in a transaction
mapWrite
.
removeMap
();
}
/**
* Clear the map.
*/
public
void
clear
()
{
// TODO truncate transactionally
mapWrite
.
clear
();
}
/**
* Get the first key.
*
* @return the first key, or null if empty
*/
public
K
firstKey
()
{
// TODO transactional firstKey
return
mapRead
.
firstKey
();
}
/**
* Get the last key.
*
* @return the last key, or null if empty
*/
public
K
lastKey
()
{
// TODO transactional lastKey
return
mapRead
.
lastKey
();
}
/**
* Iterate over all keys.
*
* @param from the first key to return
* @return the iterator
*/
public
Iterator
<
K
>
keyIterator
(
K
from
)
{
// TODO transactional keyIterator
return
mapRead
.
keyIterator
(
from
);
}
/**
* Get the smallest key that is larger or equal to this key.
*
* @param key the key (may not be null)
* @return the result
*/
public
K
ceilingKey
(
K
key
)
{
// TODO transactional ceilingKey
return
mapRead
.
ceilingKey
(
key
);
}
/**
* Get the smallest key that is larger than the given key, or null if no
* such key exists.
*
* @param key the key (may not be null)
* @return the result
*/
public
K
higherKey
(
K
key
)
{
// TODO transactional higherKey
return
mapRead
.
higherKey
(
key
);
}
/**
* Get the largest key that is smaller than the given key, or null if no
* such key exists.
*
* @param key the key (may not be null)
* @return the result
*/
public
K
lowerKey
(
K
key
)
{
// TODO Auto-generated method stub
return
mapRead
.
lowerKey
(
key
);
...
...
@@ -909,7 +967,7 @@ public class TransactionStore {
}
}
/**
* A data type that contains an array of objects with the specified data
* types.
...
...
@@ -970,8 +1028,8 @@ public class TransactionStore {
array
[
i
]
=
t
.
read
(
buff
);
}
return
array
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Table.java
浏览文件 @
91926786
...
...
@@ -626,6 +626,7 @@ public abstract class Table extends SchemaObjectBase {
* @param session the session
* @param masks per-column comparison bit masks, null means 'always false',
* see constants in IndexCondition
* @param sortOrder the sort order
* @return the plan item
*/
public
PlanItem
getBestPlanItem
(
Session
session
,
int
[]
masks
,
SortOrder
sortOrder
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
91926786
...
...
@@ -178,7 +178,7 @@ public class TableFilter implements ColumnResolver {
}
SortOrder
sortOrder
=
null
;
if
(
select
!=
null
)
{
sortOrder
=
select
.
prepare
Order
();
sortOrder
=
select
.
getSort
Order
();
}
item
=
table
.
getBestPlanItem
(
s
,
masks
,
sortOrder
);
// The more index conditions, the earlier the table.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/CompareMode.java
浏览文件 @
91926786
...
...
@@ -35,15 +35,17 @@ public class CompareMode {
public
static
final
String
ICU4J
=
"ICU4J_"
;
/**
* This constant means that the BINARY columns are sorted as if the bytes were signed.
* This constant means that the BINARY columns are sorted as if the bytes
* were signed.
*/
public
static
final
String
SIGNED
=
"SIGNED"
;
/**
* This constant means that the BINARY columns are sorted as if the bytes were unsigned.
* This constant means that the BINARY columns are sorted as if the bytes
* were unsigned.
*/
public
static
final
String
UNSIGNED
=
"UNSIGNED"
;
private
static
CompareMode
lastUsed
;
private
static
final
boolean
CAN_USE_ICU4J
;
...
...
@@ -78,12 +80,13 @@ public class CompareMode {
*
* @param name the collation name or null
* @param strength the collation strength
* @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
.
strength
==
strength
&&
lastUsed
.
binaryUnsigned
==
binaryUnsigned
)
{
return
lastUsed
;
}
...
...
@@ -220,7 +223,7 @@ public class CompareMode {
public
int
getStrength
()
{
return
strength
;
}
public
boolean
isBinaryUnsigned
()
{
return
binaryUnsigned
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
91926786
...
...
@@ -606,7 +606,7 @@ public abstract class TestBase {
fail
(
"Expected: "
+
df
.
format
(
expected
)
+
" actual: "
+
df
.
format
(
actual
));
}
}
/**
* Check if two values are equal, and if not throw an exception.
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
91926786
...
...
@@ -836,7 +836,7 @@ public class TestCases extends TestBase {
Connection
conn
=
getConnection
(
"cases"
);
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
;
// test the default (SIGNED)
stat
.
execute
(
"create table bin( x binary(1) );"
);
stat
.
execute
(
"insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');"
);
...
...
@@ -849,7 +849,7 @@ public class TestCases extends TestBase {
assertEquals
(
"09"
,
rs
.
getString
(
1
));
rs
.
next
();
assertEquals
(
"0a"
,
rs
.
getString
(
1
));
// test UNSIGNED mode
stat
.
execute
(
"drop table bin"
);
stat
.
execute
(
"SET BINARY_COLLATION UNSIGNED"
);
...
...
@@ -864,10 +864,10 @@ public class TestCases extends TestBase {
assertEquals
(
"99"
,
rs
.
getString
(
1
));
rs
.
next
();
assertEquals
(
"aa"
,
rs
.
getString
(
1
));
conn
.
close
();
}
private
void
testPersistentSettings
()
throws
SQLException
{
deleteDb
(
"cases"
);
Connection
conn
=
getConnection
(
"cases"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
91926786
...
...
@@ -303,7 +303,7 @@ public class TestCompatibility extends TestBase {
assertEquals
(
"John, Doe"
,
rs
.
getString
(
1
));
rs
.
close
();
prep
.
close
();
// CONVERT has it's parameters the other way around from the default mode
rs
=
stat
.
executeQuery
(
"SELECT CONVERT(INT, '10')"
);
rs
.
next
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
91926786
...
...
@@ -882,11 +882,11 @@ public class TestFunctions extends TestBase implements AggregateFunction {
deleteDb
(
"functions"
);
Connection
conn
=
getConnection
(
"functions"
);
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT TRUNCATE(1.234, 2) FROM dual"
);
rs
.
next
();
assertEquals
(
1.23d
,
rs
.
getDouble
(
1
));
rs
=
stat
.
executeQuery
(
"SELECT CURRENT_TIMESTAMP(), TRUNCATE(CURRENT_TIMESTAMP()) FROM dual"
);
rs
.
next
();
Calendar
c
=
Calendar
.
getInstance
();
...
...
@@ -897,14 +897,14 @@ public class TestFunctions extends TestBase implements AggregateFunction {
c
.
set
(
Calendar
.
MILLISECOND
,
0
);
java
.
util
.
Date
nowDate
=
c
.
getTime
();
assertEquals
(
nowDate
,
rs
.
getTimestamp
(
2
));
try
{
rs
=
stat
.
executeQuery
(
"SELECT TRUNCATE('bad', 1) FROM dual"
);
fail
(
"expected exception"
);
}
catch
(
SQLException
ex
)
{
// expected
}
// check for passing wrong data type
try
{
rs
=
stat
.
executeQuery
(
"SELECT TRUNCATE('bad') FROM dual"
);
...
...
@@ -912,7 +912,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
}
catch
(
SQLException
ex
)
{
// expected
}
// check for too many parameters
try
{
rs
=
stat
.
executeQuery
(
"SELECT TRUNCATE(1,2,3) FROM dual"
);
...
...
@@ -920,10 +920,10 @@ public class TestFunctions extends TestBase implements AggregateFunction {
}
catch
(
SQLException
ex
)
{
// expected
}
conn
.
close
();
}
private
void
assertCallResult
(
String
expected
,
Statement
stat
,
String
sql
)
throws
SQLException
{
ResultSet
rs
=
stat
.
executeQuery
(
"CALL "
+
sql
);
rs
.
next
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
91926786
...
...
@@ -783,12 +783,15 @@ public class TestOptimizations extends TestBase {
conn
.
close
();
}
/** Where there are multiple indices, and we have an ORDER BY, select the index that already has the required ordering. */
/**
* Where there are multiple indices, and we have an ORDER BY, select the
* index that already has the required ordering.
*/
private
void
testOrderedIndexes
()
throws
SQLException
{
deleteDb
(
"optimizations"
);
Connection
conn
=
getConnection
(
"optimizations"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE my_table(K1 INT, K2 INT, VAL VARCHAR, PRIMARY KEY(K1,K2))"
);
stat
.
execute
(
"CREATE INDEX my_index ON my_table(K1,VAL);"
);
ResultSet
rs
=
stat
.
executeQuery
(
"EXPLAIN PLAN FOR SELECT * FROM my_table WHERE K1=7 ORDER BY K1,VAL"
);
...
...
@@ -796,15 +799,17 @@ public class TestOptimizations extends TestBase {
assertContains
(
rs
.
getString
(
1
),
"/* PUBLIC.MY_INDEX: K1 = 7 */"
);
stat
.
execute
(
"DROP TABLE my_table"
);
// where we have two covering indexes, make sure we choose the one that covers more
// where we have two covering indexes, make sure
// we choose the one that covers more
stat
.
execute
(
"CREATE TABLE my_table(K1 INT, K2 INT, VAL VARCHAR)"
);
stat
.
execute
(
"CREATE INDEX my_index1 ON my_table(K1,K2);"
);
stat
.
execute
(
"CREATE INDEX my_index2 ON my_table(K1,K2,VAL);"
);
rs
=
stat
.
executeQuery
(
"EXPLAIN PLAN FOR SELECT * FROM my_table WHERE K1=7 ORDER BY K1,K2,VAL"
);
rs
.
next
();
assertContains
(
rs
.
getString
(
1
),
"/* PUBLIC.MY_INDEX2: K1 = 7 */"
);
conn
.
close
();
}
}
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
91926786
...
...
@@ -79,9 +79,9 @@ public class TestMVStore extends TestBase {
testIterate
();
testCloseTwice
();
testSimple
();
// longer running tests
testLargerThan2G
();
}
...
...
@@ -1360,7 +1360,7 @@ public class TestMVStore extends TestBase {
}
s
.
close
();
}
private
void
testLargerThan2G
()
throws
IOException
{
if
(!
config
.
big
)
{
return
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
91926786
...
...
@@ -42,7 +42,7 @@ public class TestMVTableEngine extends TestBase {
testLocking
();
testSimple
();
}
private
void
testSpeed
()
throws
Exception
{
String
dbName
;
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
...
...
@@ -56,7 +56,7 @@ public class TestMVTableEngine extends TestBase {
// System.out.println(prof.getTop(10));
}
}
private
void
testSpeed
(
String
dbName
)
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
Connection
conn
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestPageStore.java
浏览文件 @
91926786
...
...
@@ -78,7 +78,7 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
testFuzzOperations
();
deleteDb
(
"pageStore"
);
}
private
void
testDropTempTable
()
throws
SQLException
{
deleteDb
(
"pageStoreDropTemp"
);
Connection
c1
=
getConnection
(
"pageStoreDropTemp"
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论