Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
14268b9c
提交
14268b9c
authored
11月 18, 2015
作者:
S.Vladykin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More tests for select expressions in/with subqueries.
上级
ba7ba113
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
27 行增加
和
2 行删除
+27
-2
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+27
-2
没有找到文件。
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
14268b9c
...
@@ -365,6 +365,21 @@ public class TestTableEngines extends TestBase {
...
@@ -365,6 +365,21 @@ public class TestTableEngines extends TestBase {
stat
.
execute
(
"create view t5 as "
stat
.
execute
(
"create view t5 as "
+
"(select t2.id from t4, sub_query_test t2 where t2.id = t4.id)"
);
+
"(select t2.id from t4, sub_query_test t2 where t2.id = t4.id)"
);
stat
.
executeQuery
(
"select * from t5"
).
next
();
stat
.
executeQuery
(
"select * from t5"
).
next
();
// test select expressions
stat
.
execute
(
"create table EXPR_TEST(id int) ENGINE \""
+
TreeSetIndexTableEngine
.
class
.
getName
()
+
"\""
);
stat
.
executeQuery
(
"select * from (select (select id from EXPR_TEST x limit 1) a "
+
"from dual where 1 = (select id from EXPR_TEST y limit 1)) z"
).
next
();
// test select expressions 2
stat
.
execute
(
"create table EXPR_TEST2(id int) ENGINE \""
+
TreeSetIndexTableEngine
.
class
.
getName
()
+
"\""
);
stat
.
executeQuery
(
"select * from (select (select 1 from "
+
"(select 2 from EXPR_TEST2) ZZ) from dual)"
).
next
();
// test select expression plan
stat
.
execute
(
"create table test_plan(id int primary key, name varchar)"
);
stat
.
execute
(
"create index MY_NAME_INDEX on test_plan(name)"
);
checkPlan
(
stat
,
"select * from (select (select id from test_plan where name = 'z') from dual)"
,
"MY_NAME_INDEX"
);
deleteDb
(
"testSubQueryInfo"
);
deleteDb
(
"testSubQueryInfo"
);
}
}
...
@@ -1235,16 +1250,20 @@ public class TestTableEngines extends TestBase {
...
@@ -1235,16 +1250,20 @@ public class TestTableEngines extends TestBase {
return
new
IteratorCursor
(
subSet
.
iterator
());
return
new
IteratorCursor
(
subSet
.
iterator
());
}
}
private
static
String
alias
(
SubQueryInfo
info
)
{
return
info
.
getFilters
()[
info
.
getFilter
()].
getTableAlias
();
}
private
void
checkInfo
(
SubQueryInfo
info
)
{
private
void
checkInfo
(
SubQueryInfo
info
)
{
if
(
info
.
getUpper
()
==
null
)
{
if
(
info
.
getUpper
()
==
null
)
{
// check 1st level info
// check 1st level info
assert0
(
info
.
getFilters
().
length
==
1
,
"getFilters().length "
+
info
.
getFilters
().
length
);
assert0
(
info
.
getFilters
().
length
==
1
,
"getFilters().length "
+
info
.
getFilters
().
length
);
String
alias
=
info
.
getFilters
()[
info
.
getFilter
()].
getTableAlias
(
);
String
alias
=
alias
(
info
);
assert0
(
"T5"
.
equals
(
alias
),
"alias: "
+
alias
);
assert0
(
"T5"
.
equals
(
alias
),
"alias: "
+
alias
);
}
else
{
}
else
{
// check 2nd level info
// check 2nd level info
assert0
(
info
.
getFilters
().
length
==
2
,
"getFilters().length "
+
info
.
getFilters
().
length
);
assert0
(
info
.
getFilters
().
length
==
2
,
"getFilters().length "
+
info
.
getFilters
().
length
);
String
alias
=
info
.
getFilters
()[
info
.
getFilter
()].
getTableAlias
(
);
String
alias
=
alias
(
info
);
assert0
(
"T4"
.
equals
(
alias
),
"alias: "
+
alias
);
assert0
(
"T4"
.
equals
(
alias
),
"alias: "
+
alias
);
checkInfo
(
info
.
getUpper
());
checkInfo
(
info
.
getUpper
());
}
}
...
@@ -1255,6 +1274,12 @@ public class TestTableEngines extends TestBase {
...
@@ -1255,6 +1274,12 @@ public class TestTableEngines extends TestBase {
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
)
{
if
(
getTable
().
getName
().
equals
(
"SUB_QUERY_TEST"
))
{
if
(
getTable
().
getName
().
equals
(
"SUB_QUERY_TEST"
))
{
checkInfo
(
session
.
getSubQueryInfo
());
checkInfo
(
session
.
getSubQueryInfo
());
}
else
if
(
getTable
().
getName
().
equals
(
"EXPR_TEST"
))
{
assert0
(
session
.
getSubQueryInfo
()
==
null
,
"select expression"
);
}
else
if
(
getTable
().
getName
().
equals
(
"EXPR_TEST2"
))
{
String
alias
=
alias
(
session
.
getSubQueryInfo
());
assert0
(
alias
.
equals
(
"ZZ"
),
"select expression sub-query: "
+
alias
);
assert0
(
session
.
getSubQueryInfo
().
getUpper
()
==
null
,
"upper"
);
}
}
return
getCostRangeIndex
(
masks
,
set
.
size
(),
filters
,
filter
,
sortOrder
);
return
getCostRangeIndex
(
masks
,
set
.
size
(),
filters
,
filter
,
sortOrder
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论