Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7df1c533
提交
7df1c533
authored
11月 02, 2015
作者:
S.Vladykin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test and minor fixes
上级
e5b577fa
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
42 行增加
和
22 行删除
+42
-22
Set.java
h2/src/main/org/h2/command/dml/Set.java
+15
-1
SetTypes.java
h2/src/main/org/h2/command/dml/SetTypes.java
+6
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+5
-12
FunctionCursorResultSet.java
h2/src/main/org/h2/index/FunctionCursorResultSet.java
+1
-1
RowFactory.java
h2/src/main/org/h2/result/RowFactory.java
+13
-8
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
没有找到文件。
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
7df1c533
...
...
@@ -6,7 +6,6 @@
package
org
.
h2
.
command
.
dml
;
import
java.text.Collator
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.Prepared
;
...
...
@@ -20,9 +19,11 @@ import org.h2.expression.Expression;
import
org.h2.expression.ValueExpression
;
import
org.h2.message.DbException
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.RowFactory
;
import
org.h2.schema.Schema
;
import
org.h2.table.Table
;
import
org.h2.tools.CompressTool
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.CompareMode
;
import
org.h2.value.ValueInt
;
...
...
@@ -483,6 +484,19 @@ public class Set extends Prepared {
addOrUpdateSetting
(
name
,
null
,
getIntValue
());
break
;
}
case
SetTypes
.
ROW_FACTORY
:
{
session
.
getUser
().
checkAdmin
();
String
rowFactoryName
=
expression
.
getColumnName
();
Class
<
RowFactory
>
rowFactoryClass
=
JdbcUtils
.
loadUserClass
(
rowFactoryName
);
RowFactory
rowFactory
;
try
{
rowFactory
=
rowFactoryClass
.
newInstance
();
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
}
database
.
setRowFactory
(
rowFactory
);
break
;
}
default
:
DbException
.
throwInternalError
(
"type="
+
type
);
}
...
...
h2/src/main/org/h2/command/dml/SetTypes.java
浏览文件 @
7df1c533
...
...
@@ -223,6 +223,11 @@ public class SetTypes {
*/
public
static
final
int
QUERY_STATISTICS_MAX_ENTRIES
=
42
;
/**
* The type of a SET ROW_FACTORY statement.
*/
public
static
final
int
ROW_FACTORY
=
43
;
private
static
final
ArrayList
<
String
>
TYPES
=
New
.
arrayList
();
private
SetTypes
()
{
...
...
@@ -274,6 +279,7 @@ public class SetTypes {
list
.
add
(
RETENTION_TIME
,
"RETENTION_TIME"
);
list
.
add
(
QUERY_STATISTICS
,
"QUERY_STATISTICS"
);
list
.
add
(
QUERY_STATISTICS_MAX_ENTRIES
,
"QUERY_STATISTICS_MAX_ENTRIES"
);
list
.
add
(
ROW_FACTORY
,
"ROW_FACTORY"
);
}
/**
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
7df1c533
...
...
@@ -192,7 +192,7 @@ public class Database implements DataHandler {
private
boolean
queryStatistics
;
private
int
queryStatisticsMaxEntries
=
Constants
.
QUERY_STATISTICS_MAX_ENTRIES
;
private
QueryStatisticsData
queryStatisticsData
;
private
final
RowFactory
rowFactory
;
private
RowFactory
rowFactory
=
RowFactory
.
DEFAULT
;
public
Database
(
ConnectionInfo
ci
,
String
cipher
)
{
String
name
=
ci
.
getName
();
...
...
@@ -251,17 +251,6 @@ public class Database implements DataHandler {
ci
.
getProperty
(
"JAVA_OBJECT_SERIALIZER"
,
null
);
this
.
multiThreaded
=
ci
.
getProperty
(
"MULTI_THREADED"
,
false
);
String
rowFactoryClassName
=
ci
.
getProperty
(
"ROW_FACTORY"
);
if
(
rowFactoryClassName
!=
null
)
{
Class
<
RowFactory
>
rowFactoryClass
=
JdbcUtils
.
loadUserClass
(
rowFactoryClassName
);
try
{
rowFactory
=
rowFactoryClass
.
newInstance
();
}
catch
(
Exception
e
)
{
throw
DbException
.
convert
(
e
);
}
}
else
{
rowFactory
=
RowFactory
.
DEFAULT
;
}
boolean
closeAtVmShutdown
=
dbSettings
.
dbCloseOnExit
;
int
traceLevelFile
=
...
...
@@ -321,6 +310,10 @@ public class Database implements DataHandler {
return
rowFactory
;
}
public
void
setRowFactory
(
RowFactory
rowFactory
)
{
this
.
rowFactory
=
rowFactory
;
}
public
static
void
setInitialPowerOffCount
(
int
count
)
{
initialPowerOffCount
=
count
;
}
...
...
h2/src/main/org/h2/index/FunctionCursorResultSet.java
浏览文件 @
7df1c533
...
...
@@ -42,7 +42,7 @@ public class FunctionCursorResultSet implements Cursor {
return
null
;
}
if
(
row
==
null
)
{
row
=
session
.
createRow
(
values
,
1
);
row
=
session
.
createRow
(
values
,
1
);
}
return
row
;
}
...
...
h2/src/main/org/h2/result/RowFactory.java
浏览文件 @
7df1c533
...
...
@@ -7,16 +7,11 @@ import org.h2.value.Value;
*
* @author Sergi Vladykin
*/
public
interface
RowFactory
{
public
abstract
class
RowFactory
{
/**
* Default implementation of row factory.
*/
RowFactory
DEFAULT
=
new
RowFactory
()
{
@Override
public
Row
createRow
(
Value
[]
data
,
int
memory
)
{
return
new
RowImpl
(
data
,
memory
);
}
};
public
static
final
RowFactory
DEFAULT
=
new
DefaultRowFactory
();
/**
* Create new row.
...
...
@@ -25,5 +20,15 @@ public interface RowFactory {
* @param memory memory
* @return created row
*/
Row
createRow
(
Value
[]
data
,
int
memory
);
public
abstract
Row
createRow
(
Value
[]
data
,
int
memory
);
/**
* Default implementation of row factory.
*/
private
static
final
class
DefaultRowFactory
extends
RowFactory
{
@Override
public
Row
createRow
(
Value
[]
data
,
int
memory
)
{
return
new
RowImpl
(
data
,
memory
);
}
}
}
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
7df1c533
...
...
@@ -53,6 +53,7 @@ import org.h2.test.db.TestQueryCache;
import
org.h2.test.db.TestReadOnly
;
import
org.h2.test.db.TestRecursiveQueries
;
import
org.h2.test.db.TestRights
;
import
org.h2.test.db.TestRowFactory
;
import
org.h2.test.db.TestRunscript
;
import
org.h2.test.db.TestSQLInjection
;
import
org.h2.test.db.TestScript
;
...
...
@@ -696,6 +697,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest
(
new
TestSpatial
());
addTest
(
new
TestSpeed
());
addTest
(
new
TestTableEngines
());
addTest
(
new
TestRowFactory
());
addTest
(
new
TestTempTables
());
addTest
(
new
TestTransaction
());
addTest
(
new
TestTriggersConstraints
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论