Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2daa26ba
提交
2daa26ba
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused display size parameters
上级
584b1c8d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
31 行增加
和
70 行删除
+31
-70
BinaryOperation.java
h2/src/main/org/h2/expression/BinaryOperation.java
+1
-1
Function.java
h2/src/main/org/h2/expression/function/Function.java
+13
-40
ValueDataType.java
h2/src/main/org/h2/mvstore/db/ValueDataType.java
+2
-3
SimpleResult.java
h2/src/main/org/h2/result/SimpleResult.java
+4
-7
Data.java
h2/src/main/org/h2/store/Data.java
+1
-3
Transfer.java
h2/src/main/org/h2/value/Transfer.java
+3
-6
TypeInfo.java
h2/src/main/org/h2/value/TypeInfo.java
+1
-3
ValueResultSet.java
h2/src/main/org/h2/value/ValueResultSet.java
+1
-2
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+2
-2
TestValue.java
h2/src/test/org/h2/test/unit/TestValue.java
+3
-3
没有找到文件。
h2/src/main/org/h2/expression/BinaryOperation.java
浏览文件 @
2daa26ba
...
...
@@ -169,7 +169,7 @@ public class BinaryOperation extends Expression {
if
(
DataType
.
isStringType
(
l
.
getValueType
())
&&
DataType
.
isStringType
(
r
.
getValueType
()))
{
long
precision
=
l
.
getPrecision
()
+
r
.
getPrecision
();
if
(
precision
>=
0
&&
precision
<
Integer
.
MAX_VALUE
)
{
type
=
TypeInfo
.
getTypeInfo
(
Value
.
STRING
,
precision
,
0
,
(
int
)
precision
,
null
);
type
=
TypeInfo
.
getTypeInfo
(
Value
.
STRING
,
precision
,
0
,
null
);
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/function/Function.java
浏览文件 @
2daa26ba
差异被折叠。
点击展开。
h2/src/main/org/h2/mvstore/db/ValueDataType.java
浏览文件 @
2daa26ba
...
...
@@ -421,8 +421,7 @@ public class ValueDataType implements DataType {
TypeInfo
columnType
=
result
.
getColumnType
(
i
);
buff
.
putVarInt
(
columnType
.
getValueType
()).
putVarLong
(
columnType
.
getPrecision
()).
putVarInt
(
columnType
.
getScale
()).
putVarInt
(
columnType
.
getDisplaySize
());
putVarInt
(
columnType
.
getScale
());
}
while
(
result
.
next
())
{
buff
.
put
((
byte
)
1
);
...
...
@@ -634,7 +633,7 @@ public class ValueDataType implements DataType {
SimpleResult
rs
=
new
SimpleResult
();
int
columns
=
readVarInt
(
buff
);
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
rs
.
addColumn
(
readString
(
buff
),
readString
(
buff
),
readVarInt
(
buff
),
readVarLong
(
buff
),
readVarInt
(
buff
),
rs
.
addColumn
(
readString
(
buff
),
readString
(
buff
),
readVarInt
(
buff
),
readVarLong
(
buff
),
readVarInt
(
buff
));
}
while
(
buff
.
get
()
!=
0
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/SimpleResult.java
浏览文件 @
2daa26ba
...
...
@@ -31,14 +31,13 @@ public class SimpleResult implements ResultInterface {
/** Column type. */
final
TypeInfo
columnType
;
Column
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
,
int
displaySize
)
{
Column
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
)
{
if
(
alias
==
null
||
columnName
==
null
)
{
throw
new
NullPointerException
();
}
this
.
alias
=
alias
;
this
.
columnName
=
columnName
;
this
.
columnType
=
TypeInfo
.
getTypeInfo
(
columnType
,
columnPrecision
,
columnScale
,
displaySize
,
null
);
this
.
columnType
=
TypeInfo
.
getTypeInfo
(
columnType
,
columnPrecision
,
columnScale
,
null
);
}
Column
(
String
alias
,
String
columnName
,
TypeInfo
columnType
)
{
...
...
@@ -108,11 +107,9 @@ public class SimpleResult implements ResultInterface {
* @param columnType Column's value type.
* @param columnPrecision Column's precision.
* @param columnScale Column's scale.
* @param displaySize Column's display data size.
*/
public
void
addColumn
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
,
int
displaySize
)
{
addColumn
(
new
Column
(
alias
,
columnName
,
columnType
,
columnPrecision
,
columnScale
,
displaySize
));
public
void
addColumn
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
)
{
addColumn
(
new
Column
(
alias
,
columnName
,
columnType
,
columnPrecision
,
columnScale
));
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/Data.java
浏览文件 @
2daa26ba
...
...
@@ -684,7 +684,6 @@ public class Data {
writeVarInt
(
columnType
.
getValueType
());
writeVarLong
(
columnType
.
getPrecision
());
writeVarInt
(
columnType
.
getScale
());
writeVarInt
(
columnType
.
getDisplaySize
());
}
while
(
result
.
next
())
{
writeByte
((
byte
)
1
);
...
...
@@ -908,7 +907,7 @@ public class Data {
SimpleResult
rs
=
new
SimpleResult
();
int
columns
=
readVarInt
();
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
rs
.
addColumn
(
readString
(),
readString
(),
readVarInt
(),
readVarLong
(),
readVarInt
()
,
readVarInt
()
);
rs
.
addColumn
(
readString
(),
readString
(),
readVarInt
(),
readVarLong
(),
readVarInt
());
}
while
(
readByte
()
!=
0
)
{
Value
[]
o
=
new
Value
[
columns
];
...
...
@@ -1172,7 +1171,6 @@ public class Data {
len
+=
getVarIntLen
(
columnType
.
getValueType
());
len
+=
getVarLongLen
(
columnType
.
getPrecision
());
len
+=
getVarIntLen
(
columnType
.
getScale
());
len
+=
getVarIntLen
(
columnType
.
getDisplaySize
());
}
while
(
result
.
next
())
{
len
++;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/Transfer.java
浏览文件 @
2daa26ba
...
...
@@ -518,14 +518,12 @@ public class Transfer {
writeString
(
result
.
getColumnName
(
i
));
writeInt
(
columnType
.
getValueType
());
writeLong
(
columnType
.
getPrecision
());
writeInt
(
columnType
.
getScale
());
writeInt
(
columnType
.
getDisplaySize
());
}
else
{
writeString
(
result
.
getColumnName
(
i
));
writeInt
(
DataType
.
getDataType
(
columnType
.
getValueType
()).
sqlType
);
writeInt
(
MathUtils
.
convertLongToInt
(
columnType
.
getPrecision
()));
writeInt
(
columnType
.
getScale
());
}
writeInt
(
columnType
.
getScale
());
}
while
(
result
.
next
())
{
writeBoolean
(
true
);
...
...
@@ -739,11 +737,10 @@ public class Transfer {
int
columns
=
readInt
();
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_18
)
{
rs
.
addColumn
(
readString
(),
readString
(),
readInt
(),
readLong
(),
readInt
()
,
readInt
()
);
rs
.
addColumn
(
readString
(),
readString
(),
readInt
(),
readLong
(),
readInt
());
}
else
{
String
name
=
readString
();
rs
.
addColumn
(
name
,
name
,
DataType
.
convertSQLTypeToValueType
(
readInt
()),
readInt
(),
readInt
(),
Integer
.
MAX_VALUE
);
rs
.
addColumn
(
name
,
name
,
DataType
.
convertSQLTypeToValueType
(
readInt
()),
readInt
(),
readInt
());
}
}
while
(
readBoolean
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/TypeInfo.java
浏览文件 @
2daa26ba
...
...
@@ -227,13 +227,11 @@ public class TypeInfo {
* the precision
* @param scale
* the scale
* @param displaySize
* the display size in characters
* @param extTypeInfo
* the extended type information, or null
* @return the data type with parameters object
*/
public
static
TypeInfo
getTypeInfo
(
int
type
,
long
precision
,
int
scale
,
int
displaySize
,
ExtTypeInfo
extTypeInfo
)
{
public
static
TypeInfo
getTypeInfo
(
int
type
,
long
precision
,
int
scale
,
ExtTypeInfo
extTypeInfo
)
{
switch
(
type
)
{
case
Value
.
NULL
:
case
Value
.
BOOLEAN
:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueResultSet.java
浏览文件 @
2daa26ba
...
...
@@ -58,8 +58,7 @@ public class ValueResultSet extends Value {
meta
.
getColumnTypeName
(
i
+
1
));
int
precision
=
meta
.
getPrecision
(
i
+
1
);
int
scale
=
meta
.
getScale
(
i
+
1
);
int
displaySize
=
meta
.
getColumnDisplaySize
(
i
+
1
);
simple
.
addColumn
(
alias
,
name
,
columnType
,
precision
,
scale
,
displaySize
);
simple
.
addColumn
(
alias
,
name
,
columnType
,
precision
,
scale
);
}
for
(
int
i
=
0
;
i
<
maxrows
&&
rs
.
next
();
i
++)
{
Value
[]
list
=
new
Value
[
columnCount
];
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
2daa26ba
...
...
@@ -208,8 +208,8 @@ public class TestDataPage extends TestBase implements DataHandler {
ValueInt
.
get
(
10
)
}));
SimpleResult
rs
=
new
SimpleResult
();
rs
.
addColumn
(
"ID"
,
"ID"
,
Value
.
INT
,
0
,
0
,
ValueInt
.
DISPLAY_SIZE
);
rs
.
addColumn
(
"NAME"
,
"NAME"
,
Value
.
STRING
,
255
,
0
,
255
);
rs
.
addColumn
(
"ID"
,
"ID"
,
Value
.
INT
,
0
,
0
);
rs
.
addColumn
(
"NAME"
,
"NAME"
,
Value
.
STRING
,
255
,
0
);
rs
.
addRow
(
ValueInt
.
get
(
1
),
ValueString
.
get
(
"Hello"
));
rs
.
addRow
(
ValueInt
.
get
(
2
),
ValueString
.
get
(
"World"
));
rs
.
addRow
(
ValueInt
.
get
(
3
),
ValueString
.
get
(
"Peace"
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestValue.java
浏览文件 @
2daa26ba
...
...
@@ -205,7 +205,7 @@ public class TestValue extends TestDb {
assertEquals
(
10
,
v
.
convertPrecision
(
10
,
true
).
getType
().
getPrecision
());
SimpleResult
rs
=
new
SimpleResult
();
rs
.
addColumn
(
"X"
,
"X"
,
Value
.
INT
,
0
,
0
,
ValueInt
.
DISPLAY_SIZE
);
rs
.
addColumn
(
"X"
,
"X"
,
Value
.
INT
,
0
,
0
);
rs
.
addRow
(
ValueInt
.
get
(
1
));
v
=
ValueResultSet
.
get
(
rs
);
assertEquals
(
Integer
.
MAX_VALUE
,
v
.
getType
().
getPrecision
());
...
...
@@ -236,8 +236,8 @@ public class TestValue extends TestDb {
testValueResultSetTest
(
ValueResultSet
.
get
(
null
,
rs
,
2
),
2
,
true
);
SimpleResult
result
=
new
SimpleResult
();
result
.
addColumn
(
"ID"
,
"ID"
,
Value
.
INT
,
0
,
0
,
ValueInt
.
DISPLAY_SIZE
);
result
.
addColumn
(
"NAME"
,
"NAME"
,
Value
.
STRING
,
255
,
0
,
255
);
result
.
addColumn
(
"ID"
,
"ID"
,
Value
.
INT
,
0
,
0
);
result
.
addColumn
(
"NAME"
,
"NAME"
,
Value
.
STRING
,
255
,
0
);
result
.
addRow
(
ValueInt
.
get
(
1
),
ValueString
.
get
(
"Hello"
));
result
.
addRow
(
ValueInt
.
get
(
2
),
ValueString
.
get
(
"World"
));
result
.
addRow
(
ValueInt
.
get
(
3
),
ValueString
.
get
(
"Peace"
));
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论