Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
01b617c3
提交
01b617c3
authored
5月 04, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass database instead of session to MVTempResult
上级
cea2572e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
24 行增加
和
27 行删除
+24
-27
MVPlainTempResult.java
h2/src/main/org/h2/mvstore/db/MVPlainTempResult.java
+5
-7
MVSortedTempResult.java
h2/src/main/org/h2/mvstore/db/MVSortedTempResult.java
+5
-7
MVTempResult.java
h2/src/main/org/h2/mvstore/db/MVTempResult.java
+11
-11
LocalResult.java
h2/src/main/org/h2/result/LocalResult.java
+3
-2
没有找到文件。
h2/src/main/org/h2/mvstore/db/MVPlainTempResult.java
浏览文件 @
01b617c3
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
mvstore
.
db
;
package
org
.
h2
.
mvstore
.
db
;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.mvstore.Cursor
;
import
org.h2.mvstore.Cursor
;
...
@@ -65,16 +64,15 @@ class MVPlainTempResult extends MVTempResult {
...
@@ -65,16 +64,15 @@ class MVPlainTempResult extends MVTempResult {
/**
/**
* Creates a new plain temporary result.
* Creates a new plain temporary result.
*
*
* @param
session
* @param
database
* database
session.
* database
* @param expressions
* @param expressions
* column expressions
* column expressions
*/
*/
MVPlainTempResult
(
Session
session
,
Expression
[]
expressions
)
{
MVPlainTempResult
(
Database
database
,
Expression
[]
expressions
)
{
super
(
session
);
super
(
database
);
Database
db
=
session
.
getDatabase
();
ValueDataType
keyType
=
new
ValueDataType
(
null
,
null
,
null
);
ValueDataType
keyType
=
new
ValueDataType
(
null
,
null
,
null
);
valueType
=
new
ValueDataType
(
d
b
.
getCompareMode
(),
db
,
new
int
[
expressions
.
length
]);
valueType
=
new
ValueDataType
(
d
atabase
.
getCompareMode
(),
database
,
new
int
[
expressions
.
length
]);
Builder
<
ValueLong
,
ValueArray
>
builder
=
new
MVMap
.
Builder
<
ValueLong
,
ValueArray
>().
keyType
(
keyType
)
Builder
<
ValueLong
,
ValueArray
>
builder
=
new
MVMap
.
Builder
<
ValueLong
,
ValueArray
>().
keyType
(
keyType
)
.
valueType
(
valueType
);
.
valueType
(
valueType
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
...
...
h2/src/main/org/h2/mvstore/db/MVSortedTempResult.java
浏览文件 @
01b617c3
...
@@ -8,7 +8,6 @@ package org.h2.mvstore.db;
...
@@ -8,7 +8,6 @@ package org.h2.mvstore.db;
import
java.util.BitSet
;
import
java.util.BitSet
;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
import
org.h2.mvstore.Cursor
;
import
org.h2.mvstore.Cursor
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMap
;
...
@@ -78,8 +77,8 @@ class MVSortedTempResult extends MVTempResult {
...
@@ -78,8 +77,8 @@ class MVSortedTempResult extends MVTempResult {
/**
/**
* Creates a new sorted temporary result.
* Creates a new sorted temporary result.
*
*
* @param
session
* @param
database
* database
session
* database
* @param expressions
* @param expressions
* column expressions
* column expressions
* @param distinct
* @param distinct
...
@@ -88,10 +87,9 @@ class MVSortedTempResult extends MVTempResult {
...
@@ -88,10 +87,9 @@ class MVSortedTempResult extends MVTempResult {
* sort order, or {@code null} if this result does not
* sort order, or {@code null} if this result does not
* need any sorting
* need any sorting
*/
*/
MVSortedTempResult
(
Session
session
,
Expression
[]
expressions
,
boolean
distinct
,
SortOrder
sort
)
{
MVSortedTempResult
(
Database
database
,
Expression
[]
expressions
,
boolean
distinct
,
SortOrder
sort
)
{
super
(
session
);
super
(
database
);
this
.
distinct
=
distinct
;
this
.
distinct
=
distinct
;
Database
db
=
session
.
getDatabase
();
int
length
=
expressions
.
length
;
int
length
=
expressions
.
length
;
int
[]
sortTypes
=
new
int
[
length
];
int
[]
sortTypes
=
new
int
[
length
];
int
[]
indexes
;
int
[]
indexes
;
...
@@ -146,7 +144,7 @@ class MVSortedTempResult extends MVTempResult {
...
@@ -146,7 +144,7 @@ class MVSortedTempResult extends MVTempResult {
indexes
=
null
;
indexes
=
null
;
}
}
this
.
indexes
=
indexes
;
this
.
indexes
=
indexes
;
ValueDataType
keyType
=
new
ValueDataType
(
d
b
.
getCompareMode
(),
db
,
sortTypes
);
ValueDataType
keyType
=
new
ValueDataType
(
d
atabase
.
getCompareMode
(),
database
,
sortTypes
);
Builder
<
ValueArray
,
Long
>
builder
=
new
MVMap
.
Builder
<
ValueArray
,
Long
>().
keyType
(
keyType
);
Builder
<
ValueArray
,
Long
>
builder
=
new
MVMap
.
Builder
<
ValueArray
,
Long
>().
keyType
(
keyType
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
}
}
...
...
h2/src/main/org/h2/mvstore/db/MVTempResult.java
浏览文件 @
01b617c3
...
@@ -10,7 +10,7 @@ import java.lang.ref.Reference;
...
@@ -10,7 +10,7 @@ import java.lang.ref.Reference;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.engine.
Session
;
import
org.h2.engine.
Database
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStore
;
...
@@ -60,8 +60,8 @@ public abstract class MVTempResult implements ResultExternal {
...
@@ -60,8 +60,8 @@ public abstract class MVTempResult implements ResultExternal {
/**
/**
* Creates MVStore-based temporary result.
* Creates MVStore-based temporary result.
*
*
* @param
session
* @param
database
*
session
*
database
* @param expressions
* @param expressions
* expressions
* expressions
* @param distinct
* @param distinct
...
@@ -70,9 +70,9 @@ public abstract class MVTempResult implements ResultExternal {
...
@@ -70,9 +70,9 @@ public abstract class MVTempResult implements ResultExternal {
* sort order, or {@code null}
* sort order, or {@code null}
* @return temporary result
* @return temporary result
*/
*/
public
static
ResultExternal
of
(
Session
session
,
Expression
[]
expressions
,
boolean
distinct
,
SortOrder
sort
)
{
public
static
ResultExternal
of
(
Database
database
,
Expression
[]
expressions
,
boolean
distinct
,
SortOrder
sort
)
{
return
distinct
||
sort
!=
null
?
new
MVSortedTempResult
(
session
,
expressions
,
distinct
,
sort
)
return
distinct
||
sort
!=
null
?
new
MVSortedTempResult
(
database
,
expressions
,
distinct
,
sort
)
:
new
MVPlainTempResult
(
session
,
expressions
);
:
new
MVPlainTempResult
(
database
,
expressions
);
}
}
/**
/**
...
@@ -132,19 +132,19 @@ public abstract class MVTempResult implements ResultExternal {
...
@@ -132,19 +132,19 @@ public abstract class MVTempResult implements ResultExternal {
/**
/**
* Creates a new temporary result.
* Creates a new temporary result.
*
*
* @param
session
* @param
database
*
database session
*
database
*/
*/
MVTempResult
(
Session
session
)
{
MVTempResult
(
Database
database
)
{
try
{
try
{
String
fileName
=
FileUtils
.
createTempFile
(
"h2tmp"
,
Constants
.
SUFFIX_TEMP_FILE
,
false
,
true
);
String
fileName
=
FileUtils
.
createTempFile
(
"h2tmp"
,
Constants
.
SUFFIX_TEMP_FILE
,
false
,
true
);
Builder
builder
=
new
MVStore
.
Builder
().
fileName
(
fileName
);
Builder
builder
=
new
MVStore
.
Builder
().
fileName
(
fileName
);
byte
[]
key
=
session
.
getDatabase
()
.
getFileEncryptionKey
();
byte
[]
key
=
database
.
getFileEncryptionKey
();
if
(
key
!=
null
)
{
if
(
key
!=
null
)
{
builder
.
encryptionKey
(
MVTableEngine
.
decodePassword
(
key
));
builder
.
encryptionKey
(
MVTableEngine
.
decodePassword
(
key
));
}
}
store
=
builder
.
open
();
store
=
builder
.
open
();
tempFileDeleter
=
session
.
getDatabase
()
.
getTempFileDeleter
();
tempFileDeleter
=
database
.
getTempFileDeleter
();
closeable
=
new
CloseImpl
(
store
,
fileName
);
closeable
=
new
CloseImpl
(
store
,
fileName
);
fileRef
=
tempFileDeleter
.
addFile
(
closeable
,
this
);
fileRef
=
tempFileDeleter
.
addFile
(
closeable
,
this
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
h2/src/main/org/h2/result/LocalResult.java
浏览文件 @
01b617c3
...
@@ -291,8 +291,9 @@ public class LocalResult implements ResultInterface, ResultTarget {
...
@@ -291,8 +291,9 @@ public class LocalResult implements ResultInterface, ResultTarget {
}
}
private
void
createExternalResult
()
{
private
void
createExternalResult
()
{
external
=
session
.
getDatabase
().
getMvStore
()
!=
null
Database
database
=
session
.
getDatabase
();
?
MVTempResult
.
of
(
session
,
expressions
,
distinct
,
sort
)
external
=
database
.
getMvStore
()
!=
null
?
MVTempResult
.
of
(
database
,
expressions
,
distinct
,
sort
)
:
new
ResultTempTable
(
session
,
expressions
,
distinct
,
sort
);
:
new
ResultTempTable
(
session
,
expressions
,
distinct
,
sort
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论