Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a7b650a5
提交
a7b650a5
authored
11月 08, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract Expression.writeExpressions() helper methods
上级
ecb98c32
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
49 行增加
和
78 行删除
+49
-78
Prepared.java
h2/src/main/org/h2/command/Prepared.java
+3
-8
ConditionIn.java
h2/src/main/org/h2/expression/ConditionIn.java
+1
-6
ConditionInConstantSet.java
h2/src/main/org/h2/expression/ConditionInConstantSet.java
+1
-6
Expression.java
h2/src/main/org/h2/expression/Expression.java
+20
-0
ExpressionList.java
h2/src/main/org/h2/expression/ExpressionList.java
+1
-6
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-8
JavaFunction.java
h2/src/main/org/h2/expression/JavaFunction.java
+1
-6
Wildcard.java
h2/src/main/org/h2/expression/Wildcard.java
+1
-6
JavaAggregate.java
h2/src/main/org/h2/expression/aggregate/JavaAggregate.java
+1
-6
WindowFunction.java
h2/src/main/org/h2/expression/aggregate/WindowFunction.java
+1
-6
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+17
-20
没有找到文件。
h2/src/main/org/h2/command/Prepared.java
浏览文件 @
a7b650a5
...
@@ -418,14 +418,9 @@ public abstract class Prepared {
...
@@ -418,14 +418,9 @@ public abstract class Prepared {
* @return the SQL snippet
* @return the SQL snippet
*/
*/
protected
static
String
getSQL
(
Expression
[]
list
)
{
protected
static
String
getSQL
(
Expression
[]
list
)
{
StatementBuilder
buff
=
new
StatementBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
for
(
Expression
e
:
list
)
{
Expression
.
writeExpressions
(
builder
,
list
);
buff
.
appendExceptFirst
(
", "
);
return
builder
.
toString
();
if
(
e
!=
null
)
{
e
.
getSQL
(
buff
.
builder
());
}
}
return
buff
.
toString
();
}
}
/**
/**
...
...
h2/src/main/org/h2/expression/ConditionIn.java
浏览文件 @
a7b650a5
...
@@ -154,12 +154,7 @@ public class ConditionIn extends Condition {
...
@@ -154,12 +154,7 @@ public class ConditionIn extends Condition {
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
builder
.
append
(
'('
);
builder
.
append
(
'('
);
left
.
getSQL
(
builder
).
append
(
" IN("
);
left
.
getSQL
(
builder
).
append
(
" IN("
);
for
(
int
i
=
0
;
i
<
valueList
.
size
();
i
++)
{
writeExpressions
(
builder
,
valueList
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
valueList
.
get
(
i
).
getSQL
(
builder
);
}
return
builder
.
append
(
"))"
);
return
builder
.
append
(
"))"
);
}
}
...
...
h2/src/main/org/h2/expression/ConditionInConstantSet.java
浏览文件 @
a7b650a5
...
@@ -116,12 +116,7 @@ public class ConditionInConstantSet extends Condition {
...
@@ -116,12 +116,7 @@ public class ConditionInConstantSet extends Condition {
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
builder
.
append
(
'('
);
builder
.
append
(
'('
);
left
.
getSQL
(
builder
).
append
(
" IN("
);
left
.
getSQL
(
builder
).
append
(
" IN("
);
for
(
int
i
=
0
,
s
=
valueList
.
size
();
i
<
s
;
i
++)
{
writeExpressions
(
builder
,
valueList
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
valueList
.
get
(
i
).
getSQL
(
builder
);
}
return
builder
.
append
(
"))"
);
return
builder
.
append
(
"))"
);
}
}
...
...
h2/src/main/org/h2/expression/Expression.java
浏览文件 @
a7b650a5
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
*/
*/
package
org
.
h2
.
expression
;
package
org
.
h2
.
expression
;
import
java.util.List
;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.ResultInterface
;
...
@@ -38,6 +40,24 @@ public abstract class Expression {
...
@@ -38,6 +40,24 @@ public abstract class Expression {
private
boolean
addedToFilter
;
private
boolean
addedToFilter
;
public
static
void
writeExpressions
(
StringBuilder
builder
,
List
<?
extends
Expression
>
expressions
)
{
for
(
int
i
=
0
,
length
=
expressions
.
size
();
i
<
length
;
i
++)
{
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
expressions
.
get
(
i
).
getSQL
(
builder
);
}
}
public
static
void
writeExpressions
(
StringBuilder
builder
,
Expression
[]
expressions
)
{
for
(
int
i
=
0
,
length
=
expressions
.
length
;
i
<
length
;
i
++)
{
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
expressions
[
i
].
getSQL
(
builder
);
}
}
/**
/**
* Return the resulting value for the current row.
* Return the resulting value for the current row.
*
*
...
...
h2/src/main/org/h2/expression/ExpressionList.java
浏览文件 @
a7b650a5
...
@@ -86,12 +86,7 @@ public class ExpressionList extends Expression {
...
@@ -86,12 +86,7 @@ public class ExpressionList extends Expression {
@Override
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
builder
.
append
(
'('
);
builder
.
append
(
'('
);
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
writeExpressions
(
builder
,
list
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
list
[
i
].
getSQL
(
builder
);
}
if
(
list
.
length
==
1
)
{
if
(
list
.
length
==
1
)
{
builder
.
append
(
','
);
builder
.
append
(
','
);
}
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
a7b650a5
...
@@ -2627,14 +2627,8 @@ public class Function extends Expression implements FunctionCall {
...
@@ -2627,14 +2627,8 @@ public class Function extends Expression implements FunctionCall {
args
[
1
].
getSQL
(
builder
);
args
[
1
].
getSQL
(
builder
);
break
;
break
;
}
}
default
:
{
default
:
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
writeExpressions
(
builder
,
args
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
args
[
i
].
getSQL
(
builder
);
}
}
}
}
return
builder
.
append
(
')'
);
return
builder
.
append
(
')'
);
}
}
...
...
h2/src/main/org/h2/expression/JavaFunction.java
浏览文件 @
a7b650a5
...
@@ -95,12 +95,7 @@ public class JavaFunction extends Expression implements FunctionCall {
...
@@ -95,12 +95,7 @@ public class JavaFunction extends Expression implements FunctionCall {
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getSchema
().
getName
()).
append
(
'.'
);
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getSchema
().
getName
()).
append
(
'.'
);
}
}
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getName
()).
append
(
'('
);
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getName
()).
append
(
'('
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
writeExpressions
(
builder
,
this
.
args
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
args
[
i
].
getSQL
(
builder
);
}
return
builder
.
append
(
')'
);
return
builder
.
append
(
')'
);
}
}
...
...
h2/src/main/org/h2/expression/Wildcard.java
浏览文件 @
a7b650a5
...
@@ -123,12 +123,7 @@ public class Wildcard extends Expression {
...
@@ -123,12 +123,7 @@ public class Wildcard extends Expression {
builder
.
append
(
'*'
);
builder
.
append
(
'*'
);
if
(
exceptColumns
!=
null
)
{
if
(
exceptColumns
!=
null
)
{
builder
.
append
(
" EXCEPT ("
);
builder
.
append
(
" EXCEPT ("
);
for
(
int
i
=
0
;
i
<
exceptColumns
.
size
();
i
++)
{
writeExpressions
(
builder
,
exceptColumns
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
exceptColumns
.
get
(
i
).
getSQL
(
builder
);
}
builder
.
append
(
')'
);
builder
.
append
(
')'
);
}
}
return
builder
;
return
builder
;
...
...
h2/src/main/org/h2/expression/aggregate/JavaAggregate.java
浏览文件 @
a7b650a5
...
@@ -69,12 +69,7 @@ public class JavaAggregate extends AbstractAggregate {
...
@@ -69,12 +69,7 @@ public class JavaAggregate extends AbstractAggregate {
@Override
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
Parser
.
quoteIdentifier
(
builder
,
userAggregate
.
getName
()).
append
(
'('
);
Parser
.
quoteIdentifier
(
builder
,
userAggregate
.
getName
()).
append
(
'('
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
writeExpressions
(
builder
,
args
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
args
[
i
].
getSQL
(
builder
);
}
builder
.
append
(
')'
);
builder
.
append
(
')'
);
return
appendTailConditions
(
builder
);
return
appendTailConditions
(
builder
);
}
}
...
...
h2/src/main/org/h2/expression/aggregate/WindowFunction.java
浏览文件 @
a7b650a5
...
@@ -519,12 +519,7 @@ public class WindowFunction extends DataAnalysisOperation {
...
@@ -519,12 +519,7 @@ public class WindowFunction extends DataAnalysisOperation {
String
name
=
type
.
getSQL
();
String
name
=
type
.
getSQL
();
builder
.
append
(
name
).
append
(
'('
);
builder
.
append
(
name
).
append
(
'('
);
if
(
args
!=
null
)
{
if
(
args
!=
null
)
{
for
(
int
i
=
0
,
numArgs
=
args
.
length
;
i
<
numArgs
;
i
++)
{
writeExpressions
(
builder
,
args
);
if
(
i
>
0
)
{
builder
.
append
(
", "
);
}
args
[
i
].
getSQL
(
builder
);
}
}
}
builder
.
append
(
')'
);
builder
.
append
(
')'
);
if
(
fromLast
&&
type
==
WindowFunctionType
.
NTH_VALUE
)
{
if
(
fromLast
&&
type
==
WindowFunctionType
.
NTH_VALUE
)
{
...
...
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
a7b650a5
...
@@ -177,50 +177,47 @@ public class IndexCondition {
...
@@ -177,50 +177,47 @@ public class IndexCondition {
if
(
compareType
==
Comparison
.
FALSE
)
{
if
(
compareType
==
Comparison
.
FALSE
)
{
return
"FALSE"
;
return
"FALSE"
;
}
}
St
atementBuilder
buff
=
new
Statement
Builder
();
St
ringBuilder
builder
=
new
String
Builder
();
bu
ff
.
append
(
column
.
getSQL
());
bu
ilder
.
append
(
column
.
getSQL
());
switch
(
compareType
)
{
switch
(
compareType
)
{
case
Comparison
.
EQUAL
:
case
Comparison
.
EQUAL
:
bu
ff
.
append
(
" = "
);
bu
ilder
.
append
(
" = "
);
break
;
break
;
case
Comparison
.
EQUAL_NULL_SAFE
:
case
Comparison
.
EQUAL_NULL_SAFE
:
bu
ff
.
append
(
" IS "
);
bu
ilder
.
append
(
" IS "
);
break
;
break
;
case
Comparison
.
BIGGER_EQUAL
:
case
Comparison
.
BIGGER_EQUAL
:
bu
ff
.
append
(
" >= "
);
bu
ilder
.
append
(
" >= "
);
break
;
break
;
case
Comparison
.
BIGGER
:
case
Comparison
.
BIGGER
:
bu
ff
.
append
(
" > "
);
bu
ilder
.
append
(
" > "
);
break
;
break
;
case
Comparison
.
SMALLER_EQUAL
:
case
Comparison
.
SMALLER_EQUAL
:
bu
ff
.
append
(
" <= "
);
bu
ilder
.
append
(
" <= "
);
break
;
break
;
case
Comparison
.
SMALLER
:
case
Comparison
.
SMALLER
:
bu
ff
.
append
(
" < "
);
bu
ilder
.
append
(
" < "
);
break
;
break
;
case
Comparison
.
IN_LIST
:
case
Comparison
.
IN_LIST
:
buff
.
append
(
" IN("
);
builder
.
append
(
" IN("
);
for
(
Expression
e
:
expressionList
)
{
Expression
.
writeExpressions
(
builder
,
expressionList
);
buff
.
appendExceptFirst
(
", "
);
builder
.
append
(
')'
);
e
.
getSQL
(
buff
.
builder
());
}
buff
.
append
(
')'
);
break
;
break
;
case
Comparison
.
IN_QUERY
:
case
Comparison
.
IN_QUERY
:
bu
ff
.
append
(
" IN("
);
bu
ilder
.
append
(
" IN("
);
bu
ff
.
append
(
expressionQuery
.
getPlanSQL
());
bu
ilder
.
append
(
expressionQuery
.
getPlanSQL
());
bu
ff
.
append
(
')'
);
bu
ilder
.
append
(
')'
);
break
;
break
;
case
Comparison
.
SPATIAL_INTERSECTS
:
case
Comparison
.
SPATIAL_INTERSECTS
:
bu
ff
.
append
(
" && "
);
bu
ilder
.
append
(
" && "
);
break
;
break
;
default
:
default
:
DbException
.
throwInternalError
(
"type="
+
compareType
);
DbException
.
throwInternalError
(
"type="
+
compareType
);
}
}
if
(
expression
!=
null
)
{
if
(
expression
!=
null
)
{
expression
.
getSQL
(
bu
ff
.
builder
()
);
expression
.
getSQL
(
bu
ilder
);
}
}
return
bu
ff
.
toString
();
return
bu
ilder
.
toString
();
}
}
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论