Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
db3c045e
提交
db3c045e
authored
10月 30, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Views now store the schema for Java functions if "functions in schemas" is enabled.
上级
cb12305f
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
20 行增加
和
3 行删除
+20
-3
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
CreateView.java
h2/src/main/org/h2/command/ddl/CreateView.java
+2
-1
TestView.java
h2/src/test/org/h2/test/db/TestView.java
+15
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
db3c045e
...
@@ -18,7 +18,9 @@ Change Log
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Improved error message if the LOB files are already deleted on the client side.
<ul><li>
Views now store the schema for Java functions if "functions in schemas" is enabled
(system property h2.functionsInSchema).
</li><li>
Improved error message if the LOB files are already deleted on the client side.
</li><li>
Closing a Statement or PreparedStatement at the same time as executing a statement
</li><li>
Closing a Statement or PreparedStatement at the same time as executing a statement
could throw a strange exception. Issue 241.
could throw a strange exception. Issue 241.
</li><li>
The Recover tool did not work with compressed lob files (set compress_lob lzf).
</li><li>
The Recover tool did not work with compressed lob files (set compress_lob lzf).
...
...
h2/src/main/org/h2/command/ddl/CreateView.java
浏览文件 @
db3c045e
...
@@ -108,7 +108,8 @@ public class CreateView extends SchemaCommand {
...
@@ -108,7 +108,8 @@ public class CreateView extends SchemaCommand {
if
(
params
!=
null
&&
params
.
size
()
>
0
)
{
if
(
params
!=
null
&&
params
.
size
()
>
0
)
{
throw
DbException
.
get
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
"parameters in views"
);
throw
DbException
.
get
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
"parameters in views"
);
}
}
querySQL
=
TraceObject
.
toString
(
select
.
getSQL
(),
select
.
getParameters
());
// querySQL = TraceObject.toString(select.getSQL(), select.getParameters());
querySQL
=
TraceObject
.
toString
(
select
.
getPlanSQL
(),
select
.
getParameters
());
}
}
Session
sysSession
=
db
.
getSystemSession
();
Session
sysSession
=
db
.
getSystemSession
();
TableView
view
;
TableView
view
;
...
...
h2/src/test/org/h2/test/db/TestView.java
浏览文件 @
db3c045e
...
@@ -30,6 +30,7 @@ public class TestView extends TestBase {
...
@@ -30,6 +30,7 @@ public class TestView extends TestBase {
}
}
public
void
test
()
throws
SQLException
{
public
void
test
()
throws
SQLException
{
testChangeSchemaSearchPath
();
testParameterizedView
();
testParameterizedView
();
testCache
();
testCache
();
testCacheFunction
(
true
);
testCacheFunction
(
true
);
...
@@ -40,6 +41,19 @@ public class TestView extends TestBase {
...
@@ -40,6 +41,19 @@ public class TestView extends TestBase {
deleteDb
(
"view"
);
deleteDb
(
"view"
);
}
}
private
void
testChangeSchemaSearchPath
()
throws
SQLException
{
deleteDb
(
"view"
);
Connection
conn
=
getConnection
(
"view;FUNCTIONS_IN_SCHEMA=TRUE"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE ALIAS X AS $$ int x() { return 1; } $$;"
);
stat
.
execute
(
"CREATE SCHEMA S"
);
stat
.
execute
(
"CREATE VIEW S.TEST AS SELECT X() FROM DUAL"
);
stat
.
execute
(
"SET SCHEMA=S"
);
stat
.
execute
(
"SET SCHEMA_SEARCH_PATH=S"
);
stat
.
execute
(
"SELECT * FROM TEST"
);
conn
.
close
();
}
private
void
testParameterizedView
()
throws
SQLException
{
private
void
testParameterizedView
()
throws
SQLException
{
deleteDb
(
"view"
);
deleteDb
(
"view"
);
Connection
conn
=
getConnection
(
"view"
);
Connection
conn
=
getConnection
(
"view"
);
...
@@ -71,12 +85,12 @@ public class TestView extends TestBase {
...
@@ -71,12 +85,12 @@ public class TestView extends TestBase {
deleteDb
(
"view"
);
deleteDb
(
"view"
);
Connection
conn
=
getConnection
(
"view"
);
Connection
conn
=
getConnection
(
"view"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
x
=
8
;
stat
.
execute
(
"CREATE ALIAS GET_X "
+
stat
.
execute
(
"CREATE ALIAS GET_X "
+
(
deterministic
?
"DETERMINISTIC"
:
""
)
+
(
deterministic
?
"DETERMINISTIC"
:
""
)
+
" FOR \""
+
getClass
().
getName
()
+
".getX\""
);
" FOR \""
+
getClass
().
getName
()
+
".getX\""
);
stat
.
execute
(
"CREATE VIEW V AS SELECT * FROM (SELECT GET_X())"
);
stat
.
execute
(
"CREATE VIEW V AS SELECT * FROM (SELECT GET_X())"
);
ResultSet
rs
;
ResultSet
rs
;
x
=
8
;
rs
=
stat
.
executeQuery
(
"SELECT * FROM V"
);
rs
=
stat
.
executeQuery
(
"SELECT * FROM V"
);
rs
.
next
();
rs
.
next
();
assertEquals
(
8
,
rs
.
getInt
(
1
));
assertEquals
(
8
,
rs
.
getInt
(
1
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论