Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ad92b287
提交
ad92b287
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unnecessary precision argument of Value.convertTo(int, int, Mode)
上级
feb11859
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
19 行增加
和
22 行删除
+19
-22
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+1
-1
FunctionAlias.java
h2/src/main/org/h2/engine/FunctionAlias.java
+2
-2
ConditionInConstantSet.java
h2/src/main/org/h2/expression/ConditionInConstantSet.java
+2
-2
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-2
Operation.java
h2/src/main/org/h2/expression/Operation.java
+2
-2
HashIndex.java
h2/src/main/org/h2/index/HashIndex.java
+1
-1
NonUniqueHashIndex.java
h2/src/main/org/h2/index/NonUniqueHashIndex.java
+1
-1
JdbcPreparedStatement.java
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
+1
-1
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+1
-1
Value.java
h2/src/main/org/h2/value/Value.java
+5
-8
没有找到文件。
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
ad92b287
...
@@ -143,7 +143,7 @@ public class SelectUnion extends Query {
...
@@ -143,7 +143,7 @@ public class SelectUnion extends Query {
Mode
mode
=
session
.
getDatabase
().
getMode
();
Mode
mode
=
session
.
getDatabase
().
getMode
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
Expression
e
=
expressions
.
get
(
i
);
Expression
e
=
expressions
.
get
(
i
);
newValues
[
i
]
=
values
[
i
].
convertTo
(
e
.
getType
(),
-
1
,
mode
);
newValues
[
i
]
=
values
[
i
].
convertTo
(
e
.
getType
(),
mode
);
}
}
return
newValues
;
return
newValues
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/FunctionAlias.java
浏览文件 @
ad92b287
...
@@ -412,11 +412,11 @@ public class FunctionAlias extends SchemaObjectBase {
...
@@ -412,11 +412,11 @@ public class FunctionAlias extends SchemaObjectBase {
paramClass
.
getComponentType
());
paramClass
.
getComponentType
());
Mode
mode
=
session
.
getDatabase
().
getMode
();
Mode
mode
=
session
.
getDatabase
().
getMode
();
for
(
int
i
=
0
;
i
<
objArray
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
objArray
.
length
;
i
++)
{
objArray
[
i
]
=
array
[
i
].
convertTo
(
componentType
,
-
1
,
mode
).
getObject
();
objArray
[
i
]
=
array
[
i
].
convertTo
(
componentType
,
mode
).
getObject
();
}
}
o
=
objArray
;
o
=
objArray
;
}
else
{
}
else
{
v
=
v
.
convertTo
(
type
,
-
1
,
session
.
getDatabase
().
getMode
());
v
=
v
.
convertTo
(
type
,
session
.
getDatabase
().
getMode
());
o
=
v
.
getObject
();
o
=
v
.
getObject
();
}
}
if
(
o
==
null
)
{
if
(
o
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ConditionInConstantSet.java
浏览文件 @
ad92b287
...
@@ -60,7 +60,7 @@ public class ConditionInConstantSet extends Condition {
...
@@ -60,7 +60,7 @@ public class ConditionInConstantSet extends Condition {
}
}
}
else
{
}
else
{
for
(
Expression
expression
:
valueList
)
{
for
(
Expression
expression
:
valueList
)
{
valueSet
.
add
(
expression
.
getValue
(
session
).
convertTo
(
type
,
-
1
,
mode
));
valueSet
.
add
(
expression
.
getValue
(
session
).
convertTo
(
type
,
mode
));
}
}
}
}
}
}
...
@@ -172,7 +172,7 @@ public class ConditionInConstantSet extends Condition {
...
@@ -172,7 +172,7 @@ public class ConditionInConstantSet extends Condition {
if
(
type
==
Value
.
ENUM
)
{
if
(
type
==
Value
.
ENUM
)
{
valueSet
.
add
(
add
.
getValue
(
session
).
convertToEnum
(
enumerators
));
valueSet
.
add
(
add
.
getValue
(
session
).
convertToEnum
(
enumerators
));
}
else
{
}
else
{
valueSet
.
add
(
add
.
getValue
(
session
).
convertTo
(
type
,
-
1
,
session
.
getDatabase
().
getMode
()));
valueSet
.
add
(
add
.
getValue
(
session
).
convertTo
(
type
,
session
.
getDatabase
().
getMode
()));
}
}
return
this
;
return
this
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
ad92b287
...
@@ -62,7 +62,7 @@ public class ConditionInSelect extends Condition {
...
@@ -62,7 +62,7 @@ public class ConditionInSelect extends Condition {
if
(
dataType
==
Value
.
NULL
)
{
if
(
dataType
==
Value
.
NULL
)
{
return
ValueBoolean
.
FALSE
;
return
ValueBoolean
.
FALSE
;
}
}
l
=
l
.
convertTo
(
dataType
,
-
1
,
database
.
getMode
());
l
=
l
.
convertTo
(
dataType
,
database
.
getMode
());
if
(
rows
.
containsDistinct
(
new
Value
[]
{
l
}))
{
if
(
rows
.
containsDistinct
(
new
Value
[]
{
l
}))
{
return
ValueBoolean
.
TRUE
;
return
ValueBoolean
.
TRUE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Function.java
浏览文件 @
ad92b287
...
@@ -873,7 +873,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -873,7 +873,7 @@ public class Function extends Expression implements FunctionCall {
case
CAST:
case
CAST:
case
CONVERT:
{
case
CONVERT:
{
Mode
mode
=
database
.
getMode
();
Mode
mode
=
database
.
getMode
();
v0
=
v0
.
convertTo
(
dataType
,
-
1
,
mode
);
v0
=
v0
.
convertTo
(
dataType
,
mode
);
v0
=
v0
.
convertScale
(
mode
.
convertOnlyToSmallerScale
,
scale
);
v0
=
v0
.
convertScale
(
mode
.
convertOnlyToSmallerScale
,
scale
);
v0
=
v0
.
convertPrecision
(
getPrecision
(),
false
);
v0
=
v0
.
convertPrecision
(
getPrecision
(),
false
);
result
=
v0
;
result
=
v0
;
...
@@ -902,7 +902,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -902,7 +902,7 @@ public class Function extends Expression implements FunctionCall {
if
(
v0
==
ValueNull
.
INSTANCE
)
{
if
(
v0
==
ValueNull
.
INSTANCE
)
{
result
=
getNullOrValue
(
session
,
args
,
values
,
1
);
result
=
getNullOrValue
(
session
,
args
,
values
,
1
);
}
}
result
=
result
.
convertTo
(
dataType
,
-
1
,
database
.
getMode
());
result
=
result
.
convertTo
(
dataType
,
database
.
getMode
());
break
;
break
;
}
}
case
CASEWHEN:
{
case
CASEWHEN:
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Operation.java
浏览文件 @
ad92b287
...
@@ -110,14 +110,14 @@ public class Operation extends Expression {
...
@@ -110,14 +110,14 @@ public class Operation extends Expression {
@Override
@Override
public
Value
getValue
(
Session
session
)
{
public
Value
getValue
(
Session
session
)
{
Mode
mode
=
session
.
getDatabase
().
getMode
();
Mode
mode
=
session
.
getDatabase
().
getMode
();
Value
l
=
left
.
getValue
(
session
).
convertTo
(
dataType
,
-
1
,
mode
);
Value
l
=
left
.
getValue
(
session
).
convertTo
(
dataType
,
mode
);
Value
r
;
Value
r
;
if
(
right
==
null
)
{
if
(
right
==
null
)
{
r
=
null
;
r
=
null
;
}
else
{
}
else
{
r
=
right
.
getValue
(
session
);
r
=
right
.
getValue
(
session
);
if
(
convertRight
)
{
if
(
convertRight
)
{
r
=
r
.
convertTo
(
dataType
,
-
1
,
mode
);
r
=
r
.
convertTo
(
dataType
,
mode
);
}
}
}
}
switch
(
opType
)
{
switch
(
opType
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/HashIndex.java
浏览文件 @
ad92b287
...
@@ -77,7 +77,7 @@ public class HashIndex extends BaseIndex {
...
@@ -77,7 +77,7 @@ public class HashIndex extends BaseIndex {
* case we need to convert, otherwise the ValueHashMap will not find the
* case we need to convert, otherwise the ValueHashMap will not find the
* result.
* result.
*/
*/
v
=
v
.
convertTo
(
tableData
.
getColumn
(
indexColumn
).
getType
(),
-
1
,
database
.
getMode
());
v
=
v
.
convertTo
(
tableData
.
getColumn
(
indexColumn
).
getType
(),
database
.
getMode
());
Row
result
;
Row
result
;
Long
pos
=
rows
.
get
(
v
);
Long
pos
=
rows
.
get
(
v
);
if
(
pos
==
null
)
{
if
(
pos
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/NonUniqueHashIndex.java
浏览文件 @
ad92b287
...
@@ -101,7 +101,7 @@ public class NonUniqueHashIndex extends BaseIndex {
...
@@ -101,7 +101,7 @@ public class NonUniqueHashIndex extends BaseIndex {
* case we need to convert, otherwise the ValueHashMap will not find the
* case we need to convert, otherwise the ValueHashMap will not find the
* result.
* result.
*/
*/
v
=
v
.
convertTo
(
tableData
.
getColumn
(
indexColumn
).
getType
(),
-
1
,
database
.
getMode
());
v
=
v
.
convertTo
(
tableData
.
getColumn
(
indexColumn
).
getType
(),
database
.
getMode
());
ArrayList
<
Long
>
positions
=
rows
.
get
(
v
);
ArrayList
<
Long
>
positions
=
rows
.
get
(
v
);
return
new
NonUniqueHashCursor
(
session
,
tableData
,
positions
);
return
new
NonUniqueHashCursor
(
session
,
tableData
,
positions
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
浏览文件 @
ad92b287
...
@@ -562,7 +562,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements
...
@@ -562,7 +562,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements
setParameter
(
parameterIndex
,
ValueNull
.
INSTANCE
);
setParameter
(
parameterIndex
,
ValueNull
.
INSTANCE
);
}
else
{
}
else
{
Value
v
=
DataType
.
convertToValue
(
conn
.
getSession
(),
x
,
type
);
Value
v
=
DataType
.
convertToValue
(
conn
.
getSession
(),
x
,
type
);
setParameter
(
parameterIndex
,
v
.
convertTo
(
type
,
-
1
,
conn
.
getMode
()));
setParameter
(
parameterIndex
,
v
.
convertTo
(
type
,
conn
.
getMode
()));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
ad92b287
...
@@ -1066,7 +1066,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
...
@@ -1066,7 +1066,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet, JdbcResultS
public
byte
[]
getBytes
(
int
columnIndex
)
throws
SQLException
{
public
byte
[]
getBytes
(
int
columnIndex
)
throws
SQLException
{
try
{
try
{
debugCodeCall
(
"getBytes"
,
columnIndex
);
debugCodeCall
(
"getBytes"
,
columnIndex
);
return
get
(
columnIndex
).
convertTo
(
Value
.
BYTES
,
-
1
,
conn
.
getMode
()).
getBytes
();
return
get
(
columnIndex
).
convertTo
(
Value
.
BYTES
,
conn
.
getMode
()).
getBytes
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/Value.java
浏览文件 @
ad92b287
...
@@ -589,7 +589,7 @@ public abstract class Value {
...
@@ -589,7 +589,7 @@ public abstract class Value {
public
Value
convertTo
(
int
targetType
)
{
public
Value
convertTo
(
int
targetType
)
{
// Use -1 to indicate "default behaviour" where value conversion should not
// Use -1 to indicate "default behaviour" where value conversion should not
// depend on any datatype precision.
// depend on any datatype precision.
return
convertTo
(
targetType
,
-
1
,
null
);
return
convertTo
(
targetType
,
null
);
}
}
/**
/**
...
@@ -607,14 +607,11 @@ public abstract class Value {
...
@@ -607,14 +607,11 @@ public abstract class Value {
* Compare a value to the specified type.
* Compare a value to the specified type.
*
*
* @param targetType the type of the returned value
* @param targetType the type of the returned value
* @param precision the precision of the column to convert this value to.
* The special constant <code>-1</code> is used to indicate that
* the precision plays no role when converting the value
* @param mode the mode
* @param mode the mode
* @return the converted value
* @return the converted value
*/
*/
public
final
Value
convertTo
(
int
targetType
,
int
precision
,
Mode
mode
)
{
public
final
Value
convertTo
(
int
targetType
,
Mode
mode
)
{
return
convertTo
(
targetType
,
precision
,
mode
,
null
,
null
);
return
convertTo
(
targetType
,
-
1
,
mode
,
null
,
null
);
}
}
/**
/**
...
@@ -1193,8 +1190,8 @@ public abstract class Value {
...
@@ -1193,8 +1190,8 @@ public abstract class Value {
l
=
l
.
convertToEnum
(
enumerators
);
l
=
l
.
convertToEnum
(
enumerators
);
v
=
v
.
convertToEnum
(
enumerators
);
v
=
v
.
convertToEnum
(
enumerators
);
}
else
{
}
else
{
l
=
l
.
convertTo
(
dataType
,
-
1
,
databaseMode
);
l
=
l
.
convertTo
(
dataType
,
databaseMode
);
v
=
v
.
convertTo
(
dataType
,
-
1
,
databaseMode
);
v
=
v
.
convertTo
(
dataType
,
databaseMode
);
}
}
}
}
return
l
.
compareSecure
(
v
,
compareMode
);
return
l
.
compareSecure
(
v
,
compareMode
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论