Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
41a502e3
提交
41a502e3
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use single type info field in Function
上级
a03cc5e6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
23 行删除
+17
-23
Function.java
h2/src/main/org/h2/expression/function/Function.java
+10
-17
FunctionsMySQL.java
h2/src/main/org/h2/mode/FunctionsMySQL.java
+1
-2
TypeInfo.java
h2/src/main/org/h2/value/TypeInfo.java
+6
-4
没有找到文件。
h2/src/main/org/h2/expression/function/Function.java
浏览文件 @
41a502e3
...
...
@@ -61,7 +61,6 @@ import org.h2.util.MathUtils;
import
org.h2.util.StringUtils
;
import
org.h2.util.Utils
;
import
org.h2.value.DataType
;
import
org.h2.value.ExtTypeInfo
;
import
org.h2.value.TypeInfo
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
...
...
@@ -164,9 +163,6 @@ public class Function extends Expression implements FunctionCall {
protected
final
FunctionInfo
info
;
private
ArrayList
<
Expression
>
varArgs
;
protected
TypeInfo
type
;
protected
int
dataType
;
protected
ExtTypeInfo
extTypeInfo
;
private
final
Database
database
;
...
...
@@ -931,7 +927,7 @@ public class Function extends Expression implements FunctionCall {
if
(
v0
==
ValueNull
.
INSTANCE
)
{
result
=
getNullOrValue
(
session
,
args
,
values
,
1
);
}
result
=
result
.
convertTo
(
dataType
,
database
.
getMode
()
);
result
=
result
.
convertTo
(
type
,
database
.
getMode
(),
null
);
break
;
}
case
CASEWHEN:
{
...
...
@@ -941,7 +937,7 @@ public class Function extends Expression implements FunctionCall {
}
else
{
v
=
getNullOrValue
(
session
,
args
,
values
,
1
);
}
result
=
v
.
convertTo
(
dataType
);
result
=
v
.
convertTo
(
type
,
database
.
getMode
(),
null
);
break
;
}
case
DECODE:
{
...
...
@@ -958,7 +954,7 @@ public class Function extends Expression implements FunctionCall {
}
Value
v
=
index
<
0
?
ValueNull
.
INSTANCE
:
getNullOrValue
(
session
,
args
,
values
,
index
);
result
=
v
.
convertTo
(
dataType
);
result
=
v
.
convertTo
(
type
,
database
.
getMode
(),
null
);
break
;
}
case
NVL2:
{
...
...
@@ -968,7 +964,7 @@ public class Function extends Expression implements FunctionCall {
}
else
{
v
=
getNullOrValue
(
session
,
args
,
values
,
1
);
}
result
=
v
.
convertTo
(
dataType
);
result
=
v
.
convertTo
(
type
,
database
.
getMode
(),
null
);
break
;
}
case
COALESCE:
{
...
...
@@ -976,7 +972,7 @@ public class Function extends Expression implements FunctionCall {
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
Value
v
=
getNullOrValue
(
session
,
args
,
values
,
i
);
if
(
v
!=
ValueNull
.
INSTANCE
)
{
result
=
v
.
convertTo
(
dataType
);
result
=
v
.
convertTo
(
type
,
database
.
getMode
(),
null
);
break
;
}
}
...
...
@@ -988,7 +984,7 @@ public class Function extends Expression implements FunctionCall {
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
Value
v
=
getNullOrValue
(
session
,
args
,
values
,
i
);
if
(
v
!=
ValueNull
.
INSTANCE
)
{
v
=
v
.
convertTo
(
dataType
);
v
=
v
.
convertTo
(
type
,
database
.
getMode
(),
null
);
if
(
result
==
ValueNull
.
INSTANCE
)
{
result
=
v
;
}
else
{
...
...
@@ -1039,7 +1035,7 @@ public class Function extends Expression implements FunctionCall {
then
=
args
[
args
.
length
-
1
];
}
Value
v
=
then
==
null
?
ValueNull
.
INSTANCE
:
then
.
getValue
(
session
);
result
=
v
.
convertTo
(
dataType
);
result
=
v
.
convertTo
(
type
,
database
.
getMode
(),
null
);
break
;
}
case
ARRAY_GET:
{
...
...
@@ -2159,7 +2155,7 @@ public class Function extends Expression implements FunctionCall {
@Override
public
int
getValueType
()
{
return
dataType
;
return
type
.
getValueType
()
;
}
@Override
...
...
@@ -2296,8 +2292,6 @@ public class Function extends Expression implements FunctionCall {
public
void
setDataType
(
Column
col
)
{
TypeInfo
type
=
col
.
getType
();
this
.
type
=
type
;
dataType
=
type
.
getValueType
();
extTypeInfo
=
type
.
getExtTypeInfo
();
}
@Override
...
...
@@ -2474,7 +2468,7 @@ public class Function extends Expression implements FunctionCall {
case
TRUNCATE_VALUE:
if
(
type
!=
null
)
{
// data type, precision and scale is already set
t
=
dataType
;
t
=
type
.
getValueType
()
;
p
=
type
.
getPrecision
();
s
=
type
.
getScale
();
}
else
{
...
...
@@ -2630,8 +2624,7 @@ public class Function extends Expression implements FunctionCall {
p
=
type
.
maxPrecision
;
s
=
type
.
defaultScale
;
}
type
=
TypeInfo
.
getTypeInfo
(
t
,
p
,
s
,
extTypeInfo
);
dataType
=
t
;
type
=
TypeInfo
.
getTypeInfo
(
t
,
p
,
s
,
type
!=
null
?
type
.
getExtTypeInfo
()
:
null
);
if
(
allConst
)
{
Value
v
=
getValue
(
session
);
if
(
v
==
ValueNull
.
INSTANCE
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mode/FunctionsMySQL.java
浏览文件 @
41a502e3
...
...
@@ -202,8 +202,7 @@ public class FunctionsMySQL extends FunctionsBase {
if
(
allConst
)
{
return
ValueExpression
.
get
(
getValue
(
session
));
}
dataType
=
info
.
returnDataType
;
type
=
TypeInfo
.
getTypeInfo
(
dataType
);
type
=
TypeInfo
.
getTypeInfo
(
info
.
returnDataType
);
return
this
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/TypeInfo.java
浏览文件 @
41a502e3
...
...
@@ -291,15 +291,17 @@ public class TypeInfo {
case
Value
.
CLOB
:
return
new
TypeInfo
(
type
,
precision
,
0
,
MathUtils
.
convertLongToInt
(
precision
),
null
);
case
Value
.
GEOMETRY
:
if
(
extTypeInfo
==
null
)
{
if
(
extTypeInfo
instanceof
ExtTypeInfoGeometry
)
{
return
new
TypeInfo
(
Value
.
GEOMETRY
,
Integer
.
MAX_VALUE
,
0
,
Integer
.
MAX_VALUE
,
extTypeInfo
);
}
else
{
return
TYPE_GEOMETRY
;
}
return
new
TypeInfo
(
Value
.
GEOMETRY
,
Integer
.
MAX_VALUE
,
0
,
Integer
.
MAX_VALUE
,
extTypeInfo
);
case
Value
.
ENUM
:
if
(
extTypeInfo
==
null
)
{
if
(
extTypeInfo
instanceof
ExtTypeInfoEnum
)
{
return
new
TypeInfo
(
Value
.
ENUM
,
ValueEnum
.
PRECISION
,
0
,
ValueEnum
.
DISPLAY_SIZE
,
extTypeInfo
);
}
else
{
return
TYPE_ENUM_UNDEFINED
;
}
return
new
TypeInfo
(
Value
.
ENUM
,
ValueEnum
.
PRECISION
,
0
,
ValueEnum
.
DISPLAY_SIZE
,
extTypeInfo
);
case
Value
.
INTERVAL_YEAR
:
case
Value
.
INTERVAL_MONTH
:
case
Value
.
INTERVAL_DAY
:
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论