Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9b1c4408
提交
9b1c4408
authored
9月 07, 2018
作者:
tledkov-gridgain
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1405 Introduce LocalResult factory: fix review issues
上级
36c4613d
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
63 行增加
和
87 行删除
+63
-87
Call.java
h2/src/main/org/h2/command/dml/Call.java
+3
-3
Explain.java
h2/src/main/org/h2/command/dml/Explain.java
+1
-2
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+1
-2
Select.java
h2/src/main/org/h2/command/dml/Select.java
+4
-4
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+4
-5
Set.java
h2/src/main/org/h2/command/dml/Set.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+2
-3
GeneratedKeys.java
h2/src/main/org/h2/engine/GeneratedKeys.java
+7
-7
TableFunction.java
h2/src/main/org/h2/expression/TableFunction.java
+1
-2
LocalResultFactory.java
h2/src/main/org/h2/result/LocalResultFactory.java
+22
-38
LocalResultImpl.java
h2/src/main/org/h2/result/LocalResultImpl.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-2
TestLocalResultFactory.java
h2/src/test/org/h2/test/unit/TestLocalResultFactory.java
+14
-17
没有找到文件。
h2/src/main/org/h2/command/dml/Call.java
浏览文件 @
9b1c4408
...
@@ -35,9 +35,9 @@ public class Call extends Prepared {
...
@@ -35,9 +35,9 @@ public class Call extends Prepared {
LocalResult
result
;
LocalResult
result
;
if
(
isResultSet
)
{
if
(
isResultSet
)
{
Expression
[]
expr
=
expression
.
getExpressionColumns
(
session
);
Expression
[]
expr
=
expression
.
getExpressionColumns
(
session
);
result
=
LocalResultFactory
.
createRow
(
session
,
expr
,
expr
.
length
);
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expr
,
expr
.
length
);
}
else
{
}
else
{
result
=
LocalResultFactory
.
createRow
(
session
,
expressions
,
1
);
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressions
,
1
);
}
}
result
.
done
();
result
.
done
();
return
result
;
return
result
;
...
@@ -69,7 +69,7 @@ public class Call extends Prepared {
...
@@ -69,7 +69,7 @@ public class Call extends Prepared {
ResultSet
rs
=
v
.
getResultSet
();
ResultSet
rs
=
v
.
getResultSet
();
return
LocalResultFactory
.
read
(
session
,
rs
,
maxrows
);
return
LocalResultFactory
.
read
(
session
,
rs
,
maxrows
);
}
}
LocalResult
result
=
LocalResultFactory
.
createRow
(
session
,
expressions
,
1
);
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressions
,
1
);
Value
[]
row
=
{
v
};
Value
[]
row
=
{
v
};
result
.
addRow
(
row
);
result
.
addRow
(
row
);
result
.
done
();
result
.
done
();
...
...
h2/src/main/org/h2/command/dml/Explain.java
浏览文件 @
9b1c4408
...
@@ -16,7 +16,6 @@ import org.h2.expression.Expression;
...
@@ -16,7 +16,6 @@ import org.h2.expression.Expression;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.mvstore.db.MVTableEngine.Store
;
import
org.h2.mvstore.db.MVTableEngine.Store
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
import
org.h2.store.PageStore
;
import
org.h2.store.PageStore
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
...
@@ -73,7 +72,7 @@ public class Explain extends Prepared {
...
@@ -73,7 +72,7 @@ public class Explain extends Prepared {
Database
db
=
session
.
getDatabase
();
Database
db
=
session
.
getDatabase
();
ExpressionColumn
expr
=
new
ExpressionColumn
(
db
,
column
);
ExpressionColumn
expr
=
new
ExpressionColumn
(
db
,
column
);
Expression
[]
expressions
=
{
expr
};
Expression
[]
expressions
=
{
expr
};
result
=
LocalResultFactory
.
createRow
(
session
,
expressions
,
1
);
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressions
,
1
);
if
(
maxrows
>=
0
)
{
if
(
maxrows
>=
0
)
{
String
plan
;
String
plan
;
if
(
executeCommand
)
{
if
(
executeCommand
)
{
...
...
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
9b1c4408
...
@@ -43,7 +43,6 @@ import org.h2.index.Cursor;
...
@@ -43,7 +43,6 @@ import org.h2.index.Cursor;
import
org.h2.index.Index
;
import
org.h2.index.Index
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.Row
;
import
org.h2.schema.Constant
;
import
org.h2.schema.Constant
;
...
@@ -138,7 +137,7 @@ public class ScriptCommand extends ScriptBase {
...
@@ -138,7 +137,7 @@ public class ScriptCommand extends ScriptBase {
private
LocalResult
createResult
()
{
private
LocalResult
createResult
()
{
Expression
[]
expressions
=
{
new
ExpressionColumn
(
Expression
[]
expressions
=
{
new
ExpressionColumn
(
session
.
getDatabase
(),
new
Column
(
"SCRIPT"
,
Value
.
STRING
))
};
session
.
getDatabase
(),
new
Column
(
"SCRIPT"
,
Value
.
STRING
))
};
return
LocalResultFactory
.
createRow
(
session
,
expressions
,
1
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressions
,
1
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
9b1c4408
...
@@ -32,7 +32,6 @@ import org.h2.index.IndexType;
...
@@ -32,7 +32,6 @@ import org.h2.index.IndexType;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.LazyResult
;
import
org.h2.result.LazyResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultTarget
;
import
org.h2.result.ResultTarget
;
import
org.h2.result.Row
;
import
org.h2.result.Row
;
...
@@ -688,7 +687,7 @@ public class Select extends Query {
...
@@ -688,7 +687,7 @@ public class Select extends Query {
@Override
@Override
public
ResultInterface
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
LocalResult
result
=
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
visibleColumnCount
);
visibleColumnCount
);
result
.
done
();
result
.
done
();
return
result
;
return
result
;
...
@@ -859,12 +858,13 @@ public class Select extends Query {
...
@@ -859,12 +858,13 @@ public class Select extends Query {
}
}
private
LocalResult
createLocalResult
(
LocalResult
old
)
{
private
LocalResult
createLocalResult
(
LocalResult
old
)
{
return
old
!=
null
?
old
:
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
return
old
!=
null
?
old
:
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
visibleColumnCount
);
visibleColumnCount
);
}
}
private
LocalResult
convertToDistinct
(
ResultInterface
result
)
{
private
LocalResult
convertToDistinct
(
ResultInterface
result
)
{
LocalResult
distinctResult
=
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
visibleColumnCount
);
LocalResult
distinctResult
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
visibleColumnCount
);
distinctResult
.
setDistinct
();
distinctResult
.
setDistinct
();
result
.
reset
();
result
.
reset
();
while
(
result
.
next
())
{
while
(
result
.
next
())
{
...
...
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
9b1c4408
...
@@ -20,7 +20,6 @@ import org.h2.expression.ValueExpression;
...
@@ -20,7 +20,6 @@ import org.h2.expression.ValueExpression;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.LazyResult
;
import
org.h2.result.LazyResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultTarget
;
import
org.h2.result.ResultTarget
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
...
@@ -131,14 +130,14 @@ public class SelectUnion extends Query {
...
@@ -131,14 +130,14 @@ public class SelectUnion extends Query {
@Override
@Override
public
ResultInterface
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
int
columnCount
=
left
.
getColumnCount
();
int
columnCount
=
left
.
getColumnCount
();
LocalResult
result
=
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
columnCount
);
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
columnCount
);
result
.
done
();
result
.
done
();
return
result
;
return
result
;
}
}
public
LocalResult
getEmptyResult
()
{
public
LocalResult
getEmptyResult
()
{
int
columnCount
=
left
.
getColumnCount
();
int
columnCount
=
left
.
getColumnCount
();
return
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
columnCount
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
columnCount
);
}
}
@Override
@Override
...
@@ -190,7 +189,7 @@ public class SelectUnion extends Query {
...
@@ -190,7 +189,7 @@ public class SelectUnion extends Query {
return
lazyResult
;
return
lazyResult
;
}
}
}
}
LocalResult
result
=
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
columnCount
);
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
columnCount
);
if
(
sort
!=
null
)
{
if
(
sort
!=
null
)
{
result
.
setSortOrder
(
sort
);
result
.
setSortOrder
(
sort
);
}
}
...
@@ -240,7 +239,7 @@ public class SelectUnion extends Query {
...
@@ -240,7 +239,7 @@ public class SelectUnion extends Query {
break
;
break
;
}
}
case
INTERSECT:
{
case
INTERSECT:
{
LocalResult
temp
=
LocalResultFactory
.
createRow
(
session
,
expressionArray
,
columnCount
);
LocalResult
temp
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionArray
,
columnCount
);
temp
.
setDistinct
();
temp
.
setDistinct
();
while
(
l
.
next
())
{
while
(
l
.
next
())
{
temp
.
addRow
(
convert
(
l
.
currentRow
(),
columnCount
));
temp
.
addRow
(
convert
(
l
.
currentRow
(),
columnCount
));
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
9b1c4408
...
@@ -566,7 +566,7 @@ public class Set extends Prepared {
...
@@ -566,7 +566,7 @@ public class Set extends Prepared {
LocalResultFactory
localResultFactory
;
LocalResultFactory
localResultFactory
;
try
{
try
{
localResultFactory
=
localResultFactoryClass
.
getDeclaredConstructor
().
newInstance
();
localResultFactory
=
localResultFactoryClass
.
getDeclaredConstructor
().
newInstance
();
database
.
set
Local
ResultFactory
(
localResultFactory
);
database
.
setResultFactory
(
localResultFactory
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
9b1c4408
...
@@ -41,7 +41,6 @@ import org.h2.message.Trace;
...
@@ -41,7 +41,6 @@ import org.h2.message.Trace;
import
org.h2.message.TraceSystem
;
import
org.h2.message.TraceSystem
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.db.MVTableEngine
;
import
org.h2.mvstore.db.MVTableEngine
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.Row
;
import
org.h2.result.Row
;
import
org.h2.result.RowFactory
;
import
org.h2.result.RowFactory
;
...
@@ -372,11 +371,11 @@ public class Database implements DataHandler {
...
@@ -372,11 +371,11 @@ public class Database implements DataHandler {
this
.
rowFactory
=
rowFactory
;
this
.
rowFactory
=
rowFactory
;
}
}
public
LocalResultFactory
get
Local
ResultFactory
()
{
public
LocalResultFactory
getResultFactory
()
{
return
resultFactory
;
return
resultFactory
;
}
}
public
void
set
Local
ResultFactory
(
LocalResultFactory
resultFactory
)
{
public
void
setResultFactory
(
LocalResultFactory
resultFactory
)
{
this
.
resultFactory
=
resultFactory
;
this
.
resultFactory
=
resultFactory
;
}
}
...
...
h2/src/main/org/h2/engine/GeneratedKeys.java
浏览文件 @
9b1c4408
...
@@ -13,7 +13,6 @@ import java.util.Map;
...
@@ -13,7 +13,6 @@ import java.util.Map;
import
org.h2.expression.Expression
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.Row
;
import
org.h2.result.Row
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
...
@@ -129,7 +128,7 @@ public final class GeneratedKeys {
...
@@ -129,7 +128,7 @@ public final class GeneratedKeys {
Database
db
=
session
.
getDatabase
();
Database
db
=
session
.
getDatabase
();
if
(
Boolean
.
FALSE
.
equals
(
generatedKeysRequest
))
{
if
(
Boolean
.
FALSE
.
equals
(
generatedKeysRequest
))
{
clear
(
null
);
clear
(
null
);
return
LocalResultFactory
.
createRow
(
session
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
);
}
}
ArrayList
<
ExpressionColumn
>
expressionColumns
;
ArrayList
<
ExpressionColumn
>
expressionColumns
;
if
(
Boolean
.
TRUE
.
equals
(
generatedKeysRequest
))
{
if
(
Boolean
.
TRUE
.
equals
(
generatedKeysRequest
))
{
...
@@ -153,7 +152,7 @@ public final class GeneratedKeys {
...
@@ -153,7 +152,7 @@ public final class GeneratedKeys {
}
}
}
else
{
}
else
{
clear
(
null
);
clear
(
null
);
return
LocalResultFactory
.
createRow
(
session
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
);
}
}
}
else
if
(
generatedKeysRequest
instanceof
String
[])
{
}
else
if
(
generatedKeysRequest
instanceof
String
[])
{
if
(
table
!=
null
)
{
if
(
table
!=
null
)
{
...
@@ -183,18 +182,19 @@ public final class GeneratedKeys {
...
@@ -183,18 +182,19 @@ public final class GeneratedKeys {
}
}
}
else
{
}
else
{
clear
(
null
);
clear
(
null
);
return
LocalResultFactory
.
createRow
(
session
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
);
}
}
}
else
{
}
else
{
clear
(
null
);
clear
(
null
);
return
LocalResultFactory
.
createRow
(
session
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
);
}
}
int
columnCount
=
expressionColumns
.
size
();
int
columnCount
=
expressionColumns
.
size
();
if
(
columnCount
==
0
)
{
if
(
columnCount
==
0
)
{
clear
(
null
);
clear
(
null
);
return
LocalResultFactory
.
createRow
(
session
);
return
session
.
getDatabase
().
getResultFactory
().
create
(
);
}
}
LocalResult
result
=
LocalResultFactory
.
createRow
(
session
,
expressionColumns
.
toArray
(
new
Expression
[
0
]),
columnCount
);
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
expressionColumns
.
toArray
(
new
Expression
[
0
]),
columnCount
);
for
(
Map
<
Column
,
Value
>
map
:
data
)
{
for
(
Map
<
Column
,
Value
>
map
:
data
)
{
Value
[]
row
=
new
Value
[
columnCount
];
Value
[]
row
=
new
Value
[
columnCount
];
for
(
Map
.
Entry
<
Column
,
Value
>
entry
:
map
.
entrySet
())
{
for
(
Map
.
Entry
<
Column
,
Value
>
entry
:
map
.
entrySet
())
{
...
...
h2/src/main/org/h2/expression/TableFunction.java
浏览文件 @
9b1c4408
...
@@ -12,7 +12,6 @@ import org.h2.engine.Database;
...
@@ -12,7 +12,6 @@ import org.h2.engine.Database;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.table.Column
;
import
org.h2.table.Column
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
...
@@ -87,7 +86,7 @@ public class TableFunction extends Function {
...
@@ -87,7 +86,7 @@ public class TableFunction extends Function {
ExpressionColumn
col
=
new
ExpressionColumn
(
db
,
c
);
ExpressionColumn
col
=
new
ExpressionColumn
(
db
,
c
);
header
[
i
]
=
col
;
header
[
i
]
=
col
;
}
}
LocalResult
result
=
LocalResultFactory
.
createRow
(
session
,
header
,
len
);
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
header
,
len
);
if
(
distinctRows
)
{
if
(
distinctRows
)
{
result
.
setDistinct
();
result
.
setDistinct
();
}
}
...
...
h2/src/main/org/h2/result/LocalResultFactory.java
浏览文件 @
9b1c4408
...
@@ -38,43 +38,6 @@ public abstract class LocalResultFactory {
...
@@ -38,43 +38,6 @@ public abstract class LocalResultFactory {
*/
*/
public
abstract
LocalResult
create
();
public
abstract
LocalResult
create
();
/**
* Default implementation of local result factory.
*/
static
final
class
DefaultLocalResultFactory
extends
LocalResultFactory
{
@Override
public
LocalResult
create
(
Session
session
,
Expression
[]
expressions
,
int
visibleColumnCount
)
{
return
new
LocalResultImpl
(
session
,
expressions
,
visibleColumnCount
);
}
@Override
public
LocalResult
create
()
{
return
new
LocalResultImpl
();
}
}
/**
* Create a local result object by factory registered at the database.
*
* @param session the session
* @param expressions the expression array
* @param visibleColumnCount the number of visible columns
* @return objetc to collect local result.
*/
public
static
LocalResult
createRow
(
Session
session
,
Expression
[]
expressions
,
int
visibleColumnCount
)
{
return
session
.
getDatabase
().
getLocalResultFactory
().
create
(
session
,
expressions
,
visibleColumnCount
);
}
/**
* Create a local result object by factory registered at the database.
*
* @param session the session
* @return objetc to collect local result.
*/
public
static
LocalResult
createRow
(
Session
session
)
{
return
session
.
getDatabase
().
getLocalResultFactory
().
create
();
}
/**
/**
* Construct a local result set by reading all data from a regular result
* Construct a local result set by reading all data from a regular result
* set.
* set.
...
@@ -87,7 +50,7 @@ public abstract class LocalResultFactory {
...
@@ -87,7 +50,7 @@ public abstract class LocalResultFactory {
public
static
LocalResult
read
(
Session
session
,
ResultSet
rs
,
int
maxrows
)
{
public
static
LocalResult
read
(
Session
session
,
ResultSet
rs
,
int
maxrows
)
{
Expression
[]
cols
=
Expression
.
getExpressionColumns
(
session
,
rs
);
Expression
[]
cols
=
Expression
.
getExpressionColumns
(
session
,
rs
);
int
columnCount
=
cols
.
length
;
int
columnCount
=
cols
.
length
;
LocalResult
result
=
session
.
getDatabase
().
get
Local
ResultFactory
().
create
(
session
,
cols
,
columnCount
);
LocalResult
result
=
session
.
getDatabase
().
getResultFactory
().
create
(
session
,
cols
,
columnCount
);
try
{
try
{
for
(
int
i
=
0
;
(
maxrows
==
0
||
i
<
maxrows
)
&&
rs
.
next
();
i
++)
{
for
(
int
i
=
0
;
(
maxrows
==
0
||
i
<
maxrows
)
&&
rs
.
next
();
i
++)
{
Value
[]
list
=
new
Value
[
columnCount
];
Value
[]
list
=
new
Value
[
columnCount
];
...
@@ -104,4 +67,25 @@ public abstract class LocalResultFactory {
...
@@ -104,4 +67,25 @@ public abstract class LocalResultFactory {
return
result
;
return
result
;
}
}
/**
* Default implementation of local result factory.
*/
private
static
final
class
DefaultLocalResultFactory
extends
LocalResultFactory
{
/**
*
*/
DefaultLocalResultFactory
()
{
//No-op.
}
@Override
public
LocalResult
create
(
Session
session
,
Expression
[]
expressions
,
int
visibleColumnCount
)
{
return
new
LocalResultImpl
(
session
,
expressions
,
visibleColumnCount
);
}
@Override
public
LocalResult
create
()
{
return
new
LocalResultImpl
();
}
}
}
}
h2/src/main/org/h2/result/LocalResultImpl.java
浏览文件 @
9b1c4408
...
@@ -24,7 +24,7 @@ import org.h2.value.ValueArray;
...
@@ -24,7 +24,7 @@ import org.h2.value.ValueArray;
* and it is also used directly by the ResultSet class in the embedded mode.
* and it is also used directly by the ResultSet class in the embedded mode.
* If the result does not fit in memory, it is written to a temporary file.
* If the result does not fit in memory, it is written to a temporary file.
*/
*/
public
class
LocalResultImpl
implements
LocalResult
,
ResultInterface
,
ResultTarget
{
public
class
LocalResultImpl
implements
LocalResult
{
private
int
maxMemoryRows
;
private
int
maxMemoryRows
;
private
Session
session
;
private
Session
session
;
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
9b1c4408
...
@@ -47,7 +47,6 @@ import org.h2.test.db.TestLargeBlob;
...
@@ -47,7 +47,6 @@ import org.h2.test.db.TestLargeBlob;
import
org.h2.test.db.TestLinkedTable
;
import
org.h2.test.db.TestLinkedTable
;
import
org.h2.test.db.TestListener
;
import
org.h2.test.db.TestListener
;
import
org.h2.test.db.TestLob
;
import
org.h2.test.db.TestLob
;
import
org.h2.test.db.TestLocalResultFactory
;
import
org.h2.test.db.TestMemoryUsage
;
import
org.h2.test.db.TestMemoryUsage
;
import
org.h2.test.db.TestMergeUsing
;
import
org.h2.test.db.TestMergeUsing
;
import
org.h2.test.db.TestMultiConn
;
import
org.h2.test.db.TestMultiConn
;
...
@@ -194,6 +193,7 @@ import org.h2.test.unit.TestIntIntHashMap;
...
@@ -194,6 +193,7 @@ import org.h2.test.unit.TestIntIntHashMap;
import
org.h2.test.unit.TestIntPerfectHash
;
import
org.h2.test.unit.TestIntPerfectHash
;
import
org.h2.test.unit.TestInterval
;
import
org.h2.test.unit.TestInterval
;
import
org.h2.test.unit.TestJmx
;
import
org.h2.test.unit.TestJmx
;
import
org.h2.test.unit.TestLocalResultFactory
;
import
org.h2.test.unit.TestLocale
;
import
org.h2.test.unit.TestLocale
;
import
org.h2.test.unit.TestMathUtils
;
import
org.h2.test.unit.TestMathUtils
;
import
org.h2.test.unit.TestMemoryUnmapper
;
import
org.h2.test.unit.TestMemoryUnmapper
;
...
@@ -796,7 +796,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -796,7 +796,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest
(
new
TestViewDropView
());
addTest
(
new
TestViewDropView
());
addTest
(
new
TestSynonymForTable
());
addTest
(
new
TestSynonymForTable
());
addTest
(
new
TestColumnNamer
());
addTest
(
new
TestColumnNamer
());
addTest
(
new
TestLocalResultFactory
());
// jdbc
// jdbc
addTest
(
new
TestBatchUpdates
());
addTest
(
new
TestBatchUpdates
());
...
@@ -982,6 +981,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -982,6 +981,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest
(
new
TestTraceSystem
());
addTest
(
new
TestTraceSystem
());
addTest
(
new
TestUtils
());
addTest
(
new
TestUtils
());
addTest
(
new
TestValueHashMap
());
addTest
(
new
TestValueHashMap
());
addTest
(
new
TestLocalResultFactory
());
runAddedTests
();
runAddedTests
();
...
...
h2/src/test/org/h2/test/
db
/TestLocalResultFactory.java
→
h2/src/test/org/h2/test/
unit
/TestLocalResultFactory.java
浏览文件 @
9b1c4408
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
* and the EPL 1.0 (http://h2database.com/html/license.html).
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
* Initial Developer: H2 Group
*/
*/
package
org
.
h2
.
test
.
db
;
package
org
.
h2
.
test
.
unit
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
...
@@ -13,12 +14,11 @@ import org.h2.expression.Expression;
...
@@ -13,12 +14,11 @@ import org.h2.expression.Expression;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResult
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.result.LocalResultFactory
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestDb
;
/**
/**
* Test {@link LocalResultFactory} setting.
* Test {@link LocalResultFactory} setting.
*/
*/
public
class
TestLocalResultFactory
extends
Test
Db
{
public
class
TestLocalResultFactory
extends
Test
Base
{
/**
/**
* Run just this test.
* Run just this test.
...
@@ -31,9 +31,8 @@ public class TestLocalResultFactory extends TestDb {
...
@@ -31,9 +31,8 @@ public class TestLocalResultFactory extends TestDb {
@Override
@Override
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
deleteDb
(
"localResultFactory"
);
try
(
Connection
conn
=
DriverManager
.
getConnection
(
"jdbc:h2:mem:localResultFactory;LOCAL_RESULT_FACTORY=\""
Connection
conn
=
getConnection
(
"localResultFactory;LOCAL_RESULT_FACTORY=\""
+
+
MyTestLocalResultFactory
.
class
.
getName
()
+
'"'
))
{
MyTestLocalResultFactory
.
class
.
getName
()
+
'"'
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table t1(id int, name varchar)"
);
stat
.
execute
(
"create table t1(id int, name varchar)"
);
...
@@ -44,9 +43,7 @@ public class TestLocalResultFactory extends TestDb {
...
@@ -44,9 +43,7 @@ public class TestLocalResultFactory extends TestDb {
stat
.
execute
(
"select * from t1"
);
stat
.
execute
(
"select * from t1"
);
assertEquals
(
MyTestLocalResultFactory
.
COUNTER
.
get
(),
1
);
assertEquals
(
MyTestLocalResultFactory
.
COUNTER
.
get
(),
1
);
}
conn
.
close
();
deleteDb
(
"localResultFactory"
);
}
}
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论