Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5f78b1cb
提交
5f78b1cb
authored
11月 26, 2017
作者:
Owner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reverted to UNKNOWN column types for create view
上级
e3e6fa9f
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
29 行增加
和
24 行删除
+29
-24
CreateView.java
h2/src/main/org/h2/command/ddl/CreateView.java
+11
-6
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+14
-14
TestGeneralCommonTableQueries.java
...rc/test/org/h2/test/db/TestGeneralCommonTableQueries.java
+4
-4
没有找到文件。
h2/src/main/org/h2/command/ddl/CreateView.java
浏览文件 @
5f78b1cb
...
@@ -103,24 +103,29 @@ public class CreateView extends SchemaCommand {
...
@@ -103,24 +103,29 @@ public class CreateView extends SchemaCommand {
}
}
querySQL
=
select
.
getPlanSQL
();
querySQL
=
select
.
getPlanSQL
();
}
}
Column
[]
columnTemplates
=
null
;
Column
[]
columnTemplatesAsUnknowns
=
null
;
Column
[]
columnTemplatesAsStrings
=
null
;
if
(
columnNames
!=
null
)
{
if
(
columnNames
!=
null
)
{
columnTemplates
=
new
Column
[
columnNames
.
length
];
columnTemplatesAsUnknowns
=
new
Column
[
columnNames
.
length
];
columnTemplatesAsStrings
=
new
Column
[
columnNames
.
length
];
for
(
int
i
=
0
;
i
<
columnNames
.
length
;
++
i
)
{
for
(
int
i
=
0
;
i
<
columnNames
.
length
;
++
i
)
{
columnTemplates
[
i
]
=
new
Column
(
columnNames
[
i
],
Value
.
STRING
);
// non table expressions are fine to use unknown column type
columnTemplatesAsUnknowns
[
i
]
=
new
Column
(
columnNames
[
i
],
Value
.
UNKNOWN
);
// table expressions can't have unknown types - so we use string instead
columnTemplatesAsStrings
[
i
]
=
new
Column
(
columnNames
[
i
],
Value
.
STRING
);
}
}
}
}
if
(
view
==
null
)
{
if
(
view
==
null
)
{
if
(
isTableExpression
){
if
(
isTableExpression
){
view
=
TableView
.
createTableViewMaybeRecursive
(
getSchema
(),
id
,
viewName
,
querySQL
,
null
,
columnTemplates
,
session
,
false
/* literalsChecked */
,
isTableExpression
,
true
/*isPersistent*/
,
db
);
view
=
TableView
.
createTableViewMaybeRecursive
(
getSchema
(),
id
,
viewName
,
querySQL
,
null
,
columnTemplates
AsStrings
,
session
,
false
/* literalsChecked */
,
isTableExpression
,
true
/*isPersistent*/
,
db
);
}
}
else
else
{
{
view
=
new
TableView
(
getSchema
(),
id
,
viewName
,
querySQL
,
null
,
columnTemplates
,
session
,
false
/* allow recursive */
,
false
/* literalsChecked */
,
isTableExpression
,
true
);
view
=
new
TableView
(
getSchema
(),
id
,
viewName
,
querySQL
,
null
,
columnTemplates
AsUnknowns
,
session
,
false
/* allow recursive */
,
false
/* literalsChecked */
,
isTableExpression
,
true
);
}
}
}
else
{
}
else
{
// TODO support isTableExpression in replace function...
// TODO support isTableExpression in replace function...
view
.
replace
(
querySQL
,
columnTemplates
,
session
,
false
,
force
,
false
);
view
.
replace
(
querySQL
,
columnTemplates
AsUnknowns
,
session
,
false
,
force
,
false
);
view
.
setModified
();
view
.
setModified
();
}
}
if
(
comment
!=
null
)
{
if
(
comment
!=
null
)
{
...
...
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
5f78b1cb
...
@@ -402,20 +402,20 @@ public class MVTable extends TableBase {
...
@@ -402,20 +402,20 @@ public class MVTable extends TableBase {
exclusive
?
"exclusive write lock"
:
"shared read lock"
,
statusText
,
exclusive
?
"exclusive write lock"
:
"shared read lock"
,
statusText
,
getName
());
getName
());
// create a stack trace when the lock is granted so we can debug where that was...
//
// create a stack trace when the lock is granted so we can debug where that was...
if
(
statusText
.
equals
(
TRACE_LOCK_ADDED_FOR
)
||
statusText
.
equals
(
TRACE_LOCK_ADD_UPGRADED_FOR
)){
//
if(statusText.equals(TRACE_LOCK_ADDED_FOR) || statusText.equals(TRACE_LOCK_ADD_UPGRADED_FOR)){
lockExclusiveSessionStackTrace
=
new
Throwable
(
"trace lock - lock granted stack trace"
);
//
lockExclusiveSessionStackTrace = new Throwable("trace lock - lock granted stack trace");
}
//
}
//
// clear the stack trace of the granted lock, on unlock
//
// clear the stack trace of the granted lock, on unlock
if
(
statusText
.
equals
(
TRACE_LOCK_UNLOCK
)){
//
if(statusText.equals(TRACE_LOCK_UNLOCK)){
lockExclusiveSessionStackTrace
=
null
;
//
lockExclusiveSessionStackTrace = null;
}
//
}
//
// show the stack trace where the lock was granted, if a timeout happens...
//
// show the stack trace where the lock was granted, if a timeout happens...
if
(
statusText
.
contains
(
TRACE_LOCK_TIMEOUT_AFTER
)
&&
lockExclusiveSessionStackTrace
!=
null
){
//
if(statusText.contains(TRACE_LOCK_TIMEOUT_AFTER) && lockExclusiveSessionStackTrace!=null){
lockExclusiveSessionStackTrace
.
printStackTrace
();
//
lockExclusiveSessionStackTrace.printStackTrace();
}
//
}
}
}
}
}
...
...
h2/src/test/org/h2/test/db/TestGeneralCommonTableQueries.java
浏览文件 @
5f78b1cb
...
@@ -598,7 +598,7 @@ public class TestGeneralCommonTableQueries extends TestBase {
...
@@ -598,7 +598,7 @@ public class TestGeneralCommonTableQueries extends TestBase {
;
;
String
WITH_QUERY
=
"SELECT * FROM v_my_nr_tree"
;
String
WITH_QUERY
=
"SELECT * FROM v_my_nr_tree"
;
int
maxRetries
=
4
;
int
maxRetries
=
6
;
String
[]
expectedRowData
=
new
String
[]{
String
[]
expectedRowData
=
new
String
[]{
"|1|0|null|1"
,
"|1|0|null|1"
,
"|11|0|1|11"
,
"|11|0|1|11"
,
...
@@ -622,7 +622,7 @@ public class TestGeneralCommonTableQueries extends TestBase {
...
@@ -622,7 +622,7 @@ public class TestGeneralCommonTableQueries extends TestBase {
for
(
int
queryRunTries
=
1
;
queryRunTries
<=
maxRetries
;
queryRunTries
++){
for
(
int
queryRunTries
=
1
;
queryRunTries
<=
maxRetries
;
queryRunTries
++){
//
System.out.println("==================================== Iteration #"+queryRunTries);
System
.
out
.
println
(
"==================================== Iteration #"
+
queryRunTries
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
SETUP_SQL
);
stat
.
execute
(
SETUP_SQL
);
...
@@ -630,12 +630,12 @@ public class TestGeneralCommonTableQueries extends TestBase {
...
@@ -630,12 +630,12 @@ public class TestGeneralCommonTableQueries extends TestBase {
// close and re-open connection for one iteration to make sure the query work between connections
// close and re-open connection for one iteration to make sure the query work between connections
if
(
queryRunTries
==
closeAndReopenDatabaseConnectionOnIteration
){
if
(
queryRunTries
==
closeAndReopenDatabaseConnectionOnIteration
){
//
System.out.println("Reconnecting to database on iteration#"+queryRunTries+" of "+maxRetries);
System
.
out
.
println
(
"Reconnecting to database on iteration#"
+
queryRunTries
+
" of "
+
maxRetries
);
conn
.
close
();
conn
.
close
();
conn
=
getConnection
(
"commonTableExpressionQueries"
);
conn
=
getConnection
(
"commonTableExpressionQueries"
);
}
}
//
System.out.println("=========== test with query");
System
.
out
.
println
(
"=========== test with query"
);
prep
=
conn
.
prepareStatement
(
WITH_QUERY
);
prep
=
conn
.
prepareStatement
(
WITH_QUERY
);
rs
=
prep
.
executeQuery
();
rs
=
prep
.
executeQuery
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论