Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cc4484f3
提交
cc4484f3
authored
10月 09, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move mapExceptColumns() to Wildcard
上级
0c646e4c
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
20 行删除
+28
-20
Select.java
h2/src/main/org/h2/command/dml/Select.java
+5
-19
Wildcard.java
h2/src/main/org/h2/expression/Wildcard.java
+22
-0
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
没有找到文件。
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
cc4484f3
...
@@ -893,14 +893,14 @@ public class Select extends Query {
...
@@ -893,14 +893,14 @@ public class Select extends Query {
String
schemaName
=
expr
.
getSchemaName
();
String
schemaName
=
expr
.
getSchemaName
();
String
tableAlias
=
expr
.
getTableAlias
();
String
tableAlias
=
expr
.
getTableAlias
();
Wildcard
w
=
(
Wildcard
)
expr
;
Wildcard
w
=
(
Wildcard
)
expr
;
ArrayList
<
ExpressionColumn
>
exceptColumns
=
w
.
getExceptColumns
()
;
boolean
hasExceptColumns
=
w
.
getExceptColumns
()
!=
null
;
HashMap
<
Column
,
ExpressionColumn
>
exceptTableColumns
=
null
;
HashMap
<
Column
,
ExpressionColumn
>
exceptTableColumns
=
null
;
if
(
tableAlias
==
null
)
{
if
(
tableAlias
==
null
)
{
if
(
exceptColumns
!=
null
)
{
if
(
hasExceptColumns
)
{
for
(
TableFilter
filter
:
filters
)
{
for
(
TableFilter
filter
:
filters
)
{
w
.
mapColumns
(
filter
,
1
,
Expression
.
MAP_INITIAL
);
w
.
mapColumns
(
filter
,
1
,
Expression
.
MAP_INITIAL
);
}
}
exceptTableColumns
=
mapExceptColumns
(
exceptColumns
);
exceptTableColumns
=
w
.
mapExceptColumns
(
);
}
}
expressions
.
remove
(
i
);
expressions
.
remove
(
i
);
for
(
TableFilter
filter
:
filters
)
{
for
(
TableFilter
filter
:
filters
)
{
...
@@ -912,9 +912,9 @@ public class Select extends Query {
...
@@ -912,9 +912,9 @@ public class Select extends Query {
for
(
TableFilter
f
:
filters
)
{
for
(
TableFilter
f
:
filters
)
{
if
(
db
.
equalsIdentifiers
(
tableAlias
,
f
.
getTableAlias
()))
{
if
(
db
.
equalsIdentifiers
(
tableAlias
,
f
.
getTableAlias
()))
{
if
(
schemaName
==
null
||
db
.
equalsIdentifiers
(
schemaName
,
f
.
getSchemaName
()))
{
if
(
schemaName
==
null
||
db
.
equalsIdentifiers
(
schemaName
,
f
.
getSchemaName
()))
{
if
(
exceptColumns
!=
null
)
{
if
(
hasExceptColumns
)
{
w
.
mapColumns
(
f
,
1
,
Expression
.
MAP_INITIAL
);
w
.
mapColumns
(
f
,
1
,
Expression
.
MAP_INITIAL
);
exceptTableColumns
=
mapExceptColumns
(
exceptColumns
);
exceptTableColumns
=
w
.
mapExceptColumns
(
);
}
}
filter
=
f
;
filter
=
f
;
break
;
break
;
...
@@ -931,20 +931,6 @@ public class Select extends Query {
...
@@ -931,20 +931,6 @@ public class Select extends Query {
}
}
}
}
public
HashMap
<
Column
,
ExpressionColumn
>
mapExceptColumns
(
ArrayList
<
ExpressionColumn
>
exceptColumns
)
{
HashMap
<
Column
,
ExpressionColumn
>
exceptTableColumns
=
new
HashMap
<>();
for
(
ExpressionColumn
ec
:
exceptColumns
)
{
Column
column
=
ec
.
getColumn
();
if
(
column
==
null
)
{
throw
ec
.
getColumnException
(
ErrorCode
.
COLUMN_NOT_FOUND_1
);
}
if
(
exceptTableColumns
.
put
(
column
,
ec
)
!=
null
)
{
throw
ec
.
getColumnException
(
ErrorCode
.
DUPLICATE_COLUMN_NAME_1
);
}
}
return
exceptTableColumns
;
}
private
int
expandColumnList
(
TableFilter
filter
,
int
index
,
HashMap
<
Column
,
ExpressionColumn
>
except
)
{
private
int
expandColumnList
(
TableFilter
filter
,
int
index
,
HashMap
<
Column
,
ExpressionColumn
>
except
)
{
Table
t
=
filter
.
getTable
();
Table
t
=
filter
.
getTable
();
String
alias
=
filter
.
getTableAlias
();
String
alias
=
filter
.
getTableAlias
();
...
...
h2/src/main/org/h2/expression/Wildcard.java
浏览文件 @
cc4484f3
...
@@ -6,10 +6,12 @@
...
@@ -6,10 +6,12 @@
package
org
.
h2
.
expression
;
package
org
.
h2
.
expression
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.table.Column
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableFilter
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -39,6 +41,26 @@ public class Wildcard extends Expression {
...
@@ -39,6 +41,26 @@ public class Wildcard extends Expression {
this
.
exceptColumns
=
exceptColumns
;
this
.
exceptColumns
=
exceptColumns
;
}
}
/**
* Returns map of excluded table columns to expression columns and validates
* that all columns are resolved and not duplicated.
*
* @return map of excluded table columns to expression columns
*/
public
HashMap
<
Column
,
ExpressionColumn
>
mapExceptColumns
()
{
HashMap
<
Column
,
ExpressionColumn
>
exceptTableColumns
=
new
HashMap
<>();
for
(
ExpressionColumn
ec
:
exceptColumns
)
{
Column
column
=
ec
.
getColumn
();
if
(
column
==
null
)
{
throw
ec
.
getColumnException
(
ErrorCode
.
COLUMN_NOT_FOUND_1
);
}
if
(
exceptTableColumns
.
put
(
column
,
ec
)
!=
null
)
{
throw
ec
.
getColumnException
(
ErrorCode
.
DUPLICATE_COLUMN_NAME_1
);
}
}
return
exceptTableColumns
;
}
@Override
@Override
public
boolean
isWildcard
()
{
public
boolean
isWildcard
()
{
return
true
;
return
true
;
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
cc4484f3
...
@@ -800,4 +800,4 @@ ranks rno dro rko precede cume reopens preceding unbounded rightly itr lag maxim
...
@@ -800,4 +800,4 @@ ranks rno dro rko precede cume reopens preceding unbounded rightly itr lag maxim
partitioned tri partitions
partitioned tri partitions
discard enhancements nolock surefire logarithm
discard enhancements nolock surefire logarithm
qualification opportunity jumping exploited unacceptable vrs
qualification opportunity jumping exploited unacceptable vrs
duplicated
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论