Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0cd1c2ed
提交
0cd1c2ed
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename Operation to BinaryOperation
上级
60dd9ea4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
13 行删除
+13
-13
Parser.java
h2/src/main/org/h2/command/Parser.java
+9
-9
BinaryOperation.java
h2/src/main/org/h2/expression/BinaryOperation.java
+4
-4
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
0cd1c2ed
...
...
@@ -148,6 +148,8 @@ import org.h2.engine.UserDataType;
import
org.h2.expression.Aggregate
;
import
org.h2.expression.Aggregate.AggregateType
;
import
org.h2.expression.Alias
;
import
org.h2.expression.BinaryOperation
;
import
org.h2.expression.BinaryOperation.OpType
;
import
org.h2.expression.CompareLike
;
import
org.h2.expression.Comparison
;
import
org.h2.expression.ConditionAndOr
;
...
...
@@ -163,8 +165,6 @@ import org.h2.expression.Function;
import
org.h2.expression.FunctionCall
;
import
org.h2.expression.JavaAggregate
;
import
org.h2.expression.JavaFunction
;
import
org.h2.expression.Operation
;
import
org.h2.expression.Operation.OpType
;
import
org.h2.expression.Parameter
;
import
org.h2.expression.Rownum
;
import
org.h2.expression.SequenceValue
;
...
...
@@ -2856,7 +2856,7 @@ public class Parser {
Expression
r
=
readSum
();
while
(
true
)
{
if
(
readIf
(
STRING_CONCAT
))
{
r
=
new
Operation
(
OpType
.
CONCAT
,
r
,
readSum
());
r
=
new
Binary
Operation
(
OpType
.
CONCAT
,
r
,
readSum
());
}
else
if
(
readIf
(
TILDE
))
{
if
(
readIf
(
ASTERISK
))
{
Function
function
=
Function
.
getFunction
(
database
,
"CAST"
);
...
...
@@ -2886,9 +2886,9 @@ public class Parser {
Expression
r
=
readFactor
();
while
(
true
)
{
if
(
readIf
(
PLUS_SIGN
))
{
r
=
new
Operation
(
OpType
.
PLUS
,
r
,
readFactor
());
r
=
new
Binary
Operation
(
OpType
.
PLUS
,
r
,
readFactor
());
}
else
if
(
readIf
(
MINUS_SIGN
))
{
r
=
new
Operation
(
OpType
.
MINUS
,
r
,
readFactor
());
r
=
new
Binary
Operation
(
OpType
.
MINUS
,
r
,
readFactor
());
}
else
{
return
r
;
}
...
...
@@ -2899,11 +2899,11 @@ public class Parser {
Expression
r
=
readTerm
();
while
(
true
)
{
if
(
readIf
(
ASTERISK
))
{
r
=
new
Operation
(
OpType
.
MULTIPLY
,
r
,
readTerm
());
r
=
new
Binary
Operation
(
OpType
.
MULTIPLY
,
r
,
readTerm
());
}
else
if
(
readIf
(
SLASH
))
{
r
=
new
Operation
(
OpType
.
DIVIDE
,
r
,
readTerm
());
r
=
new
Binary
Operation
(
OpType
.
DIVIDE
,
r
,
readTerm
());
}
else
if
(
readIf
(
PERCENT
))
{
r
=
new
Operation
(
OpType
.
MODULUS
,
r
,
readTerm
());
r
=
new
Binary
Operation
(
OpType
.
MODULUS
,
r
,
readTerm
());
}
else
{
return
r
;
}
...
...
@@ -3608,7 +3608,7 @@ public class Parser {
Function
function
=
Function
.
getFunction
(
database
,
"ARRAY_GET"
);
function
.
setParameter
(
0
,
r
);
r
=
readExpression
();
r
=
new
Operation
(
OpType
.
PLUS
,
r
,
ValueExpression
.
get
(
ValueInt
r
=
new
Binary
Operation
(
OpType
.
PLUS
,
r
,
ValueExpression
.
get
(
ValueInt
.
get
(
1
)));
function
.
setParameter
(
1
,
r
);
r
=
function
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Operation.java
→
h2/src/main/org/h2/expression/
Binary
Operation.java
浏览文件 @
0cd1c2ed
...
...
@@ -21,7 +21,7 @@ import org.h2.value.ValueString;
/**
* A mathematical expression, or string concatenation.
*/
public
class
Operation
extends
Expression
{
public
class
Binary
Operation
extends
Expression
{
public
enum
OpType
{
/**
...
...
@@ -61,7 +61,7 @@ public class Operation extends Expression {
private
int
dataType
;
private
boolean
convertRight
=
true
;
public
Operation
(
OpType
opType
,
Expression
left
,
Expression
right
)
{
public
Binary
Operation
(
OpType
opType
,
Expression
left
,
Expression
right
)
{
this
.
opType
=
opType
;
this
.
left
=
left
;
this
.
right
=
right
;
...
...
@@ -298,7 +298,7 @@ public class Operation extends Expression {
// Oracle date add
Function
f
=
Function
.
getFunction
(
session
.
getDatabase
(),
"DATEADD"
);
f
.
setParameter
(
0
,
ValueExpression
.
get
(
ValueString
.
get
(
"SECOND"
)));
left
=
new
Operation
(
OpType
.
MULTIPLY
,
ValueExpression
.
get
(
ValueInt
left
=
new
Binary
Operation
(
OpType
.
MULTIPLY
,
ValueExpression
.
get
(
ValueInt
.
get
(
60
*
60
*
24
)),
left
);
f
.
setParameter
(
1
,
left
);
f
.
setParameter
(
2
,
right
);
...
...
@@ -338,7 +338,7 @@ public class Operation extends Expression {
// Oracle date subtract
Function
f
=
Function
.
getFunction
(
session
.
getDatabase
(),
"DATEADD"
);
f
.
setParameter
(
0
,
ValueExpression
.
get
(
ValueString
.
get
(
"SECOND"
)));
right
=
new
Operation
(
OpType
.
MULTIPLY
,
ValueExpression
.
get
(
ValueInt
right
=
new
Binary
Operation
(
OpType
.
MULTIPLY
,
ValueExpression
.
get
(
ValueInt
.
get
(
60
*
60
*
24
)),
right
);
right
=
new
UnaryOperation
(
right
);
right
=
right
.
optimize
(
session
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论